Skip to content
New issue

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

HTMLSplitter doesn't split script tags with the string "</script>" #821

Open
romaviolenta opened this issue Dec 19, 2018 · 4 comments
Open

Comments

@romaviolenta
Copy link

romaviolenta commented Dec 19, 2018

Hi,
I'm trying to build with js-minify e bundle enable, but in chrome console there is an error:

Uncaught SyntaxError: Invalid or unexpected token

This error is referred to this code :

if (this.myIFrame.src && "javascript:" === this.myIFrame.src.substr(0, "javascript:".length)) o = "<script>document.domain=\"" + document.domain + "\";</script>";

image

@keanulee
Copy link
Contributor

I think HtmlSplitter/parse5 may be incorrectly splitting at the "</script>" string. Can you try to see what happens if you break up that string (e.g. "</scr"+"ipt>")?

@gilbertococchi
Copy link

Hi Keanu, you are right.
By splitting that way the Parser will no longer trigger the error.
Do you think we should open a pull request on htmlsplitter to change that?

@keanulee
Copy link
Contributor

PR welcome, but given that we use parse5 for parsing, the fix will probably either need to be there or a re-implementation of parsing here. I don't think this issue a big priority for the team because inlining a script tag with HTML is unconventional.

@keanulee keanulee changed the title Polymer 2 build error with js-minify e bundle HTMLSplitter doesn't split script tags with the string "</script> Jan 22, 2019
@keanulee keanulee changed the title HTMLSplitter doesn't split script tags with the string "</script> HTMLSplitter doesn't split script tags with the string "</script>" Jan 22, 2019
@stale
Copy link

stale bot commented Mar 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants