diff --git a/Source/Browser/Browser.js b/Source/Browser/Browser.js index eafb9dd6e..bee132e66 100644 --- a/Source/Browser/Browser.js +++ b/Source/Browser/Browser.js @@ -150,8 +150,10 @@ Browser.exec = function(text){ String.implement('stripScripts', function(exec){ var scripts = ''; - var text = this.replace(/]*>([\s\S]*?)<\/script>/gi, function(all, code){ - scripts += code + '\n'; + var text = this.replace(/]*)>([\s\S]*?)<\/script>/gi, function(all, type, code){ + if (type == '' || type.indexOf('javascript') != -1){ + scripts += code + '\n'; + } return ''; }); if (exec === true) Browser.exec(scripts); diff --git a/Specs/Browser/Browser.js b/Specs/Browser/Browser.js index 4b7beffd4..db4050ac9 100644 --- a/Specs/Browser/Browser.js +++ b/Specs/Browser/Browser.js @@ -49,6 +49,11 @@ describe('String.stripScripts', function(){ expect(window.stripScriptsSpec).to.equal(4242); }); + it('should not execute json scripts', function(){ + expect('
'.stripScripts()).to.equal('
'); + expect(window.stripScriptsSpec424242).to.equal(undefined); + }); + }); describe('Document', function(){ diff --git a/package.json b/package.json index cb0ae16d9..492ae6a95 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "grunt-karma": "^2.0.0", "grunt-mocha-test": "^0.12.7", "grunt-mootools-packager": "^0.4.0", - "karma": "^1.7.0", + "karma": "^1.7.1", "karma-expect": "^1.1", "karma-mocha": "^0.2.0", "karma-phantomjs-launcher": "^1.0.4",