Selector: Fix test iframe submission for firefox

Ref jquery/sizzle@20fbadb087
This commit is contained in:
Oleg Gaidarenko 2014-05-29 21:45:59 +04:00
parent 1d931068d3
commit efc4f8d781

View File

@ -475,10 +475,10 @@ testIframe("selector/sizzle_cache", "Sizzle cache collides with multiple Sizzles
equal( jQuery(".evil a").length, 0, "Select nothing again with second sizzle" ); equal( jQuery(".evil a").length, 0, "Select nothing again with second sizzle" );
}); });
asyncTest( "Iframe dispatch should not affect Sizzle, see #13936", 1, function() { asyncTest( "Iframe dispatch should not affect jQuery (#13936)", 1, function() {
var loaded = false, var loaded = false,
thrown = false, thrown = false,
iframe = document.getElementById("iframe"), iframe = document.getElementById( "iframe" ),
iframeDoc = iframe.contentDocument || iframe.contentWindow.document; iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
jQuery( iframe ).on( "load", function() { jQuery( iframe ).on( "load", function() {
@ -486,17 +486,13 @@ asyncTest( "Iframe dispatch should not affect Sizzle, see #13936", 1, function()
try { try {
iframeDoc = this.contentDocument || this.contentWindow.document; iframeDoc = this.contentDocument || this.contentWindow.document;
form = jQuery( "#navigate", iframeDoc )[ 0 ]; form = Sizzle( "#navigate", iframeDoc )[ 0 ];
} catch ( e ) { } catch ( e ) {
thrown = e; thrown = e;
} }
if ( loaded ) { if ( loaded ) {
strictEqual( thrown, false, "No error thrown from post-reload jQuery call" ); strictEqual( thrown, false, "No error thrown from post-reload Sizzle call" );
// clean up
jQuery( iframe ).off();
start(); start();
} else { } else {
loaded = true; loaded = true;
@ -505,6 +501,6 @@ asyncTest( "Iframe dispatch should not affect Sizzle, see #13936", 1, function()
}); });
iframeDoc.open(); iframeDoc.open();
iframeDoc.write("<body><form id='navigate'></form></body>"); iframeDoc.write( "<body><form id='navigate' action='?'></form></body>" );
iframeDoc.close(); iframeDoc.close();
}); });