]> 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 01:54:53 +0000 (04:54 +0300)
Fixes gh-1887
Closes gh-1888

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 b9d59fc4d88a02d2488344a709ae7eaaea06876c..ca3b8b5482b0bb5b692384389fc0f6185ebeee58 100644 (file)
@@ -2434,3 +2434,12 @@ test( "Validate creation of multiple quantities of certain elements (#13818)", 4
                });
        });
 });
+
+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 );
+});