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><input type='checkbox'/>";
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 // Make sure that if no value is specified for a checkbox
51 // that it defaults to "on".
52 // (WebKit defaults to "" instead)
53 checkOn: div.getElementsByTagName("input")[0].value === "on",
55 // Make sure that a selected-by-default option has a working selected property.
56 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
57 optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected,
59 parentNode: div.removeChild( div.appendChild( document.createElement("div") ) ).parentNode === null,
61 // Will be defined later
69 script.type = "text/javascript";
71 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
72 } catch( scriptError ) {}
74 root.insertBefore( script, root.firstChild );
76 // Make sure that the execution of code works by injecting a script
77 // tag with appendChild/createTextNode
78 // (IE doesn't support this, fails, and uses .text instead)
80 jQuery.support.scriptEval = true;
84 // Test to see if it's possible to delete an expando from an element
85 // Fails in Internet Explorer
89 } catch( expandoError ) {
90 jQuery.support.deleteExpando = false;
93 root.removeChild( script );
95 if ( div.attachEvent && div.fireEvent ) {
96 div.attachEvent("onclick", function click() {
97 // Cloning a node shouldn't copy over any
98 // bound event handlers (IE does this)
99 jQuery.support.noCloneEvent = false;
100 div.detachEvent("onclick", click);
102 div.cloneNode(true).fireEvent("onclick");
105 div = document.createElement("div");
106 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>";
108 var fragment = document.createDocumentFragment();
109 fragment.appendChild( div.firstChild );
111 // WebKit doesn't clone checked state correctly in fragments
112 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked;
114 // Figure out if the W3C box model works as expected
115 // document.body must exist before we can do this
117 var div = document.createElement("div");
118 div.style.width = div.style.paddingLeft = "1px";
120 document.body.appendChild( div );
121 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
122 document.body.removeChild( div ).style.display = 'none';
127 // Technique from Juriy Zaytsev
128 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
129 var eventSupported = function( eventName ) {
130 var el = document.createElement("div");
131 eventName = "on" + eventName;
133 var isSupported = (eventName in el);
134 if ( !isSupported ) {
135 el.setAttribute(eventName, "return;");
136 isSupported = typeof el[eventName] === "function";
143 jQuery.support.submitBubbles = eventSupported("submit");
144 jQuery.support.changeBubbles = eventSupported("change");
146 // release memory in IE
147 root = script = div = all = a = null;
152 "class": "className",
153 readonly: "readOnly",
154 maxlength: "maxLength",
155 cellspacing: "cellSpacing",
158 tabindex: "tabIndex",
160 frameborder: "frameBorder"