Commit 957cd6fb authored by John Resig's avatar John Resig

Tweaked the isXMLDoc iframe test case to test the document, not the body...

Tweaked the isXMLDoc iframe test case to test the document, not the body element (which doesn't exist in IE). Also made the isXMLDoc code handle cases where elem is null, undefined, etc.
parent f52c4a3d
...@@ -316,7 +316,7 @@ jQuery.extend({ ...@@ -316,7 +316,7 @@ jQuery.extend({
isXMLDoc: function( elem ) { isXMLDoc: function( elem ) {
// documentElement is verified for cases where it doesn't yet exist // documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833) // (such as loading iframes in IE - #4833)
return ((elem.ownerDocument || elem).documentElement || 0).nodeName !== "HTML"; return ((elem ? elem.ownerDocument || elem : 0).documentElement || 0).nodeName !== "HTML";
}, },
// Evalulates a script in a global context // Evalulates a script in a global context
......
...@@ -280,10 +280,10 @@ test("isXMLDoc - HTML", function() { ...@@ -280,10 +280,10 @@ test("isXMLDoc - HTML", function() {
document.body.appendChild( iframe ); document.body.appendChild( iframe );
try { try {
var body = jQuery(iframe).contents().find("body")[0]; var body = jQuery(iframe).contents()[0];
ok( !jQuery.isXMLDoc( body ), "Iframe body element" ); ok( jQuery.isXMLDoc( body ), "Iframe body element" );
} catch(e){ } catch(e){
ok( false, "Iframe body element" ); ok( false, "Iframe body element exception" );
} }
document.body.removeChild( iframe ); document.body.removeChild( iframe );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment