diff options
author | Mathias Bynens <mathias@qiwi.be> | 2011-09-20 11:23:01 -0400 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2011-09-20 11:23:01 -0400 |
commit | 26898f0bc593f1a2b7d5f2cc4e86f173bf9cf17c (patch) | |
tree | 0b7615b2f271f0499edac6e31a82ae51ed0515c2 /src/support.js | |
parent | b03648c2a3d94a8516d3e15905d1b13bbaed4a2f (diff) | |
download | jquery-26898f0bc593f1a2b7d5f2cc4e86f173bf9cf17c.tar.gz jquery-26898f0bc593f1a2b7d5f2cc4e86f173bf9cf17c.zip |
Landing pull request 509. Add a comment explaining the use of document.getElementsByTagName('body')[0] instead of document.body.
More Details:
- https://github.com/jquery/jquery/pull/509
Diffstat (limited to 'src/support.js')
-rw-r--r-- | src/support.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/support.js b/src/support.js index 284465974..6a77e449c 100644 --- a/src/support.js +++ b/src/support.js @@ -122,7 +122,7 @@ jQuery.support = (function() { div.cloneNode( true ).fireEvent( "onclick" ); } - // Check if a radio maintains it's value + // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; @@ -142,7 +142,11 @@ jQuery.support = (function() { // Figure out if the W3C box model works as expected div.style.width = div.style.paddingLeft = "1px"; - body = document.getElementsByTagName( "body" )[ 0 ]; + // We don't want to do body-related feature tests on frameset + // documents, which lack a body. So we use + // document.getElementsByTagName("body")[0], which is undefined in + // frameset documents, while document.body isn’t. (7398) + body = document.getElementsByTagName("body")[ 0 ]; // We use our own, invisible, body unless the body is already present // in which case we use a div (#9239) testElement = document.createElement( body ? "div" : "body" ); @@ -157,8 +161,8 @@ jQuery.support = (function() { if ( body ) { jQuery.extend( testElementStyle, { position: "absolute", - left: "-1000px", - top: "-1000px" + left: "-999px", + top: "-999px" }); } for ( i in testElementStyle ) { |