aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-01-11 16:17:20 +0000
committerJohn Resig <jeresig@gmail.com>2009-01-11 16:17:20 +0000
commit7346a476cc1fe20612fb1e9b08faef27e36a962c (patch)
treeceabbbeb63268b8239dff70eb7cbdba733e8c68b
parent0066ba3f823fdf3e41aa805f54876312c8bd915a (diff)
downloadjquery-7346a476cc1fe20612fb1e9b08faef27e36a962c.tar.gz
jquery-7346a476cc1fe20612fb1e9b08faef27e36a962c.zip
Fixed boxModel support - is now computed with feature detection, rather than sniffing.
-rw-r--r--Makefile2
-rw-r--r--src/core.js3
-rw-r--r--src/support.js14
3 files changed, 14 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 351342efb..33efcea7e 100644
--- 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\
diff --git a/src/core.js b/src/core.js
index 24438e36b..78f2bcd14 100644
--- a/src/core.js
+++ b/src/core.js
@@ -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");},
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";