Skip to content

Commit 12cae8c

Browse files
committed
Test handling of missing <html> tag
Fixes jsdom#555. The testcase in the issue isn't entirely correct. If the </title> tag is omitted, the <p> tag is actually in the <title> and won't be picked up by querySelectorAll. Tried to replicate the original test case as closely as possible, verified with Chrome.
1 parent 3d46ebb commit 12cae8c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/jsdom/parsing.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,14 @@ exports["Don't error on invalid chinese tags (GH-719)"] = function (t) {
181181
}
182182
});
183183
};
184+
185+
exports["Handle missing <html> tag correctly (GH-555)"] = function (t) {
186+
var doctype = "<!DOCTYPE html PUBLIC\"-//W3C//DTD HTML 4.0//EN\">";
187+
var docA = jsdom(doctype + "<html><head><title></title></head><p>");
188+
var docB = jsdom(doctype + "<head><title></title></head><p>")
189+
190+
t.strictEqual(docA.querySelectorAll("p").length, 1);
191+
t.strictEqual(docB.querySelectorAll("p").length, 1);
192+
193+
t.done();
194+
};

0 commit comments

Comments
 (0)