Skip to content

Commit

Permalink
Manipulation: don't test data-URI with script element in IE8
Browse files Browse the repository at this point in the history
Since, apparently, it doesn't support it. Couldn't find more relevant info
then this - http://msdn.microsoft.com/en-us/library/cc848897(v=vs.85).aspx

No guard for older IE, since support for them will be removed soon anyway
  • Loading branch information
markelog committed Dec 3, 2014
1 parent bc1902d commit 503e545
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions test/unit/manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2462,11 +2462,15 @@ 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 );
});
// IE8 doesn't support data-URI in src attribute of script element
// Relevant - http://msdn.microsoft.com/en-us/library/cc848897(v=vs.85).aspx
if ( !/msie 8\.0/i.test( navigator.userAgent ) ) {
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 );
});
}

3 comments on commit 503e545

@mgol
Copy link
Member

@mgol mgol commented on 503e545 Dec 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test also fails in Android 2.3 although it supports data-URIs; not sure if it just doesn't support them in scripts.

@mgol
Copy link
Member

@mgol mgol commented on 503e545 Dec 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it fails in most Android Browsers:
http://swarm.jquery.org/job/3915
http://swarm.jquery.org/job/3914

It's weird that it fails in Android 4.2 only in one branch.

@markelog
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the same thing as with IE8 since data-uri in test is valid, so like you said:

doesn't support them in scripts.

Need to add a additional guard for them

Please sign in to comment.