Skip to content

Weird tag case interaction between xmlshim and jsdom #1

@apendleton

Description

@apendleton

Not sure if this is a jsdom or xmlshim issue, but here goes...

Tag cases in documents parsed with xmlshim's DOMParser generally preserve their original cases, but as soon as you use jsdom to parse HTML, xmlshim's behavior changes and starts returning them as uppercase. Sample script:

var DOMParser = require('xmlshim').DOMParser;
var jsdom = require("jsdom");
console.log((new DOMParser()).parseFromString('<xml></xml>', 'text/xml').documentElement.tagName);
jsdom.jsdom("<html><head></head><body></body></html>");
console.log((new DOMParser()).parseFromString('<xml></xml>', 'text/xml').documentElement.tagName);

This produces:

xml
XML

Per jsdom/jsdom#175 it does look like jsdom switches its behavior back and forth depending on whether or not it thinks it's parsing HTML or XML, but that bug implies that it's per-document. It looks from this example, though, like jsdom and xmlshim are sharing global state in a way I wouldn't have expected.

This is all on node 0.6.8, jsdom 0.2.10, and xmlshim 0.0.3.

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