]> source.dussan.org Git - jquery.git/commitdiff
Fixed boxModel support - is now computed with feature detection, rather than sniffing.
authorJohn Resig <jeresig@gmail.com>
Sun, 11 Jan 2009 16:17:20 +0000 (16:17 +0000)
committerJohn Resig <jeresig@gmail.com>
Sun, 11 Jan 2009 16:17:20 +0000 (16:17 +0000)
Makefile
src/core.js
src/support.js

index 351342efb93615ba5596c7b25cea273c1eccfc99..33efcea7e761bd0fc8a846a28a254a6e45c3c25e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,9 +10,9 @@ PLUG_DIR = ../plugins
 
 BASE_FILES = ${SRC_DIR}/core.js\
        ${SRC_DIR}/data.js\
-       ${SRC_DIR}/support.js\
        ${SRC_DIR}/selector.js\
        ${SRC_DIR}/event.js\
+       ${SRC_DIR}/support.js\
        ${SRC_DIR}/ajax.js\
        ${SRC_DIR}/fx.js\
        ${SRC_DIR}/offset.js\
index 24438e36b03dd740132f2b65bbfb9e470cefa11a..78f2bcd140fbafc161d8a421e0af79773c5d05b1 100644 (file)
@@ -1146,9 +1146,6 @@ jQuery.browser = {
        mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
 };
 
-// Check to see if the W3C box model is being used
-jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
-
 jQuery.each({
        parent: function(elem){return elem.parentNode;},
        parents: function(elem){return jQuery.dir(elem,"parentNode");},
index bacc5bd4ec7d2b91284169a79c8b3ed8b65d0a51..b89a9d73fb5d651f7e4d3f09f30e3017646c9296 100644 (file)
@@ -53,7 +53,8 @@
 
                // Will be defined later
                scriptEval: false,
-               noCloneEvent: true
+               noCloneEvent: true,
+               boxModel: null
        };
        
        script.type = "text/javascript";
                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";