]> source.dussan.org Git - jquery.git/commitdiff
Don't do body-related feature tests on frameset docs that have no body. Fixes #7398. 199/head
authorDave Methvin <dave.methvin@gmail.com>
Fri, 21 Jan 2011 14:51:30 +0000 (09:51 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 21 Jan 2011 14:51:30 +0000 (09:51 -0500)
src/support.js

index 7be28fdaf43d9f124788a36c7fc1bbd2b8474cc9..4807ce27eb23c3ca3aca36a9c5612a6f3fbb6c44 100644 (file)
        // 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 ) {
                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;
        });