2011-04-07 04:51:37 +00:00
|
|
|
jQuery.support = (function() {
|
|
|
|
|
2011-11-17 19:48:27 +00:00
|
|
|
var support,
|
2011-04-07 04:51:37 +00:00
|
|
|
all,
|
|
|
|
a,
|
|
|
|
select,
|
|
|
|
opt,
|
|
|
|
input,
|
|
|
|
fragment,
|
|
|
|
eventName,
|
|
|
|
i,
|
2011-11-17 19:48:27 +00:00
|
|
|
isSupported,
|
2012-06-22 13:46:07 +00:00
|
|
|
clickFn,
|
2012-06-11 17:24:26 +00:00
|
|
|
div = document.createElement("div");
|
2011-04-07 04:51:37 +00:00
|
|
|
|
2012-10-01 00:54:28 +00:00
|
|
|
// Setup
|
2012-06-11 17:24:26 +00:00
|
|
|
div.setAttribute( "className", "t" );
|
2012-07-25 18:38:55 +00:00
|
|
|
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
2011-09-01 15:16:38 +00:00
|
|
|
|
2012-10-01 00:54:28 +00:00
|
|
|
// Support tests won't run in some limited or non-browser environments
|
2012-06-11 17:24:26 +00:00
|
|
|
all = div.getElementsByTagName("*");
|
|
|
|
a = div.getElementsByTagName("a")[ 0 ];
|
2012-10-01 00:54:28 +00:00
|
|
|
if ( !all || !a || !all.length ) {
|
2011-04-07 04:51:37 +00:00
|
|
|
return {};
|
2008-12-21 23:06:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 00:54:28 +00:00
|
|
|
// First batch of tests
|
2012-06-11 17:24:26 +00:00
|
|
|
select = document.createElement("select");
|
2011-04-07 04:51:37 +00:00
|
|
|
opt = select.appendChild( document.createElement("option") );
|
2012-06-11 17:24:26 +00:00
|
|
|
input = div.getElementsByTagName("input")[ 0 ];
|
2011-04-07 04:51:37 +00:00
|
|
|
|
2012-10-01 00:54:28 +00:00
|
|
|
a.style.cssText = "top:1px;float:left;opacity:.5";
|
2011-04-07 04:51:37 +00:00
|
|
|
support = {
|
2012-12-08 21:28:10 +00:00
|
|
|
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
|
|
|
getSetAttribute: div.className !== "t",
|
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// IE strips leading whitespace when .innerHTML is used
|
2012-12-08 21:28:10 +00:00
|
|
|
leadingWhitespace: div.firstChild.nodeType === 3,
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Make sure that tbody elements aren't automatically inserted
|
|
|
|
// IE will insert them into empty tables
|
2011-11-17 19:48:27 +00:00
|
|
|
tbody: !div.getElementsByTagName("tbody").length,
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Make sure that link elements get serialized correctly by innerHTML
|
|
|
|
// This requires a wrapper element in IE
|
2011-11-17 19:48:27 +00:00
|
|
|
htmlSerialize: !!div.getElementsByTagName("link").length,
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Get the style information from getAttribute
|
2011-04-07 04:51:37 +00:00
|
|
|
// (IE uses .cssText instead)
|
2011-04-10 21:08:18 +00:00
|
|
|
style: /top/.test( a.getAttribute("style") ),
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Make sure that URLs aren't manipulated
|
|
|
|
// (IE normalizes it by default)
|
2012-12-08 21:28:10 +00:00
|
|
|
hrefNormalized: a.getAttribute("href") === "/a",
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Make sure that element opacity exists
|
|
|
|
// (IE uses filter instead)
|
2009-12-10 04:37:14 +00:00
|
|
|
// Use a regex to work around a WebKit issue. See #5145
|
2012-06-11 17:24:26 +00:00
|
|
|
opacity: /^0.5/.test( a.style.opacity ),
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Verify style float existence
|
|
|
|
// (IE uses styleFloat instead of cssFloat)
|
|
|
|
cssFloat: !!a.style.cssFloat,
|
|
|
|
|
2012-12-08 21:28:10 +00:00
|
|
|
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
|
|
|
checkOn: !!input.value,
|
2009-12-22 07:00:46 +00:00
|
|
|
|
2009-12-22 20:46:54 +00:00
|
|
|
// 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)
|
2010-09-27 14:19:55 +00:00
|
|
|
optSelected: opt.selected,
|
2011-04-13 16:35:38 +00:00
|
|
|
|
2012-10-01 00:54:28 +00:00
|
|
|
// Tests for enctype support on a form (#6743)
|
2011-10-22 20:03:57 +00:00
|
|
|
enctype: !!document.createElement("form").enctype,
|
|
|
|
|
2011-11-08 05:05:33 +00:00
|
|
|
// Makes sure cloning an html5 element does not cause problems
|
|
|
|
// Where outerHTML is undefined, this still works
|
|
|
|
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
|
|
|
|
|
2012-05-18 16:40:10 +00:00
|
|
|
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
|
2012-12-08 21:28:10 +00:00
|
|
|
boxModel: document.compatMode === "CSS1Compat",
|
2012-05-18 16:40:10 +00:00
|
|
|
|
2008-12-21 23:06:42 +00:00
|
|
|
// Will be defined later
|
2011-04-07 04:51:37 +00:00
|
|
|
submitBubbles: true,
|
|
|
|
changeBubbles: true,
|
2011-04-08 16:24:25 +00:00
|
|
|
focusinBubbles: false,
|
2010-10-17 14:56:01 +00:00
|
|
|
deleteExpando: true,
|
2009-01-11 16:17:20 +00:00
|
|
|
noCloneEvent: true,
|
2010-10-05 18:28:43 +00:00
|
|
|
inlineBlockNeedsLayout: false,
|
2010-10-05 19:53:35 +00:00
|
|
|
shrinkWrapBlocks: false,
|
2011-12-07 01:32:26 +00:00
|
|
|
reliableMarginRight: true,
|
2012-06-16 01:20:41 +00:00
|
|
|
boxSizingReliable: true,
|
|
|
|
pixelPosition: false
|
2008-12-21 23:06:42 +00:00
|
|
|
};
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2011-04-07 04:51:37 +00:00
|
|
|
// Make sure checked status is properly cloned
|
2012-07-25 18:38:55 +00:00
|
|
|
input.checked = true;
|
|
|
|
support.noCloneChecked = input.cloneNode( true ).checked;
|
2011-02-23 18:18:44 +00:00
|
|
|
|
2010-09-27 14:19:55 +00:00
|
|
|
// Make sure that the options inside disabled selects aren't marked as disabled
|
2011-04-07 04:51:37 +00:00
|
|
|
// (WebKit marks them as disabled)
|
2010-09-27 14:19:55 +00:00
|
|
|
select.disabled = true;
|
2011-04-07 04:51:37 +00:00
|
|
|
support.optDisabled = !opt.disabled;
|
2008-12-21 23:06:42 +00:00
|
|
|
|
2010-10-17 14:56:01 +00:00
|
|
|
// Test to see if it's possible to delete an expando from an element
|
|
|
|
// Fails in Internet Explorer
|
|
|
|
try {
|
2011-01-17 21:31:12 +00:00
|
|
|
delete div.test;
|
2011-04-07 04:51:37 +00:00
|
|
|
} catch( e ) {
|
|
|
|
support.deleteExpando = false;
|
2010-10-17 14:56:01 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 16:56:48 +00:00
|
|
|
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
|
2012-06-22 13:46:07 +00:00
|
|
|
div.attachEvent( "onclick", clickFn = function() {
|
2008-12-21 23:06:42 +00:00
|
|
|
// Cloning a node shouldn't copy over any
|
|
|
|
// bound event handlers (IE does this)
|
2011-04-07 04:51:37 +00:00
|
|
|
support.noCloneEvent = false;
|
2011-04-08 15:41:14 +00:00
|
|
|
});
|
2012-06-11 17:24:26 +00:00
|
|
|
div.cloneNode( true ).fireEvent("onclick");
|
2012-06-22 13:46:07 +00:00
|
|
|
div.detachEvent( "onclick", clickFn );
|
2008-12-21 23:06:42 +00:00
|
|
|
}
|
|
|
|
|
2012-12-08 21:28:10 +00:00
|
|
|
// Check if we can trust getAttribute("value")
|
2011-04-22 01:33:09 +00:00
|
|
|
input = document.createElement("input");
|
2012-12-08 21:28:10 +00:00
|
|
|
input.setAttribute( "value", "" );
|
2012-12-09 05:26:24 +00:00
|
|
|
support.input = input.getAttribute( "value" ) === "";
|
2012-12-08 21:28:10 +00:00
|
|
|
|
|
|
|
// Check if an input maintains its value after becoming a radio
|
2011-04-22 01:33:09 +00:00
|
|
|
input.value = "t";
|
2012-06-11 17:24:26 +00:00
|
|
|
input.setAttribute( "type", "radio" );
|
2011-04-22 01:33:09 +00:00
|
|
|
support.radioValue = input.value === "t";
|
|
|
|
|
2012-02-09 14:45:34 +00:00
|
|
|
// #11217 - WebKit loses check when the name is after the checked attribute
|
2012-12-08 21:28:10 +00:00
|
|
|
input.setAttribute( "checked", "checked" );
|
2012-02-09 14:45:34 +00:00
|
|
|
input.setAttribute( "name", "t" );
|
|
|
|
|
2011-04-22 04:27:52 +00:00
|
|
|
div.appendChild( input );
|
2011-04-07 04:51:37 +00:00
|
|
|
fragment = document.createDocumentFragment();
|
2011-10-24 15:33:09 +00:00
|
|
|
fragment.appendChild( div.lastChild );
|
2010-01-25 23:43:33 +00:00
|
|
|
|
|
|
|
// WebKit doesn't clone checked state correctly in fragments
|
2011-04-07 04:51:37 +00:00
|
|
|
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
2010-01-25 23:43:33 +00:00
|
|
|
|
2011-04-22 04:27:52 +00:00
|
|
|
// Check if a disconnected checkbox will retain its checked
|
|
|
|
// value of true after appended to the DOM (IE6/7)
|
|
|
|
support.appendChecked = input.checked;
|
|
|
|
|
2011-11-17 19:48:27 +00:00
|
|
|
fragment.removeChild( input );
|
|
|
|
fragment.appendChild( div );
|
2011-04-07 04:51:37 +00:00
|
|
|
|
2009-12-04 16:28:50 +00:00
|
|
|
// Technique from Juriy Zaytsev
|
2011-10-04 15:09:12 +00:00
|
|
|
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
|
2011-04-07 04:51:37 +00:00
|
|
|
// We only care about the case where non-standard event systems
|
|
|
|
// are used, namely in IE. Short-circuiting here helps us to
|
|
|
|
// avoid an eval call (in setAttribute) which can cause CSP
|
|
|
|
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
|
2012-11-15 02:09:12 +00:00
|
|
|
if ( div.attachEvent ) {
|
2012-01-20 19:17:02 +00:00
|
|
|
for ( i in {
|
2012-06-11 17:24:26 +00:00
|
|
|
submit: true,
|
|
|
|
change: true,
|
|
|
|
focusin: true
|
2011-11-17 19:48:27 +00:00
|
|
|
}) {
|
2011-04-07 04:51:37 +00:00
|
|
|
eventName = "on" + i;
|
|
|
|
isSupported = ( eventName in div );
|
|
|
|
if ( !isSupported ) {
|
|
|
|
div.setAttribute( eventName, "return;" );
|
|
|
|
isSupported = ( typeof div[ eventName ] === "function" );
|
|
|
|
}
|
|
|
|
support[ i + "Bubbles" ] = isSupported;
|
2010-10-05 19:53:35 +00:00
|
|
|
}
|
2011-04-07 04:51:37 +00:00
|
|
|
}
|
2009-12-04 16:28:50 +00:00
|
|
|
|
2011-11-18 14:28:54 +00:00
|
|
|
// Run tests that need a body at doc ready
|
2011-10-31 13:50:21 +00:00
|
|
|
jQuery(function() {
|
2012-06-11 17:24:26 +00:00
|
|
|
var container, div, tds, marginDiv,
|
2012-10-16 16:22:31 +00:00
|
|
|
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
|
2011-11-18 14:28:54 +00:00
|
|
|
body = document.getElementsByTagName("body")[0];
|
|
|
|
|
2011-11-01 16:02:22 +00:00
|
|
|
if ( !body ) {
|
|
|
|
// Return for frameset docs that don't have a body
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-31 14:50:19 +00:00
|
|
|
container = document.createElement("div");
|
2012-06-11 17:24:26 +00:00
|
|
|
container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
|
2011-10-31 14:50:19 +00:00
|
|
|
body.insertBefore( container, body.firstChild );
|
|
|
|
|
2011-11-17 19:48:27 +00:00
|
|
|
// Construct the test element
|
|
|
|
div = document.createElement("div");
|
|
|
|
container.appendChild( div );
|
|
|
|
|
|
|
|
// Check if table cells still have offsetWidth/Height when they are set
|
|
|
|
// to display:none and there are still other visible table cells in a
|
|
|
|
// table row; if so, offsetWidth/Height are not reliable for use when
|
|
|
|
// determining if an element has been hidden directly using
|
|
|
|
// display:none (it is still safe to use offsets if a parent element is
|
|
|
|
// hidden; don safety goggles and see bug #4512 for more information).
|
|
|
|
// (only IE 8 fails this test)
|
2012-07-07 21:24:16 +00:00
|
|
|
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
|
2012-06-11 17:24:26 +00:00
|
|
|
tds = div.getElementsByTagName("td");
|
2012-07-07 21:24:16 +00:00
|
|
|
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
|
2011-11-17 19:48:27 +00:00
|
|
|
isSupported = ( tds[ 0 ].offsetHeight === 0 );
|
|
|
|
|
|
|
|
tds[ 0 ].style.display = "";
|
|
|
|
tds[ 1 ].style.display = "none";
|
|
|
|
|
|
|
|
// Check if empty table cells still have offsetWidth/Height
|
|
|
|
// (IE <= 8 fail this test)
|
|
|
|
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
|
|
|
|
2012-06-11 17:24:26 +00:00
|
|
|
// Check box-sizing and margin behavior
|
|
|
|
div.innerHTML = "";
|
2012-06-16 01:20:41 +00:00
|
|
|
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
|
2012-06-11 17:24:26 +00:00
|
|
|
support.boxSizing = ( div.offsetWidth === 4 );
|
|
|
|
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
|
2012-06-18 17:26:46 +00:00
|
|
|
|
2012-08-11 20:30:46 +00:00
|
|
|
// NOTE: To any future maintainer, we've window.getComputedStyle
|
|
|
|
// because jsdom on node.js will break without it.
|
2012-02-13 14:52:43 +00:00
|
|
|
if ( window.getComputedStyle ) {
|
2012-06-16 01:20:41 +00:00
|
|
|
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
|
2012-06-11 17:24:26 +00:00
|
|
|
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
|
|
|
|
|
|
|
|
// 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
|
|
|
|
marginDiv = document.createElement("div");
|
2012-05-22 14:11:47 +00:00
|
|
|
marginDiv.style.cssText = div.style.cssText = divReset;
|
2012-05-24 12:46:38 +00:00
|
|
|
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
2012-06-11 17:24:26 +00:00
|
|
|
div.style.width = "1px";
|
2012-02-13 14:52:43 +00:00
|
|
|
div.appendChild( marginDiv );
|
|
|
|
support.reliableMarginRight =
|
2012-06-11 17:24:26 +00:00
|
|
|
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
|
2012-02-13 14:52:43 +00:00
|
|
|
}
|
|
|
|
|
2011-11-17 19:48:27 +00:00
|
|
|
if ( typeof div.style.zoom !== "undefined" ) {
|
|
|
|
// Check if natively block-level elements act like inline-block
|
|
|
|
// elements when setting their display to 'inline' and giving
|
|
|
|
// them layout
|
|
|
|
// (IE < 8 does this)
|
2012-02-24 05:14:15 +00:00
|
|
|
div.innerHTML = "";
|
2012-05-22 14:11:47 +00:00
|
|
|
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
|
2012-02-24 05:14:15 +00:00
|
|
|
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
|
2011-11-17 19:48:27 +00:00
|
|
|
|
|
|
|
// Check if elements with layout shrink-wrap their children
|
|
|
|
// (IE 6 does this)
|
2012-02-24 05:14:15 +00:00
|
|
|
div.style.display = "block";
|
|
|
|
div.style.overflow = "visible";
|
2012-07-07 21:24:16 +00:00
|
|
|
div.innerHTML = "<div></div>";
|
|
|
|
div.firstChild.style.width = "5px";
|
2012-02-24 05:14:15 +00:00
|
|
|
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
|
2011-11-17 19:48:27 +00:00
|
|
|
|
2012-11-08 16:52:27 +00:00
|
|
|
// Prevent IE 6 from affecting layout for positioned elements #11048
|
|
|
|
// Prevent IE from shrinking the body in IE 7 mode #12869
|
|
|
|
body.style.zoom = 1;
|
2011-12-26 20:22:29 +00:00
|
|
|
}
|
|
|
|
|
2012-06-11 17:24:26 +00:00
|
|
|
// Null elements to avoid leaks in IE
|
2011-10-31 14:50:19 +00:00
|
|
|
body.removeChild( container );
|
2012-06-11 17:24:26 +00:00
|
|
|
container = div = tds = marginDiv = null;
|
2011-10-31 13:50:21 +00:00
|
|
|
});
|
2011-09-20 01:03:41 +00:00
|
|
|
|
2012-06-11 17:24:26 +00:00
|
|
|
// Null elements to avoid leaks in IE
|
|
|
|
fragment.removeChild( div );
|
|
|
|
all = a = select = opt = input = fragment = div = null;
|
|
|
|
|
2011-04-07 04:51:37 +00:00
|
|
|
return support;
|
2010-09-17 18:58:50 +00:00
|
|
|
})();
|