remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

Script escaping improvement, relevant to #11 #14

Closed Munter closed 9 years ago

Munter commented 12 years ago

In issue #11 @mathiasbynens points out that the escaping of script end tags in the script source only covers one of three cases.

I discovered that there are actually more cases, since white space is apparently allowed between </ and script.

This update should cover all those cases.

By the way I stumbled upon this project because the html5boiler plate npm build system references it. I am working on a project called assetgraph, which is a build system toolkit, and thought inliner would be a fun example for one of many tools that all need pretty much to do the same, and where assetgraph covers over 95% of the work already. My reimplementation of inliner can be found here: https://github.com/Munter/buildfu/blob/master/bin/inline

Thanks for the inspiration :)

remy commented 9 years ago

This might be fixed in 1.0.0 - but do you think you can create a test/fixture/script-esc.src.html and test/fixture/script-esc.result.html and it'll be automatically tests to check...

Munter commented 9 years ago

This PR doesn't really seem relevant anymore, seeing as that string replacement had been refactored away.

Is the expected result of inlining <script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script> really <script></script> ?

remy commented 9 years ago

No. It should put the contents of script inline, but ignore minified scripts. So that's a new bug!