htmling icon indicating copy to clipboard operation
htmling copied to clipboard

When a script has attributes on a new line, the document doesn't parse.

Open TickleThePanda opened this issue 9 years ago • 0 comments

I wanted to add jquery to a particular page. The following snippet caused a parse error:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"
    integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
    crossorigin="anonymous">

Error:

Jan 22 12:56:10 4986-11937-2229 node[17019]: /**/node_modules/htmling/lib/parser.js:7782
Jan 22 12:56:10 4986-11937-2229 node[17019]: throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
Jan 22 12:56:10 4986-11937-2229 node[17019]: ^
Jan 22 12:56:10 4986-11937-2229 node[17019]: SyntaxError: Expected <content>, <include>, <script>, <template>, Custom Element, OutputStatement, Raw Content, comment or end of input but "<" found.

This doesn't occur if the script is all on one line, e.g.:

<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous">

TickleThePanda avatar Jan 22 '17 12:01 TickleThePanda