diff options
author | jeresig <jeresig@gmail.com> | 2011-01-21 11:22:55 -0500 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2011-01-21 11:22:55 -0500 |
commit | 1922f311a321620f9df609503f49f41a53671ea4 (patch) | |
tree | f7642aacd455438939ead72d85fa1f0d8efae033 /src | |
parent | 61e80c55df9231c177d194ff075472898933c2c9 (diff) | |
parent | ad0ebf00abca53caaaa46fb172024ba9b23b03a1 (diff) | |
download | jquery-1922f311a321620f9df609503f49f41a53671ea4.tar.gz jquery-1922f311a321620f9df609503f49f41a53671ea4.zip |
Merge branch 'fix-7398-frameset-docs' of https://github.com/dmethvin/jquery into dmethvin-fix-7398-frameset-docs
Diffstat (limited to 'src')
-rw-r--r-- | src/support.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/support.js b/src/support.js index 7be28fdaf..4807ce27e 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; }); |