diff options
author | John Resig <jeresig@gmail.com> | 2009-01-11 16:17:20 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2009-01-11 16:17:20 +0000 |
commit | 7346a476cc1fe20612fb1e9b08faef27e36a962c (patch) | |
tree | ceabbbeb63268b8239dff70eb7cbdba733e8c68b /src/support.js | |
parent | 0066ba3f823fdf3e41aa805f54876312c8bd915a (diff) | |
download | jquery-7346a476cc1fe20612fb1e9b08faef27e36a962c.tar.gz jquery-7346a476cc1fe20612fb1e9b08faef27e36a962c.zip |
Fixed boxModel support - is now computed with feature detection, rather than sniffing.
Diffstat (limited to 'src/support.js')
-rw-r--r-- | src/support.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/support.js b/src/support.js index bacc5bd4e..b89a9d73f 100644 --- a/src/support.js +++ b/src/support.js @@ -53,7 +53,8 @@ // Will be defined later scriptEval: false, - noCloneEvent: true + noCloneEvent: true, + boxModel: null }; script.type = "text/javascript"; @@ -83,6 +84,17 @@ div.cloneNode(true).fireEvent("onclick"); } + // 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 = "1px"; + div.style.paddingLeft = "1px"; + + document.body.appendChild( div ); + jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; + document.body.removeChild( div ); + }); })(); var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat"; |