]> source.dussan.org Git - jquery.git/commitdiff
Manipulation: support data-URI scripts insertion
authorBin Xin <rhyzix@gmail.com>
Fri, 28 Nov 2014 06:09:29 +0000 (14:09 +0800)
committerOleg Gaidarenko <markelog@gmail.com>
Wed, 3 Dec 2014 02:35:20 +0000 (05:35 +0300)
Ref 15f4dec7894f1e00adbfb9bce4f870441a527bd6

src/manipulation/_evalUrl.js
test/unit/manipulation.js

index 6704749ae353677f0b4a181ffe605b267a8e8efb..0fdacbceef849f91a39d40f6781c7e10f52fbaeb 100644 (file)
@@ -7,6 +7,7 @@ jQuery._evalUrl = function( url ) {
                url: url,
                type: "GET",
                dataType: "script",
+               cache: true,
                async: false,
                global: false,
                "throws": true
index e2bfd75b1a6d66dff7dd6b380bbd61716df24936..f4918b59a01df13626b4e41dfa8ee34cdff41ed7 100644 (file)
@@ -2461,3 +2461,12 @@ test( "Make sure jQuery.fn.remove can work on elements in documentFragment", 1,
 
        equal( fragment.childNodes.length, 0, "div element was removed from documentFragment" );
 });
+
+asyncTest( "Insert script with data-URI (gh-1887)", 1, function() {
+       Globals.register( "testFoo" );
+       jQuery( "#qunit-fixture" ).append( "<script src=\"data:text/javascript,testFoo = 'foo';\"></script>" );
+       setTimeout(function (){
+               strictEqual( window[ "testFoo" ], "foo", "data-URI script executed" );
+               start();
+       }, 100 );
+});