mirror of
https://github.com/remy/inliner.git
synced 2024-09-11 17:25:30 +03:00
fix: prevent signs like "<" or ">" to be treated as HTML in scripts
This commit is contained in:
parent
593a2749cf
commit
4e7acd39bb
@ -239,7 +239,7 @@ function main() {
|
||||
return promise.then(inliner.uglify.bind(inliner))
|
||||
.then(function then(res) {
|
||||
debug('uglify: %s', res);
|
||||
$script.html(res);
|
||||
$script.text(res);
|
||||
});
|
||||
});
|
||||
|
||||
|
2
test/fixtures/script-inline.result.html
vendored
2
test/fixtures/script-inline.result.html
vendored
@ -1 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>inline script</title> </head> <body> <script>function doit(o){var r="remy",e=o.bar="sharp";return r+e.split("").reverse().join("")}console.log(doit(window));</script> <script>console.log("Hello world");</script> </body> </html>
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>inline script</title> </head> <body> <script>function doit(o){var r="remy",e=o.bar="sharp";return r+e.split("").reverse().join("")}console.log(doit(window));</script> <script>for(var array=[4,8,15,16,23,42],i=0;i<array.length;i++)console.log(array[i]);</script> </body> </html>
|
||||
|
8
test/fixtures/script-inline.src.html
vendored
8
test/fixtures/script-inline.src.html
vendored
@ -13,6 +13,12 @@
|
||||
|
||||
console.log(doit(window));
|
||||
</script>
|
||||
<script>console.log('Hello world');</script>
|
||||
<script>
|
||||
var array = [4, 8, 15, 16, 23, 42];
|
||||
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
console.log(array[i]);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
6
test/fixtures/script-local.js
vendored
6
test/fixtures/script-local.js
vendored
@ -1 +1,5 @@
|
||||
console.log('Hello world');
|
||||
var array = [4, 8, 15, 16, 23, 42];
|
||||
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
console.log(array[i]);
|
||||
}
|
2
test/fixtures/script-local.result.html
vendored
2
test/fixtures/script-local.result.html
vendored
@ -1 +1 @@
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>min script</title> </head> <body> <script>console.log("Hello world");</script> </body> </html>
|
||||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>min script</title> </head> <body> <script>for(var array=[4,8,15,16,23,42],i=0;i<array.length;i++)console.log(array[i]);</script> </body> </html>
|
Loading…
Reference in New Issue
Block a user