Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

href ignored for u-* properties #43

Open
jansauer opened this issue Jun 9, 2019 · 1 comment
Open

href ignored for u-* properties #43

jansauer opened this issue Jun 9, 2019 · 1 comment

Comments

@jansauer
Copy link

jansauer commented Jun 9, 2019

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);
   });
});
@aaronpk
Copy link

aaronpk commented Jun 17, 2019

It looks like for some reason the <time> element inside the <a class="u-uid u-url"> is causing the parser to return the value of the <time> element as the url and uid properties. This is clearly a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants