Commit 569c8b45 authored by John Resig's avatar John Resig

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

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).
parent 957cd6fb
...@@ -316,7 +316,8 @@ jQuery.extend({ ...@@ -316,7 +316,8 @@ 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 ? 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 // Evalulates a script in a global context
......
...@@ -281,7 +281,7 @@ test("isXMLDoc - HTML", function() { ...@@ -281,7 +281,7 @@ test("isXMLDoc - HTML", function() {
try { try {
var body = jQuery(iframe).contents()[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 exception" ); ok( false, "Iframe body element exception" );
} }
......
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