Commit 7346a476 authored by John Resig's avatar John Resig

Fixed boxModel support - is now computed with feature detection, rather than sniffing.

parent 0066ba3f
...@@ -10,9 +10,9 @@ PLUG_DIR = ../plugins ...@@ -10,9 +10,9 @@ PLUG_DIR = ../plugins
BASE_FILES = ${SRC_DIR}/core.js\ BASE_FILES = ${SRC_DIR}/core.js\
${SRC_DIR}/data.js\ ${SRC_DIR}/data.js\
${SRC_DIR}/support.js\
${SRC_DIR}/selector.js\ ${SRC_DIR}/selector.js\
${SRC_DIR}/event.js\ ${SRC_DIR}/event.js\
${SRC_DIR}/support.js\
${SRC_DIR}/ajax.js\ ${SRC_DIR}/ajax.js\
${SRC_DIR}/fx.js\ ${SRC_DIR}/fx.js\
${SRC_DIR}/offset.js\ ${SRC_DIR}/offset.js\
......
...@@ -1146,9 +1146,6 @@ jQuery.browser = { ...@@ -1146,9 +1146,6 @@ jQuery.browser = {
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) 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({ jQuery.each({
parent: function(elem){return elem.parentNode;}, parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");}, parents: function(elem){return jQuery.dir(elem,"parentNode");},
......
...@@ -53,7 +53,8 @@ ...@@ -53,7 +53,8 @@
// Will be defined later // Will be defined later
scriptEval: false, scriptEval: false,
noCloneEvent: true noCloneEvent: true,
boxModel: null
}; };
script.type = "text/javascript"; script.type = "text/javascript";
...@@ -83,6 +84,17 @@ ...@@ -83,6 +84,17 @@
div.cloneNode(true).fireEvent("onclick"); 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"; var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment