Skip to content

href ignored for u-* properties  #43

Description

@jansauer

In the following example the parser uses the textContent for u-url and u-uid. Based on the u-* parsing rules from http://microformats.org/wiki/microformats2-parsing i was expecting to get the href attribute. As rule 1 if a.u-x[href] or area.u-x[href] or link.u-x[href], then get the href attribute.

var chai = require('chai'),
   assert = chai.assert,
   helper = require('../test/helper.js');


describe('h-entry', function() {
   var htmlFragment = "<li class=\"h-entry hentry\">\r\n  <p class=\"p-name entry-title e-content entry-content\">\r\n    Google the company *already* effectively rebranded, into Alphabet_Inc.\r\n  <\/p>\r\n  <span class=\"footer\"><a href=\"2019\/156\/t2\/\" class=\"dt-published published dt-updated updated u-url u-uid\"><time class=\"value\" datetime=\"11:56-0700\">11:56<\/time> on <time class=\"value\">2019-06-05<\/time><\/a><\/span>\r\n<\/li>";
   var found = helper.parseHTML(htmlFragment,'http://example.com/');
   var expected = "/2019/156/t2/";

   it('u-url', function(){
      var url = found.items[0].properties.url[0];
      assert.equal(url, expected);
   });

   it('u-uid', function(){
      var uid = found.items[0].properties.uid[0];
      assert.equal(uid, expected);
   });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions