Skip to content

Commit e62e72a

Browse files
committed
Extract only javascript scripts, ignoring JSON
1 parent 187a16b commit e62e72a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/Browser/Browser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ Browser.exec = function(text){
150150

151151
String.implement('stripScripts', function(exec){
152152
var scripts = '';
153-
var text = this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
154-
scripts += code + '\n';
153+
var text = this.replace(/<script([^>]*)>([\s\S]*?)<\/script>/gi, function(all, type, code){
154+
if (type == '' || type.indexOf('javascript') != -1){
155+
scripts += code + '\n';
156+
}
155157
return '';
156158
});
157159
if (exec === true) Browser.exec(scripts);

0 commit comments

Comments
 (0)