Skip to content
Permalink
Browse files

Fixed a bug with the isXMLDoc test - also made sure that isXMLDoc was…

… handling the case where documentElement is undefined (which only occurs on HTML documents in IE).
  • Loading branch information
jeresig committed Aug 27, 2009
1 parent 957cd6f commit 569c8b45c0d301663f3f6c88b606d199fc78ec1a
Showing with 3 additions and 2 deletions.
  1. +2 −1 src/core.js
  2. +1 −1 test/unit/core.js
@@ -316,7 +316,8 @@ 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 ? elem.ownerDocument || elem : 0).documentElement || 0).nodeName !== "HTML";
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
},

// Evalulates a script in a global context
@@ -281,7 +281,7 @@ test("isXMLDoc - HTML", function() {

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

0 comments on commit 569c8b4

Please sign in to comment.
You can’t perform that action at this time.