Permalink
Browse files

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

…ng SCRIPT tag. [#1297 state:resolved] (piopier, Victor)
  • Loading branch information...
1 parent 43adb8b commit 6c7ffe29cd3604be4081a9510cb2015fcc377ae4 @savetheclocktower savetheclocktower committed Mar 4, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −1 src/prototype/prototype.js
  2. +3 −0 test/unit/string_test.js
@@ -139,7 +139,7 @@ var Prototype = {
})()
},
- ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script\\s*>',
JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
/**
@@ -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() {

0 comments on commit 6c7ffe2

Please sign in to comment.