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