Last active
August 29, 2015 14:18
-
-
Save andymason/637f511c583450f47429 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Support: Firefox 18+ | |
// Can't be in strict mode, several libs including ASP.NET trace | |
// the stack via arguments.caller.callee and Firefox dies if | |
// you try to trace through "use strict" call chains. (#13335) | |
// | |
var arr = []; | |
-- | |
// Support: Android<4.1 | |
// Make sure we trim BOM and NBSP | |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | |
// Matches dashed string for camelizing | |
rmsPrefix = /^-ms-/, | |
-- | |
// Support: Android<4.0 (functionish RegExp) | |
return typeof obj === "object" || typeof obj === "function" ? | |
class2type[ toString.call(obj) ] || "object" : | |
typeof obj; | |
}, | |
-- | |
// Support: IE9-11+ | |
// Microsoft forgot to hump their vendor prefix (#9572) | |
camelCase: function( string ) { | |
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); | |
}, | |
-- | |
// Support: Android<4.1 | |
trim: function( text ) { | |
return text == null ? | |
"" : | |
( text + "" ).replace( rtrim, "" ); | |
}, | |
-- | |
// Support: Android<4.1, PhantomJS<2 | |
// push.apply(_, arraylike) throws on ancient WebKit | |
merge: function( first, second ) { | |
var len = +second.length, | |
j = 0, | |
i = first.length; | |
-- | |
// Support: Firefox<24 | |
// Workaround erroneous numeric interpretation of +"0x" | |
return high !== high || escapedWhitespace ? | |
escaped : | |
high < 0 ? | |
// BMP codepoint | |
-- | |
// Support: Android<4.0 | |
// Detect silently failing push.apply | |
arr[ preferredDoc.childNodes.length ].nodeType; | |
} catch ( e ) { | |
push = { apply: arr.length ? | |
-- | |
// Support: IE<9 | |
// Otherwise append directly | |
function( target, els ) { | |
var j = target.length, | |
i = 0; | |
// Can't trust NodeList.length | |
-- | |
// Support: IE>8 | |
// If iframe document is assigned to "document" variable and if iframe has been reloaded, | |
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 | |
// IE6-8 do not support the defaultView property so parent will be undefined | |
if ( parent && parent !== parent.top ) { | |
// IE11 does not have attachEvent, so all must suffer | |
-- | |
// Support: IE<8 | |
// Verify that getAttribute really returns attributes and not properties | |
// (excepting IE8 booleans) | |
support.attributes = assert(function( div ) { | |
div.className = "i"; | |
return !div.getAttribute("className"); | |
-- | |
// Support: IE<9 | |
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); | |
// Support: IE<10 | |
// Check if getElementById returns elements by name | |
// The broken getElementById methods don't pick up programatically-set names, | |
// so use a roundabout getElementsByName test | |
support.getById = assert(function( div ) { | |
docElem.appendChild( div ).id = expando; | |
-- | |
// Support: IE6/7 | |
// getElementById is not reliable as a find shortcut | |
delete Expr.find["ID"]; | |
Expr.filter["ID"] = function( id ) { | |
var attrId = id.replace( runescape, funescape ); | |
-- | |
// Support: IE8, Opera 11-12.16 | |
// Nothing should be selected when empty strings follow ^= or $= or *= | |
// The test attribute must be unknown in Opera but "safe" for WinRT | |
// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section | |
if ( div.querySelectorAll("[msallowcapture^='']").length ) { | |
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); | |
-- | |
// Support: IE8 | |
// Boolean attributes and "value" are not treated correctly | |
if ( !div.querySelectorAll("[selected]").length ) { | |
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); | |
} | |
// Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ | |
if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { | |
rbuggyQSA.push("~="); | |
} | |
// Webkit/Opera - :checked should return selected option elements | |
-- | |
// Support: Safari 8+, iOS 8+ | |
// https://bugs.webkit.org/show_bug.cgi?id=136851 | |
// In-page `selector#id sibing-combinator selector` fails | |
if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { | |
rbuggyQSA.push(".#.+[+~]"); | |
} | |
-- | |
// Support: Windows 8 Native Apps | |
// The type and name attributes are restricted during .innerHTML assignment | |
var input = doc.createElement("input"); | |
input.setAttribute( "type", "hidden" ); | |
div.appendChild( input ).setAttribute( "name", "D" ); | |
// Support: IE8 | |
// Enforce case-sensitivity of name attribute | |
if ( div.querySelectorAll("[name=d]").length ) { | |
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); | |
} | |
-- | |
// Support: IE<8 | |
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text" | |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); | |
}, | |
// Position-in-collection | |
-- | |
// Support: IE<9, Safari | |
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id | |
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { | |
if ( byElement && elem ) { | |
j = 0; | |
while ( (matcher = elementMatchers[j++]) ) { | |
-- | |
// Support: Chrome 14-35+ | |
// Always assume duplicates if they aren't passed to the comparison function | |
support.detectDuplicates = !!hasDuplicate; | |
// Initialize against the default document | |
setDocument(); | |
-- | |
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) | |
// Detached nodes confoundingly follow *each other* | |
support.sortDetached = assert(function( div1 ) { | |
// Should return 1, but returns 4 (following) | |
return div1.compareDocumentPosition( document.createElement("div") ) & 1; | |
}); | |
-- | |
// Support: IE<8 | |
// Prevent attribute/property "interpolation" | |
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx | |
if ( !assert(function( div ) { | |
div.innerHTML = "<a href='#'></a>"; | |
return div.firstChild.getAttribute("href") === "#" ; | |
-- | |
// Support: IE<9 | |
// Use defaultValue in place of getAttribute("value") | |
if ( !support.attributes || !assert(function( div ) { | |
div.innerHTML = "<input/>"; | |
div.firstChild.setAttribute( "value", "" ); | |
return div.firstChild.getAttribute( "value" ) === ""; | |
-- | |
// Support: IE<9 | |
// Use getAttributeNode to fetch booleans when getAttribute lies | |
if ( !assert(function( div ) { | |
return div.getAttribute("disabled") == null; | |
}) ) { | |
addHandle( booleans, function( elem, name, isXML ) { | |
-- | |
// Support: Promises/A+ section 2.3.3.3.3 | |
// https://promisesaplus.com/#point-59 | |
// Ignore double-resolution attempts | |
if ( depth < maxDepth ) { | |
return; | |
} | |
-- | |
// Support: Promises/A+ section 2.3.1 | |
// https://promisesaplus.com/#point-48 | |
if ( returned === deferred.promise() ) { | |
throw new TypeError( "Thenable self-resolution" ); | |
} | |
// Support: Promises/A+ sections 2.3.3.1, 3.5 | |
// https://promisesaplus.com/#point-54 | |
// https://promisesaplus.com/#point-75 | |
// Retrieve `then` only once | |
then = returned && | |
// Support: Promises/A+ section 2.3.4 | |
// https://promisesaplus.com/#point-64 | |
// Only check objects and functions for thenability | |
( typeof returned === "object" || | |
typeof returned === "function" ) && | |
returned.then; | |
-- | |
// Support: Promises/A+ section 2.3.3.3.4.1 | |
// https://promisesaplus.com/#point-61 | |
// Ignore post-resolution exceptions | |
if ( depth + 1 >= maxDepth ) { | |
// Only substitue handlers pass on context | |
// and multiple values (non-spec behavior) | |
-- | |
// Support: Promises/A+ section 2.3.3.3.1 | |
// https://promisesaplus.com/#point-57 | |
// Re-resolve promises immediately to dodge false rejection from | |
// subsequent errors | |
if ( depth ) { | |
process(); | |
-- | |
// Support: IE11+ | |
// The attrs elements can be null (#14894) | |
if ( attrs[ i ] ) { | |
name = attrs[ i ].name; | |
if ( name.indexOf( "data-" ) === 0 ) { | |
name = jQuery.camelCase( name.slice(5) ); | |
-- | |
// Support: Android 4.0-4.3 | |
// Check state lost if the name is set (#11217) | |
// Support: Windows Web Apps (WWA) | |
// `name` and `type` must use .setAttribute for WWA (#14901) | |
input.setAttribute( "type", "radio" ); | |
input.setAttribute( "checked", "checked" ); | |
input.setAttribute( "name", "t" ); | |
-- | |
// Support: Android<4.2 | |
// Older WebKit doesn't clone checked state correctly in fragments | |
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; | |
// Support: IE<=11+ | |
// Make sure textarea (and checkbox) defaultValue is properly cloned | |
div.innerHTML = "<textarea>x</textarea>"; | |
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; | |
})(); | |
-- | |
// Support: Safari 6.0+ | |
// Target should not be a text node (#504, #13143) | |
if ( event.target.nodeType === 3 ) { | |
event.target = event.target.parentNode; | |
} | |
-- | |
// Support: Firefox 20+ | |
// Firefox doesn't alert if the returnValue field is not set. | |
if ( event.result !== undefined && event.originalEvent ) { | |
event.originalEvent.returnValue = event.result; | |
} | |
} | |
-- | |
// Support: Android<4.0 | |
src.returnValue === false ? | |
returnTrue : | |
returnFalse; | |
// Event type | |
-- | |
// Support: Safari<7.0 | |
// Safari doesn't support mouseenter/mouseleave at all. | |
// | |
// Support: Chrome 34+ | |
// Mouseenter doesn't perform while left mouse button is pressed | |
// (and initiated outside the observed element) | |
// https://code.google.com/p/chromium/issues/detail?id=333868 | |
jQuery.each({ | |
mouseenter: "mouseover", | |
-- | |
// Support: Firefox, Chrome, Safari | |
// Create "bubbling" focus and blur events | |
if ( !support.focusinBubbles ) { | |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { | |
// Attach a single capturing handler on the document while someone wants focusin/focusout | |
-- | |
// Support: IE9 | |
option: [ 1, "<select multiple='multiple'>", "</select>" ], | |
thead: [ 1, "<table>", "</table>" ], | |
// Some of the following wrappers are not fully defined, because | |
-- | |
// Support: Android 2.3 | |
// Android browser doesn't auto-insert colgroup | |
col: [ 2, "<table><colgroup>", "</colgroup></table>" ], | |
// Auto-insert "tbody" element | |
tr: [ 2, "<table>", "</table>" ], | |
-- | |
// Support: IE9 | |
wrapMap.optgroup = wrapMap.option; | |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; | |
wrapMap.th = wrapMap.td; | |
-- | |
// Support: IE9-11+ | |
// Use typeof to avoid zero-argument method invocation on host objects (#15151) | |
var ret = typeof context.getElementsByTagName !== "undefined" ? | |
context.getElementsByTagName( tag || "*" ) : | |
typeof context.querySelectorAll !== "undefined" ? | |
context.querySelectorAll( tag || "*" ) : | |
-- | |
// Support: Android<4.1, PhantomJS<2 | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); | |
// Convert non-html into a text node | |
} else if ( !rhtml.test( elem ) ) { | |
-- | |
// Support: Android<4.1, PhantomJS<2 | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge( nodes, tmp.childNodes ); | |
// Remember the top-level container | |
tmp = fragment.firstChild; | |
-- | |
// Support: Android<4.1, PhantomJS<2 | |
// push.apply(_, arraylike) throws on ancient WebKit | |
jQuery.merge( scripts, getAll( node, "script" ) ); | |
} | |
} | |
-- | |
// Support: Android<4.1, PhantomJS<2 | |
// .get() because push.apply(_, arraylike) throws on ancient WebKit | |
push.apply( ret, elems.get() ); | |
} | |
return this.pushStack( ret ); | |
-- | |
// Support: Firefox | |
// We have to pre-define these values for FF (#10227) | |
HTML: "block", | |
BODY: "block" | |
}; | |
-- | |
// Support: IE | |
doc.write(); | |
doc.close(); | |
display = actualDisplay( nodeName, doc ); | |
iframe.detach(); | |
-- | |
// Support: IE<=11+, Firefox<=30+ (#15098, #14150) | |
// IE throws on elements created in popups | |
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle" | |
if ( elem.ownerDocument.defaultView.opener ) { | |
return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); | |
} | |
-- | |
// Support: IE9-11+ | |
// Style of cloned element affects source element cloned (#8908) | |
div.style.backgroundClip = "content-box"; | |
div.cloneNode( true ).style.backgroundClip = ""; | |
support.clearCloneStyle = div.style.backgroundClip === "content-box"; | |
-- | |
// Support: Android 2.3 | |
// Vendor-prefix box-sizing | |
"-webkit-box-sizing:border-box;box-sizing:border-box;" + | |
"display:block;position:absolute;" + | |
"margin:0;margin-top:1%;margin-right:50%;" + | |
"border:1px;padding:1px;" + | |
-- | |
// Support: Android 4.0-4.3 | |
// We're checking for boxSizingReliableVal here instead of pixelMarginRightVal | |
// since that compresses better and they're computed together anyway. | |
if ( boxSizingReliableVal == null ) { | |
computeStyleTests(); | |
} | |
-- | |
// Support: Android 2.3 | |
// Check if div with explicit width and no margin-right incorrectly | |
// gets computed margin-right based on width of container. (#3333) | |
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right | |
// This support function is only executed once so no memoizing is needed. | |
var ret, | |
-- | |
// Support: Android 2.3 | |
// Vendor-prefix box-sizing | |
"-webkit-box-sizing:content-box;box-sizing:content-box;" + | |
"display:block;margin:0;border:0;padding:0"; | |
marginDiv.style.marginRight = marginDiv.style.width = "0"; | |
div.style.width = "1px"; | |
-- | |
// Support: IE9 | |
// getPropertyValue is only needed for .css('filter') (#12537) | |
if ( computed ) { | |
ret = computed.getPropertyValue( name ) || computed[ name ]; | |
} | |
-- | |
// Support: IE9-11+ | |
// IE returns zIndex value as an integer. | |
ret + "" : | |
ret; | |
} | |
-- | |
// Support: IE9-11+ | |
// background-* props affect original clone's values | |
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { | |
style[ name ] = "inherit"; | |
} | |
-- | |
// Support: Android 2.3 | |
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, | |
function( elem, computed ) { | |
if ( computed ) { | |
return jQuery.swap( elem, { "display": "inline-block" }, | |
curCSS, [ elem, "marginRight" ] ); | |
-- | |
// Support: IE9 | |
// Panic based approach to setting things on disconnected nodes | |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { | |
set: function( tween ) { | |
if ( tween.elem.nodeType && tween.elem.parentNode ) { | |
tween.elem[ tween.prop ] = tween.now; | |
-- | |
// Support: Android 2.3 | |
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) | |
temp = remaining / animation.duration || 0, | |
percent = 1 - temp, | |
index = 0, | |
length = animation.tweens.length; | |
-- | |
// Support: Android<4.4 | |
// Default value for a checkbox should be "on" | |
support.checkOn = input.value !== ""; | |
// Support: IE<=11+ | |
// Must access selectedIndex to make default options select | |
support.optSelected = opt.selected; | |
// Support: Android<=2.3 | |
// Options inside disabled selects are incorrectly marked as disabled | |
select.disabled = true; | |
support.optDisabled = !opt.disabled; | |
// Support: IE<=11+ | |
// An input loses its value after becoming a radio | |
input = document.createElement( "input" ); | |
input.value = "t"; | |
input.type = "radio"; | |
support.radioValue = input.value === "t"; | |
-- | |
// Support: IE<11 | |
// option.value not trimmed (#14858) | |
return jQuery.trim( elem.value ); | |
} | |
}, | |
select: { | |
-- | |
// Support: Android 2.3 | |
// Workaround failure to string-cast null input | |
jQuery.parseJSON = function( data ) { | |
return JSON.parse( data + "" ); | |
}; | |
-- | |
// Support: IE9 | |
try { | |
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); | |
} catch ( e ) { | |
xml = undefined; | |
} | |
-- | |
// Support: IE8-11+ | |
// IE throws exception if url is malformed, e.g. http://example.com:80x/ | |
try { | |
urlAnchor.href = s.url; | |
// Support: IE8-11+ | |
// Anchor's host property isn't correctly set when s.url is relative | |
urlAnchor.href = urlAnchor.href; | |
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== | |
urlAnchor.protocol + "//" + urlAnchor.host; | |
} catch ( e ) { | |
-- | |
// Support: IE9 | |
// #1450: sometimes IE returns 1223 when it should be 204 | |
1223: 204 | |
}, | |
xhrSupported = jQuery.ajaxSettings.xhr(); | |
// Support: IE9 | |
// Open requests must be manually aborted on unload (#5280) | |
// See https://support.microsoft.com/kb/2856746 for more info | |
if ( window.attachEvent ) { | |
window.attachEvent( "onunload", function() { | |
for ( var key in xhrCallbacks ) { | |
-- | |
// Support: IE9 | |
// Accessing binary-data responseText throws an exception | |
// (#11426) | |
typeof xhr.responseText === "string" ? { | |
text: xhr.responseText | |
} : undefined, | |
-- | |
// Support: Safari<7+, Chrome<37+ | |
// Add the top/left cssHooks using jQuery.fn.position | |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 | |
// Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280 | |
// getComputedStyle returns percent when specified for top/left/bottom/right; | |
// rather than make the css module depend on the offset module, just check for it here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment