5 var root = document.documentElement,
6 script = document.createElement("script"),
7 div = document.createElement("div"),
8 id = "script" + (new Date).getTime();
10 div.style.display = "none";
11 div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select>';
13 var all = div.getElementsByTagName("*"),
14 a = div.getElementsByTagName("a")[0];
16 // Can't get basic test support
17 if ( !all || !all.length || !a ) {
22 // IE strips leading whitespace when .innerHTML is used
23 leadingWhitespace: div.firstChild.nodeType == 3,
25 // Make sure that tbody elements aren't automatically inserted
26 // IE will insert them into empty tables
27 tbody: !div.getElementsByTagName("tbody").length,
29 // Make sure that link elements get serialized correctly by innerHTML
30 // This requires a wrapper element in IE
31 htmlSerialize: !!div.getElementsByTagName("link").length,
33 // Get the style information from getAttribute
34 // (IE uses .cssText insted)
35 style: /red/.test( a.getAttribute("style") ),
37 // Make sure that URLs aren't manipulated
38 // (IE normalizes it by default)
39 hrefNormalized: a.getAttribute("href") === "/a",
41 // Make sure that element opacity exists
42 // (IE uses filter instead)
43 opacity: a.style.opacity === "0.5",
45 // Verify style float existence
46 // (IE uses styleFloat instead of cssFloat)
47 cssFloat: !!a.style.cssFloat,
49 // Will be defined later
55 script.type = "text/javascript";
57 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
60 root.insertBefore( script, root.firstChild );
62 // Make sure that the execution of code works by injecting a script
63 // tag with appendChild/createTextNode
64 // (IE doesn't support this, fails, and uses .text instead)
66 jQuery.support.scriptEval = true;
70 root.removeChild( script );
72 if ( div.attachEvent && div.fireEvent ) {
73 div.attachEvent("onclick", function click(){
74 // Cloning a node shouldn't copy over any
75 // bound event handlers (IE does this)
76 jQuery.support.noCloneEvent = false;
77 div.detachEvent("onclick", click);
79 div.cloneNode(true).fireEvent("onclick");
82 // Figure out if the W3C box model works as expected
83 // document.body must exist before we can do this
85 var div = document.createElement("div");
86 div.style.width = div.style.paddingLeft = "1px";
88 document.body.appendChild( div );
89 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
90 document.body.removeChild( div ).style.display = 'none';
94 var styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
100 cssFloat: styleFloat,
101 styleFloat: styleFloat,
102 readonly: "readOnly",
103 maxlength: "maxLength",
104 cellspacing: "cellSpacing",