Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make `Prototype.ScriptFragment` properly handle whitespace in a closi…

…ng SCRIPT tag. [#1297 state:resolved] (piopier, Victor)
  • Loading branch information...
commit 6c7ffe29cd3604be4081a9510cb2015fcc377ae4 1 parent 43adb8b
@savetheclocktower savetheclocktower authored
Showing with 4 additions and 1 deletion.
  1. +1 −1  src/prototype/prototype.js
  2. +3 −0  test/unit/string_test.js
View
2  src/prototype/prototype.js
@@ -139,7 +139,7 @@ var Prototype = {
})()
},
- ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script\\s*>',
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
/**
View
3  test/unit/string_test.js
@@ -215,6 +215,9 @@ new Test.Unit.Runner({
this.assertEqual('foo bar', 'foo bar'.stripScripts());
this.assertEqual('foo bar', ('foo <script>boo();<'+'/script>bar').stripScripts());
this.assertEqual('foo bar', ('foo <script type="text/javascript">boo();\nmoo();<'+'/script>bar').stripScripts());
+
+ this.assertEqual('foo bar', ('foo <script>boo();<'+'/script >bar').stripScripts(),
+ 'should properly handle whitespace in closing tag');
},
testExtractScripts: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.