close #42 fallback to html when doctype is invalid
This commit is contained in:
@@ -85,7 +85,7 @@ function buildNode(
|
||||
return doc.implementation.createDocument(null, '', null);
|
||||
case NodeType.DocumentType:
|
||||
return doc.implementation.createDocumentType(
|
||||
n.name,
|
||||
n.name || 'html',
|
||||
n.publicId,
|
||||
n.systemId,
|
||||
);
|
||||
|
||||
@@ -175,6 +175,15 @@ exports[`[html file]: invalid-attribute.html 1`] = `
|
||||
</body></html>"
|
||||
`;
|
||||
|
||||
exports[`[html file]: invalid-doctype.html 1`] = `
|
||||
"<!DOCTYPE html><html xmlns=\\"http://www.w3.org/1999/xhtml\\" lang=\\"en\\"><head>
|
||||
<meta charset=\\"UTF-8\\" />
|
||||
<meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\" />
|
||||
<title>Invalid Doctype</title>
|
||||
</head>
|
||||
<body></body></html>"
|
||||
`;
|
||||
|
||||
exports[`[html file]: invalid-tagname.html 1`] = `
|
||||
"<!DOCTYPE html><html xmlns=\\"http://www.w3.org/1999/xhtml\\" lang=\\"en\\"><head>
|
||||
<meta charset=\\"UTF-8\\" />
|
||||
|
||||
9
test/html/invalid-doctype.html
Normal file
9
test/html/invalid-doctype.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE >
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Invalid Doctype</title>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user