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 // Will be defined later
65 script.type = "text/javascript";
67 script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
70 root.insertBefore( script, root.firstChild );
72 // Make sure that the execution of code works by injecting a script
73 // tag with appendChild/createTextNode
74 // (IE doesn't support this, fails, and uses .text instead)
76 jQuery.support.scriptEval = true;
80 root.removeChild( script );
82 if ( div.attachEvent && div.fireEvent ) {
83 div.attachEvent("onclick", function click() {
84 // Cloning a node shouldn't copy over any
85 // bound event handlers (IE does this)
86 jQuery.support.noCloneEvent = false;
87 div.detachEvent("onclick", click);
89 div.cloneNode(true).fireEvent("onclick");
92 // Figure out if the W3C box model works as expected
93 // document.body must exist before we can do this
94 // TODO: This timeout is temporary until I move ready into core.js.
96 var div = document.createElement("div");
97 div.style.width = div.style.paddingLeft = "1px";
99 document.body.appendChild( div );
100 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
101 document.body.removeChild( div ).style.display = 'none';
105 // Technique from Juriy Zaytsev
106 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
107 var eventSupported = function( eventName ) {
108 var el = document.createElement("div");
109 eventName = "on" + eventName;
111 var isSupported = (eventName in el);
112 if ( !isSupported ) {
113 el.setAttribute(eventName, "return;");
114 isSupported = typeof el[eventName] === "function";
121 jQuery.support.submitBubbles = eventSupported("submit");
122 jQuery.support.changeBubbles = eventSupported("change");
124 // release memory in IE
125 root = script = div = all = a = null;
130 "class": "className",
131 readonly: "readOnly",
132 maxlength: "maxLength",
133 cellspacing: "cellSpacing",
136 tabindex: "tabIndex",
138 frameborder: "frameBorder"