Can not parse html with tags inside script string
hqjs opened this issue · comments
hq commented
Details
Posthtml can not successfully parse valid html like this
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script>
window.onerror = function() {
document.open();
document.write("<h1>An error occurred</h1>");
document.close();
}
</script>
</head>
<body>
</body>
</html>
It recognizes script content as
window.onerror = function() {
document.open();
document.write("
because of the tag <h1>
presented inside the string in a script.
Environment
OS: MacOS Mojave
node: v10.9.0
npm: 6.2.0
package: posthtml@0.11.3
Chandan Manna commented
Hi @hqjs ! I just add the script ( just to test it ) on my on going project which is using posthtml, postcss, gulp , sugarss & AMP. It parsed the script as it is without error,
I am using Linux : zorin OS, Node: 8.12