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

Already on GitHub? Sign in to your account

getAttribute() on attributes without value return attribute name rather than "" #488

Closed
godmar opened this Issue Sep 6, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

godmar commented Sep 6, 2012

Test case:

var jsdom    = require("./lib/jsdom").jsdom,
    doc   = jsdom("<html ng-app><body></body></html>", null, {
      browser: { }
    });

console.log(doc.getElementsByTagName("html")[0].getAttribute("ng-app"));

outputs 'ng-app' . Google Chromium output "" for the same call.

If I use 'parser: HTML5' (adridel's HTML5) parser, output is like Chromium.

The version of Sizzle included in jsdom seems to rely on this behavior, so I cannot use the HTML5 parser.

yzh0709 commented Sep 7, 2012

this is a learning program for us. So I know how to solve the problem.

2012/9/7 godmar notifications@github.com

Test case:

var jsdom = require("./lib/jsdom").jsdom,
doc = jsdom("", null, {
browser: { }
});

console.log(doc.getElementsByTagName("html")[0].getAttribute("ng-app"));

outputs 'ng-app' . Google Chromium output "" for the same call.

If I use 'parser: HTML5' (adridel's HTML5) parser, output is like Chromium.

The version of Sizzle included in jsdom seems to rely on this behavior, so
I cannot use the HTML5 parser.

¡ª
Reply to this email directly or view it on GitHubhttps://github.com/tmpvar/jsdom/issues/488.

ÑîÕñº£

Contributor

godmar commented Sep 7, 2012

I don't follow.

I also don't know what the normative behavior is, just that jsdom != WebKit (ironically, HTML5+json == WebKit and that breaks jsdom's bundled sizzle which then fails to select "[ng-app]")

@domenic domenic closed this in 073df68 Apr 15, 2013

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