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

Vulcanize mangles javascript code containing --> #1857

Open
zboralski opened this issue Jan 30, 2016 · 9 comments
Open

Vulcanize mangles javascript code containing --> #1857

zboralski opened this issue Jan 30, 2016 · 9 comments

Comments

@zboralski
Copy link

After running vulcanize on elements.html which imports an element containing:

<script language="JavaScript" type="text/javascript" src="../../bower_components/jsrsasign/jsrsasign-latest-all-min.js"></script>
if (f-- > 0)

is changed to

if (f--\x3e0)

and causing polyclean to choke :
googlearchive/polybuild#27

@zboralski
Copy link
Author

The problem is that any occurrence of -->0 will be rewritten by vulcanize as --\x3e0..

I replace all -->0 to -- > 0 and it solved the problem with polybuild, chrome, etc...

@zboralski zboralski changed the title Vulcanize mangles code Vulcanize mangles --> code Jan 30, 2016
@zboralski zboralski changed the title Vulcanize mangles --> code Vulcanize mangles javascript code containing --> Jan 30, 2016
@zboralski
Copy link
Author

Note that the original file jsbn.js used (f-- > 0) but when it was minified into the jsrsasign components... it was simplified to (f-->0)

@garlicnation garlicnation self-assigned this Feb 4, 2016
@mm-gmbd
Copy link

mm-gmbd commented Feb 9, 2016

+1, thanks for figuring this out @zboralski!!

@garlicnation
Copy link
Contributor

@azakus Could this be caused by the included uglify change?

@dfreedm
Copy link
Member

dfreedm commented Feb 9, 2016

Possibly. --inline-script will try to escape </script> https://github.com/Polymer/vulcanize/blob/master/third_party/UglifyJS2/output.js#L55-L57

@halkar
Copy link

halkar commented Feb 18, 2016

+1 thanks @zboralski

@d1manson
Copy link

Thanks for figuring this out. I encountered this problem with --> in a js comment (I was using it as an arrow).

@rbellens
Copy link

rbellens commented Jun 9, 2017

I don't know in which cases script tags should be escaped, but turning it off in
https://github.com/Polymer/polymer-bundler/blob/master/src/import-utils.ts#L209
fixes the issue. Is it safe or will it break some other use cases?

@aomarks aomarks transferred this issue from Polymer/polymer-bundler Jan 3, 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.

@stale stale bot added the wontfix label Mar 3, 2020
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

8 participants