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 // Use a regex to work around a WebKit issue. See #5145
44 opacity: /^0.55$/.test( a.style.opacity ),
46 // Verify style float existence
47 // (IE uses styleFloat instead of cssFloat)
48 cssFloat: !!a.style.cssFloat,
50 // Will be defined later
56 script.type = "text/javascript";
58 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
61 root.insertBefore( script, root.firstChild );
63 // Make sure that the execution of code works by injecting a script
64 // tag with appendChild/createTextNode
65 // (IE doesn't support this, fails, and uses .text instead)
67 jQuery.support.scriptEval = true;
71 root.removeChild( script );
73 if ( div.attachEvent && div.fireEvent ) {
74 div.attachEvent("onclick", function click(){
75 // Cloning a node shouldn't copy over any
76 // bound event handlers (IE does this)
77 jQuery.support.noCloneEvent = false;
78 div.detachEvent("onclick", click);
80 div.cloneNode(true).fireEvent("onclick");
83 // Figure out if the W3C box model works as expected
84 // document.body must exist before we can do this
85 // TODO: This timeout is temporary until I move ready into core.js.
87 var div = document.createElement("div");
88 div.style.width = div.style.paddingLeft = "1px";
90 document.body.appendChild( div );
91 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
92 document.body.removeChild( div ).style.display = 'none';
96 // Technique from Juriy Zaytsev
97 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
98 var eventSupported = function( eventName ) {
99 var el = document.createElement("div");
100 eventName = "on" + eventName;
102 var isSupported = (eventName in el);
103 if ( !isSupported ) {
104 el.setAttribute(eventName, "return;");
105 isSupported = typeof el[eventName] === "function";
112 jQuery.support.submitBubbles = eventSupported("submit");
113 jQuery.support.changeBubbles = eventSupported("change");
114 jQuery.support.focusBubbles = eventSupported("focus");
116 // release memory in IE
117 root = script = div = all = a = null;
122 "class": "className",
123 readonly: "readOnly",
124 maxlength: "maxLength",
125 cellspacing: "cellSpacing",
128 tabindex: "tabIndex",
130 frameborder: "frameBorder"