5 var root = document.documentElement,
6 script = document.createElement("script"),
7 div = document.createElement("div"),
10 div.style.display = "none";
11 div.innerHTML = ' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.55;">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.55",
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 // Technique from Juriy Zaytsev
95 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
96 var eventSupported = function( eventName ) {
97 var el = document.createElement("div");
98 eventName = "on" + eventName;
100 var isSupported = (eventName in el);
101 if ( !isSupported ) {
102 el.setAttribute(eventName, "return;");
103 isSupported = typeof el[eventName] === "function";
110 jQuery.support.submitBubbles = eventSupported("submit");
111 jQuery.support.changeBubbles = eventSupported("change");
113 // release memory in IE
114 root = script = div = all = a = null;
119 "class": "className",
120 readonly: "readOnly",
121 maxlength: "maxLength",
122 cellspacing: "cellSpacing",
125 tabindex: "tabIndex",
127 frameborder: "frameBorder"