mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixed doctype support
This commit is contained in:
parent
68d5e2e7cb
commit
7b0b137424
@ -35,15 +35,16 @@ module.exports = function transform(node, compiler) {
|
|||||||
if (compiler.options.xhtml !== true && startTagOnly[lookupKey] === true) {
|
if (compiler.options.xhtml !== true && startTagOnly[lookupKey] === true) {
|
||||||
node.setStartTagOnly(true);
|
node.setStartTagOnly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.getQName() === 'html' && node.hasAttribute('html-doctype')) {
|
var doctype;
|
||||||
var doctype = node.getAttribute('html-doctype');
|
|
||||||
|
if (node.getQName() === 'html' && (doctype = node.getProperty('html-doctype'))) {
|
||||||
|
|
||||||
var docTypeNode = compiler.createNode(DocTypeNode, {
|
var docTypeNode = compiler.createNode(DocTypeNode, {
|
||||||
value: doctype,
|
value: doctype,
|
||||||
pos: node.getPosition()
|
pos: node.getPosition()
|
||||||
});
|
});
|
||||||
node.parentNode.insertBefore(docTypeNode, node);
|
node.parentNode.insertBefore(docTypeNode, node);
|
||||||
node.removeAttribute('html-doctype');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -3,7 +3,12 @@
|
|||||||
"html": {
|
"html": {
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"html-doctype": {
|
"html-doctype": {
|
||||||
"type": "string"
|
"type": "custom",
|
||||||
|
"preserve-name": true
|
||||||
|
},
|
||||||
|
"*": {
|
||||||
|
"type": "string",
|
||||||
|
"ignore": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<html-doctype value="HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd""/>
|
<html-doctype value="HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd""/>
|
||||||
|
|
||||||
<html html-doctype="html">
|
<html lang="en-us" html-doctype="html">
|
||||||
<head>
|
<head>
|
||||||
<title>DOCTYPE Test</title>
|
<title>DOCTYPE Test</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!DOCTYPE html><html><head><title>DOCTYPE Test</title></head><body></body></html>
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!DOCTYPE html><html lang="en-us"><head><title>DOCTYPE Test</title></head><body></body></html>
|
||||||
Loading…
x
Reference in New Issue
Block a user