We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is related to but distinct from #333
The RewritingStream.emitText() method always calls escapeString on the text:
RewritingStream.emitText()
parse5/packages/parse5-html-rewriting-stream/lib/index.js
Lines 79 to 81 in 9c683e1
This causes it to break JavaScript. For example:
<script type="text/javascript"> (function() { if ('PerformanceObserver' in window && 'PerformancePaintTiming' in window) { // ...
ends up as
<script type="text/javascript"> (function() { if ('PerformanceObserver' in window && 'PerformancePaintTiming' in window) { // ...
and then the browser's JS parser chokes with a syntax error when it hits the &&.
&&
It should probably do something similar to what _serializeTextNode does:
parse5/packages/parse5/lib/serializer/index.js
Lines 136 to 149 in 9c683e1
(Or, whatever it ends up doing after the resolution of #333)
For a short-term workaround, I'm going to just call stream.push() stream.emitRaw() when inside of a <script> tag.
stream.push()
stream.emitRaw()
The text was updated successfully, but these errors were encountered:
fix(rewriting-stream): Don't escape text in special tags
b113c08
Fixes #339
Successfully merging a pull request may close this issue.
This is related to but distinct from #333
The
RewritingStream.emitText()
method always calls escapeString on the text:parse5/packages/parse5-html-rewriting-stream/lib/index.js
Lines 79 to 81 in 9c683e1
This causes it to break JavaScript. For example:
ends up as
and then the browser's JS parser chokes with a syntax error when it hits the
&&
.It should probably do something similar to what _serializeTextNode does:
parse5/packages/parse5/lib/serializer/index.js
Lines 136 to 149 in 9c683e1
(Or, whatever it ends up doing after the resolution of #333)
For a short-term workaround, I'm going to just call
stream.push()
stream.emitRaw()
when inside of a <script> tag.The text was updated successfully, but these errors were encountered: