Commit 328ba956 authored by Richard Gibson's avatar Richard Gibson

No ticket: reduce support.js

parent 44340c88
jQuery.support = (function() { jQuery.support = (function( support ) {
var support, all, a, var all, a, input, select, fragment, opt, eventName, isSupported, i,
input, select, fragment,
opt, eventName, isSupported, i,
div = document.createElement("div"); div = document.createElement("div");
// Setup // Setup
div.setAttribute( "className", "t" ); div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments // Finish early in limited (non-browser) environments
all = div.getElementsByTagName("*"); all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ]; a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) { if ( !all || !a || !all.length ) {
return {}; return support;
} }
// First batch of tests // First batch of tests
...@@ -22,64 +20,63 @@ jQuery.support = (function() { ...@@ -22,64 +20,63 @@ jQuery.support = (function() {
input = div.getElementsByTagName("input")[ 0 ]; input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5"; a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// IE strips leading whitespace when .innerHTML is used // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
leadingWhitespace: div.firstChild.nodeType === 3, support.getSetAttribute = div.className !== "t";
// Make sure that tbody elements aren't automatically inserted // IE strips leading whitespace when .innerHTML is used
// IE will insert them into empty tables support.leadingWhitespace = div.firstChild.nodeType === 3;
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML // Make sure that tbody elements aren't automatically inserted
// This requires a wrapper element in IE // IE will insert them into empty tables
htmlSerialize: !!div.getElementsByTagName("link").length, support.tbody = !div.getElementsByTagName("tbody").length;
// Get the style information from getAttribute // Make sure that link elements get serialized correctly by innerHTML
// (IE uses .cssText instead) // This requires a wrapper element in IE
style: /top/.test( a.getAttribute("style") ), support.htmlSerialize = !!div.getElementsByTagName("link").length;
// Make sure that URLs aren't manipulated // Get the style information from getAttribute
// (IE normalizes it by default) // (IE uses .cssText instead)
hrefNormalized: a.getAttribute("href") === "/a", support.style = /top/.test( a.getAttribute("style") );
// Make sure that element opacity exists // Make sure that URLs aren't manipulated
// (IE uses filter instead) // (IE normalizes it by default)
// Use a regex to work around a WebKit issue. See #5145 support.hrefNormalized = a.getAttribute("href") === "/a";
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence // Make sure that element opacity exists
// (IE uses styleFloat instead of cssFloat) // (IE uses filter instead)
cssFloat: !!a.style.cssFloat, // Use a regex to work around a WebKit issue. See #5145
support.opacity = /^0.5/.test( a.style.opacity );
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) // Verify style float existence
checkOn: !!input.value, // (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!a.style.cssFloat;
// Make sure that a selected-by-default option has a working selected property. // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup) support.checkOn = !!input.value;
optSelected: opt.selected,
// Tests for enctype support on a form (#6743) // Make sure that a selected-by-default option has a working selected property.
enctype: !!document.createElement("form").enctype, // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
support.optSelected = opt.selected;
// Makes sure cloning an html5 element does not cause problems // Tests for enctype support on a form (#6743)
// Where outerHTML is undefined, this still works support.enctype = !!document.createElement("form").enctype;
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode // Makes sure cloning an html5 element does not cause problems
boxModel: document.compatMode === "CSS1Compat", // Where outerHTML is undefined, this still works
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
// Will be defined later // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
deleteExpando: true, support.boxModel = document.compatMode === "CSS1Compat";
noCloneEvent: true,
inlineBlockNeedsLayout: false, // Will be defined later
shrinkWrapBlocks: false, support.inlineBlockNeedsLayout = false;
reliableMarginRight: true, support.shrinkWrapBlocks = false;
boxSizingReliable: true, support.pixelPosition = false;
pixelPosition: false support.deleteExpando = true;
}; support.noCloneEvent = true;
support.reliableMarginRight = true;
support.boxSizingReliable = true;
// Make sure checked status is properly cloned // Make sure checked status is properly cloned
input.checked = true; input.checked = true;
...@@ -237,5 +234,5 @@ jQuery.support = (function() { ...@@ -237,5 +234,5 @@ jQuery.support = (function() {
all = select = fragment = opt = a = input = null; all = select = fragment = opt = a = input = null;
return support; return support;
})(); })({});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment