From: Dave Methvin Date: Fri, 21 Jan 2011 14:51:30 +0000 (-0500) Subject: Don't do body-related feature tests on frameset docs that have no body. Fixes #7398. X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;ds=sidebyside;h=ad0ebf00abca53caaaa46fb172024ba9b23b03a1;hp=328a86f9a0d3f0907cc950f7543e34cb3efbda3f;p=jquery.git Don't do body-related feature tests on frameset docs that have no body. Fixes #7398. --- diff --git a/src/support.js b/src/support.js index 7be28fd..4807ce2 100644 --- a/src/support.js +++ b/src/support.js @@ -136,10 +136,16 @@ // Figure out if the W3C box model works as expected // document.body must exist before we can do this jQuery(function() { - var div = document.createElement("div"); - div.style.width = div.style.paddingLeft = "1px"; + var div = document.createElement("div"), + body = document.getElementsByTagName("body")[0]; + + // Frameset documents with no body should not run this code + if ( !body ) { + return; + } - document.body.appendChild( div ); + div.style.width = div.style.paddingLeft = "1px"; + body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; if ( "zoom" in div.style ) { @@ -178,7 +184,7 @@ jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; div.innerHTML = ""; - document.body.removeChild( div ).style.display = "none"; + body.removeChild( div ).style.display = "none"; div = tds = null; });