No longer use arguments.callee or RegExp (use new RegExp, instead) for ES 3.1 and...
[jquery.git] / src / support.js
index c334e78..4298250 100644 (file)
@@ -8,7 +8,7 @@
                id = "script" + (new Date).getTime();
 
        div.style.display = "none";
-       div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param></object>';
+       div.innerHTML = '   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';
 
        var all = div.getElementsByTagName("*"),
                a = div.getElementsByTagName("a")[0];
                // (IE uses styleFloat instead of cssFloat)
                cssFloat: !!a.style.cssFloat,
 
-               // Verify tabindex attribute existence
-               // (IE uses tabIndex instead of tabindex)
-               tabindex: !a.getAttributeNode('tabindex'),
-
                // Will be defined later
                scriptEval: false,
-               noCloneEvent: true
+               noCloneEvent: true,
+               boxModel: null
        };
        
        script.type = "text/javascript";
        root.removeChild( script );
 
        if ( div.attachEvent && div.fireEvent ) {
-               div.attachEvent("onclick", function(){
+               div.attachEvent("onclick", function click(){
                        // Cloning a node shouldn't copy over any
                        // bound event handlers (IE does this)
                        jQuery.support.noCloneEvent = false;
-                       div.detachEvent("onclick", arguments.callee);
+                       div.detachEvent("onclick", click);
                });
                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 = div.style.paddingLeft = "1px";
+
+               document.body.appendChild( div );
+               jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
+               document.body.removeChild( div ).style.display = 'none';
+       });
 })();
 
 var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
@@ -101,5 +108,5 @@ jQuery.props = {
        maxlength: "maxLength",
        cellspacing: "cellSpacing",
        rowspan: "rowSpan",
-       tabindex: jQuery.support.tabindex ? "tabindex" : "tabIndex"
+       tabindex: "tabIndex"
 };