aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/support.js')
-rw-r--r--src/support.js36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/support.js b/src/support.js
index 7470b33e8..89d2bfea2 100644
--- a/src/support.js
+++ b/src/support.js
@@ -7,8 +7,9 @@
var div = document.createElement("div");
div.style.display = "none";
- div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
+ div.setAttribute("className", "t");
+ div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
var all = div.getElementsByTagName("*"),
a = div.getElementsByTagName("a")[0],
select = document.createElement("select"),
@@ -33,8 +34,8 @@
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
- // (IE uses .cssText insted)
- style: /red/.test( a.getAttribute("style") ),
+ // (IE uses .cssText instead, and capitalizes all property names)
+ style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
@@ -57,6 +58,9 @@
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
+
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
// Will be defined later
deleteExpando: true,
@@ -67,7 +71,8 @@
boxModel: null,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
- reliableHiddenOffsets: true
+ reliableHiddenOffsets: true,
+ reliableMarginRight: true
};
input.checked = true;
@@ -85,15 +90,15 @@
script = document.createElement("script"),
id = "script" + jQuery.now();
+ // Make sure that the execution of code works by injecting a script
+ // tag with appendChild/createTextNode
+ // (IE doesn't support this, fails, and uses .text instead)
try {
script.appendChild( document.createTextNode( "window." + id + "=1;" ) );
} catch(e) {}
root.insertBefore( script, root.firstChild );
- // Make sure that the execution of code works by injecting a script
- // tag with appendChild/createTextNode
- // (IE doesn't support this, fails, and uses .text instead)
if ( window[ id ] ) {
_scriptEval = true;
delete window[ id ];
@@ -102,8 +107,6 @@
}
root.removeChild( script );
- // release memory in IE
- root = script = id = null;
}
return _scriptEval;
@@ -188,6 +191,17 @@
jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0;
div.innerHTML = "";
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. For more
+ // info see bug #3333
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ if ( document.defaultView && document.defaultView.getComputedStyle ) {
+ div.style.width = "1px";
+ div.style.marginRight = "0";
+ jQuery.support.reliableMarginRight = ( parseInt(document.defaultView.getComputedStyle(div, null).marginRight, 10) || 0 ) === 0;
+ }
+
body.removeChild( div ).style.display = "none";
div = tds = null;
});
@@ -211,8 +225,6 @@
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
- el = null;
-
return isSupported;
};