2013-08-15 18:15:49 +00:00
|
|
|
define([
|
|
|
|
"./core",
|
|
|
|
"./var/strundefined",
|
|
|
|
"./core/swap"
|
|
|
|
], function( jQuery, strundefined ) {
|
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
jQuery.support = (function( support ) {
|
2011-04-07 04:51:37 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
var all, a, input, select, fragment, opt, eventName, isSupported, i,
|
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
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Finish early in limited (non-browser) environments
|
2013-04-09 13:59:43 +00:00
|
|
|
all = div.getElementsByTagName("*") || [];
|
2012-06-11 17:24:26 +00:00
|
|
|
a = div.getElementsByTagName("a")[ 0 ];
|
2013-04-09 13:59:43 +00:00
|
|
|
if ( !a || !a.style || !all.length ) {
|
2013-02-25 21:06:09 +00:00
|
|
|
return support;
|
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";
|
2012-12-08 21:28:10 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
|
|
|
support.getSetAttribute = div.className !== "t";
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// IE strips leading whitespace when .innerHTML is used
|
|
|
|
support.leadingWhitespace = div.firstChild.nodeType === 3;
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Make sure that tbody elements aren't automatically inserted
|
|
|
|
// IE will insert them into empty tables
|
|
|
|
support.tbody = !div.getElementsByTagName("tbody").length;
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Make sure that link elements get serialized correctly by innerHTML
|
|
|
|
// This requires a wrapper element in IE
|
|
|
|
support.htmlSerialize = !!div.getElementsByTagName("link").length;
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Get the style information from getAttribute
|
|
|
|
// (IE uses .cssText instead)
|
|
|
|
support.style = /top/.test( a.getAttribute("style") );
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Make sure that URLs aren't manipulated
|
|
|
|
// (IE normalizes it by default)
|
|
|
|
support.hrefNormalized = a.getAttribute("href") === "/a";
|
2009-03-23 01:55:17 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Make sure that element opacity exists
|
|
|
|
// (IE uses filter instead)
|
|
|
|
// Use a regex to work around a WebKit issue. See #5145
|
|
|
|
support.opacity = /^0.5/.test( a.style.opacity );
|
2008-12-21 23:06:42 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Verify style float existence
|
|
|
|
// (IE uses styleFloat instead of cssFloat)
|
|
|
|
support.cssFloat = !!a.style.cssFloat;
|
2009-12-22 07:00:46 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
|
|
|
support.checkOn = !!input.value;
|
2011-04-13 16:35:38 +00:00
|
|
|
|
2013-02-25 21:06:09 +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)
|
|
|
|
support.optSelected = opt.selected;
|
2011-10-22 20:03:57 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Tests for enctype support on a form (#6743)
|
|
|
|
support.enctype = !!document.createElement("form").enctype;
|
2011-11-08 05:05:33 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Makes sure cloning an html5 element does not cause problems
|
|
|
|
// Where outerHTML is undefined, this still works
|
|
|
|
support.html5Clone = document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>";
|
2012-05-18 16:40:10 +00:00
|
|
|
|
2013-02-25 21:06:09 +00:00
|
|
|
// Will be defined later
|
|
|
|
support.inlineBlockNeedsLayout = false;
|
|
|
|
support.shrinkWrapBlocks = false;
|
|
|
|
support.pixelPosition = false;
|
|
|
|
support.deleteExpando = true;
|
|
|
|
support.noCloneEvent = true;
|
|
|
|
support.reliableMarginRight = true;
|
|
|
|
support.boxSizingReliable = true;
|
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
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE<9
|
2010-10-17 14:56:01 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
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-17 14:17:39 +00:00
|
|
|
input.setAttribute( "checked", "t" );
|
2012-02-09 14:45:34 +00:00
|
|
|
input.setAttribute( "name", "t" );
|
|
|
|
|
2011-04-07 04:51:37 +00:00
|
|
|
fragment = document.createDocumentFragment();
|
2012-12-17 14:17:39 +00:00
|
|
|
fragment.appendChild( input );
|
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;
|
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// WebKit doesn't clone checked state correctly in fragments
|
|
|
|
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
2011-04-07 04:51:37 +00:00
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE<9
|
|
|
|
// Opera does not clone events (and typeof div.attachEvent === undefined).
|
|
|
|
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
|
2012-11-15 02:09:12 +00:00
|
|
|
if ( div.attachEvent ) {
|
2012-12-17 14:17:39 +00:00
|
|
|
div.attachEvent( "onclick", function() {
|
|
|
|
support.noCloneEvent = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
div.cloneNode( true ).click();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
|
2013-02-08 05:20:33 +00:00
|
|
|
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
|
2012-12-17 14:17:39 +00:00
|
|
|
for ( i in { submit: true, change: true, focusin: true }) {
|
|
|
|
div.setAttribute( eventName = "on" + i, "t" );
|
|
|
|
|
|
|
|
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
|
2011-04-07 04:51:37 +00:00
|
|
|
}
|
2009-12-04 16:28:50 +00:00
|
|
|
|
2013-01-08 01:49:36 +00:00
|
|
|
div.style.backgroundClip = "content-box";
|
2013-01-08 10:15:36 +00:00
|
|
|
div.cloneNode( true ).style.backgroundClip = "";
|
2013-01-08 01:49:36 +00:00
|
|
|
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
|
|
|
|
2013-04-04 14:14:05 +00:00
|
|
|
// Support: IE<9
|
|
|
|
// Iteration over object's inherited properties before its own.
|
|
|
|
for ( i in jQuery( support ) ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
support.ownLast = i !== "0";
|
|
|
|
|
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-12-17 14:17:39 +00:00
|
|
|
var container, marginDiv, tds,
|
|
|
|
divReset = "padding:0;margin:0;border:0;display:block;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-12-17 14:17:39 +00:00
|
|
|
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
|
2011-10-31 14:50:19 +00:00
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
body.appendChild( container ).appendChild( div );
|
2011-11-17 19:48:27 +00:00
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE8
|
2011-11-17 19:48:27 +00:00
|
|
|
// 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).
|
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";
|
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE8
|
2011-11-17 19:48:27 +00:00
|
|
|
// Check if empty table cells still have offsetWidth/Height
|
|
|
|
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
|
|
|
|
2013-03-04 04:20:25 +00:00
|
|
|
// Check box-sizing and margin behavior.
|
2012-06-11 17:24:26 +00:00
|
|
|
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%;";
|
2013-03-04 04:20:25 +00:00
|
|
|
|
|
|
|
// Workaround failing boxSizing test due to offsetWidth returning wrong value
|
|
|
|
// with some non-1 values of body zoom, ticket #13543
|
|
|
|
jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
|
|
|
|
support.boxSizing = div.offsetWidth === 4;
|
|
|
|
});
|
2012-06-18 17:26:46 +00:00
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Use 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
|
2012-12-17 14:17:39 +00:00
|
|
|
// gets computed margin-right based on width of container. (#3333)
|
2012-06-11 17:24:26 +00:00
|
|
|
// Fails in WebKit before Feb 2011 nightlies
|
|
|
|
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
2012-12-17 14:17:39 +00:00
|
|
|
marginDiv = div.appendChild( 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-12-17 14:17:39 +00:00
|
|
|
|
2012-02-13 14:52:43 +00:00
|
|
|
support.reliableMarginRight =
|
2012-06-11 17:24:26 +00:00
|
|
|
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
|
2012-02-13 14:52:43 +00:00
|
|
|
}
|
|
|
|
|
2013-08-15 18:15:49 +00:00
|
|
|
if ( typeof div.style.zoom !== strundefined ) {
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE<8
|
2011-11-17 19:48:27 +00:00
|
|
|
// Check if natively block-level elements act like inline-block
|
|
|
|
// elements when setting their display to 'inline' and giving
|
|
|
|
// them layout
|
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
|
|
|
|
2012-12-17 14:17:39 +00:00
|
|
|
// Support: IE6
|
2011-11-17 19:48:27 +00:00
|
|
|
// Check if elements with layout shrink-wrap their children
|
2012-02-24 05:14:15 +00:00
|
|
|
div.style.display = "block";
|
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
|
|
|
|
2013-02-03 18:54:38 +00:00
|
|
|
if ( support.inlineBlockNeedsLayout ) {
|
|
|
|
// Prevent IE 6 from affecting layout for positioned elements #11048
|
|
|
|
// Prevent IE from shrinking the body in IE 7 mode #12869
|
|
|
|
// Support: IE<8
|
|
|
|
body.style.zoom = 1;
|
|
|
|
}
|
2011-12-26 20:22:29 +00:00
|
|
|
}
|
|
|
|
|
2011-10-31 14:50:19 +00:00
|
|
|
body.removeChild( container );
|
2012-12-17 14:17:39 +00:00
|
|
|
|
|
|
|
// Null elements to avoid leaks in IE
|
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
|
2012-12-17 14:17:39 +00:00
|
|
|
all = select = fragment = opt = a = input = null;
|
2012-06-11 17:24:26 +00:00
|
|
|
|
2011-04-07 04:51:37 +00:00
|
|
|
return support;
|
2013-02-25 21:06:09 +00:00
|
|
|
})({});
|
2012-12-17 14:17:39 +00:00
|
|
|
|
2013-08-15 18:15:49 +00:00
|
|
|
});
|