Skip to content
Permalink
Browse files
Tweaked the isXMLDoc iframe test case to test the document, not the b…
…ody element (which doesn't exist in IE). Also made the isXMLDoc code handle cases where elem is null, undefined, etc.
  • Loading branch information
jeresig committed Aug 27, 2009
1 parent f52c4a3 commit 957cd6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
@@ -316,7 +316,7 @@ jQuery.extend({
isXMLDoc: function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (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
@@ -280,10 +280,10 @@ test("isXMLDoc - HTML", function() {
document.body.appendChild( iframe );

try {
var body = jQuery(iframe).contents().find("body")[0];
ok( !jQuery.isXMLDoc( body ), "Iframe body element" );
var body = jQuery(iframe).contents()[0];
ok( jQuery.isXMLDoc( body ), "Iframe body element" );
} catch(e){
ok( false, "Iframe body element" );
ok( false, "Iframe body element exception" );
}

document.body.removeChild( iframe );

0 comments on commit 957cd6f

Please sign in to comment.