diff options
Diffstat (limited to 'examples/blog/static/js/jquery.js')
-rw-r--r-- | examples/blog/static/js/jquery.js | 663 |
1 files changed, 317 insertions, 346 deletions
diff --git a/examples/blog/static/js/jquery.js b/examples/blog/static/js/jquery.js index 3c88fa8b7..d4b67f7e6 100644 --- a/examples/blog/static/js/jquery.js +++ b/examples/blog/static/js/jquery.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v1.11.0 + * jQuery JavaScript Library v1.11.1 * http://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * http://jquery.org/license * - * Date: 2014-01-23T21:02Z + * Date: 2014-05-01T17:42Z */ (function( global, factory ) { @@ -59,14 +59,12 @@ var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; -var trim = "".trim; - var support = {}; var - version = "1.11.0", + version = "1.11.1", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -75,7 +73,8 @@ var return new jQuery.fn.init( selector, context ); }, - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + // Support: Android<4.1, IE<9 + // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing @@ -108,10 +107,10 @@ jQuery.fn = jQuery.prototype = { get: function( num ) { return num != null ? - // Return a 'clean' array + // Return just the one element from the set ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - // Return just the object + // Return all the elements in a clean array slice.call( this ); }, @@ -270,7 +269,7 @@ jQuery.extend({ // parseFloat NaNs numeric-cast false positives (null|true|false|"") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN - return obj - parseFloat( obj ) >= 0; + return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; }, isEmptyObject: function( obj ) { @@ -401,20 +400,12 @@ jQuery.extend({ return obj; }, - // Use native String.trim function wherever possible - trim: trim && !trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, + // Support: Android<4.1, IE<9 + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, // results is for internal usage only makeArray: function( arr, results ) { @@ -593,14 +584,14 @@ function isArraylike( obj ) { } var Sizzle = /*! - * Sizzle CSS Selector Engine v1.10.16 + * Sizzle CSS Selector Engine v1.10.19 * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2014-01-13 + * Date: 2014-04-18 */ (function( window ) { @@ -609,7 +600,9 @@ var i, Expr, getText, isXML, + tokenize, compile, + select, outermostContext, sortInput, hasDuplicate, @@ -676,17 +669,23 @@ var i, // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + characterEncoding + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), @@ -731,7 +730,7 @@ var i, funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint - // Support: Firefox + // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : @@ -1127,7 +1126,7 @@ setDocument = Sizzle.setDocument = function( node ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; + return m && m.parentNode ? [ m ] : []; } }; Expr.filter["ID"] = function( id ) { @@ -1207,11 +1206,13 @@ setDocument = Sizzle.setDocument = function( node ) { // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select t=''><option selected=''></option></select>"; + div.innerHTML = "<select msallowclip=''><option selected=''></option></select>"; - // Support: IE8, Opera 10-12 + // Support: IE8, Opera 11-12.16 // Nothing should be selected when empty strings follow ^= or $= or *= - if ( div.querySelectorAll("[t^='']").length ) { + // 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("[msallowclip^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); } @@ -1254,7 +1255,8 @@ setDocument = Sizzle.setDocument = function( node ) { }); } - if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || + docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { @@ -1435,7 +1437,7 @@ Sizzle.matchesSelector = function( elem, expr ) { } catch(e) {} } - return Sizzle( expr, document, null, [elem] ).length > 0; + return Sizzle( expr, document, null, [ elem ] ).length > 0; }; Sizzle.contains = function( context, elem ) { @@ -1564,7 +1566,7 @@ Expr = Sizzle.selectors = { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; @@ -1607,15 +1609,15 @@ Expr = Sizzle.selectors = { "PSEUDO": function( match ) { var excess, - unquoted = !match[5] && match[2]; + unquoted = !match[6] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is - if ( match[3] && match[4] !== undefined ) { - match[2] = match[4]; + if ( match[3] ) { + match[2] = match[4] || match[5] || ""; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && @@ -2020,7 +2022,7 @@ function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); -function tokenize( selector, parseOnly ) { +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -2085,7 +2087,7 @@ function tokenize( selector, parseOnly ) { Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); -} +}; function toSelector( tokens ) { var i = 0, @@ -2164,6 +2166,15 @@ function elementMatcher( matchers ) { matchers[0]; } +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], @@ -2432,7 +2443,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { superMatcher; } -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], @@ -2440,12 +2451,12 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { if ( !cached ) { // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); + if ( !match ) { + match = tokenize( selector ); } - i = group.length; + i = match.length; while ( i-- ) { - cached = matcherFromTokens( group[i] ); + cached = matcherFromTokens( match[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { @@ -2455,74 +2466,83 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + + // Save selector and tokenization + cached.selector = selector; } return cached; }; -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { var i, tokens, token, type, find, - match = tokenize( selector ); + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( (selector = compiled.selector || selector) ); + + results = results || []; - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { + // Try to minimize operations if there is no seed and only one group + if ( match.length === 1 ) { - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - support.getById && context.nodeType === 9 && documentIsHTML && - Expr.relative[ tokens[1].type ] ) { + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + support.getById && context.nodeType === 9 && documentIsHTML && + Expr.relative[ tokens[1].type ] ) { - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - } - selector = selector.slice( tokens.shift().value.length ); + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; } - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; + selector = selector.slice( tokens.shift().value.length ); + } - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; - break; + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; } + + break; } } } } - // Compile and execute a filtering function + // Compile and execute a filtering function if one is not provided // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( + ( compiled || compile( selector, match ) )( seed, context, !documentIsHTML, @@ -2530,7 +2550,7 @@ function select( selector, context, results, seed ) { rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; -} +}; // One-time assignments @@ -3423,8 +3443,9 @@ jQuery.extend({ readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); + if ( jQuery.fn.triggerHandler ) { + jQuery( document ).triggerHandler( "ready" ); + jQuery( document ).off( "ready" ); } } }); @@ -3532,23 +3553,21 @@ support.ownLast = i !== "0"; // false until the test is run support.inlineBlockNeedsLayout = false; +// Execute ASAP in case we need to set body.style.zoom jQuery(function() { - // We need to execute this one support test ASAP because we need to know - // if body.style.zoom needs to be set. + // Minified: var a,b,c,d + var val, div, body, container; - var container, div, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body || !body.style ) { // Return for frameset docs that don't have a body return; } // Setup - container = document.createElement( "div" ); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - div = document.createElement( "div" ); + container = document.createElement( "div" ); + container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); if ( typeof div.style.zoom !== strundefined ) { @@ -3556,9 +3575,10 @@ jQuery(function() { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout - div.style.cssText = "border:0;margin:0;width:1px;padding:1px;display:inline;zoom:1"; + div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; - if ( (support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 )) ) { + support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; + if ( val ) { // Prevent IE 6 from affecting layout for positioned elements #11048 // Prevent IE from shrinking the body in IE 7 mode #12869 // Support: IE<8 @@ -3567,9 +3587,6 @@ jQuery(function() { } body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = null; }); @@ -3892,12 +3909,15 @@ jQuery.fn.extend({ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { i = attrs.length; while ( i-- ) { - name = attrs[i].name; - if ( name.indexOf("data-") === 0 ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); + // 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) ); + dataAttr( elem, name, data[ name ] ); + } } } jQuery._data( elem, "parsedAttrs", true ); @@ -4137,13 +4157,13 @@ var rcheckableType = (/^(?:checkbox|radio)$/i); (function() { - var fragment = document.createDocumentFragment(), - div = document.createElement("div"), - input = document.createElement("input"); + // Minified: var a,b,c + var input = document.createElement( "input" ), + div = document.createElement( "div" ), + fragment = document.createDocumentFragment(); // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a>"; + div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; // IE strips leading whitespace when .innerHTML is used support.leadingWhitespace = div.firstChild.nodeType === 3; @@ -4203,9 +4223,6 @@ var rcheckableType = (/^(?:checkbox|radio)$/i); support.deleteExpando = false; } } - - // Null elements to avoid leaks in IE. - fragment = div = input = null; })(); @@ -4231,7 +4248,7 @@ var rcheckableType = (/^(?:checkbox|radio)$/i); var rformElems = /^(?:input|select|textarea)$/i, rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; @@ -4834,8 +4851,9 @@ jQuery.event = { beforeunload: { postDispatch: function( event ) { - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { + // 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; } } @@ -4901,11 +4919,9 @@ jQuery.Event = function( src, props ) { // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && ( - // Support: IE < 9 - src.returnValue === false || - // Support: Android < 4.0 - src.getPreventDefault && src.getPreventDefault() ) ? + src.defaultPrevented === undefined && + // Support: IE < 9, Android < 4.0 + src.returnValue === false ? returnTrue : returnFalse; @@ -4968,7 +4984,14 @@ jQuery.Event.prototype = { e.cancelBubble = true; }, stopImmediatePropagation: function() { + var e = this.originalEvent; + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + this.stopPropagation(); } }; @@ -4976,7 +4999,9 @@ jQuery.Event.prototype = { // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", - mouseleave: "mouseout" + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, @@ -5980,14 +6005,15 @@ var iframe, */ // Called only from within defaultDisplay function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // getDefaultComputedStyle might be reliably used only on attached element - display = window.getDefaultComputedStyle ? + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? // Use of this method is a temporary fix (more like optmization) until something better comes along, // since it was removed from specification and supported only in FF - window.getDefaultComputedStyle( elem[ 0 ] ).display : jQuery.css( elem[ 0 ], "display" ); + style.display : jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element @@ -6033,68 +6059,47 @@ function defaultDisplay( nodeName ) { (function() { - var a, shrinkWrapBlocksVal, - div = document.createElement( "div" ), - divReset = - "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + - "display:block;padding:0;margin:0;border:0"; - - // Setup - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - a = div.getElementsByTagName( "a" )[ 0 ]; - - a.style.cssText = "float:left;opacity:.5"; - - // 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 ); - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - support.cssFloat = !!a.style.cssFloat; - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Null elements to avoid leaks in IE. - a = div = null; + var shrinkWrapBlocksVal; support.shrinkWrapBlocks = function() { - var body, container, div, containerStyles; - - if ( shrinkWrapBlocksVal == null ) { - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body ) { - // Test fired too early or in an unsupported environment, exit. - return; - } - - containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px"; - container = document.createElement( "div" ); - div = document.createElement( "div" ); + if ( shrinkWrapBlocksVal != null ) { + return shrinkWrapBlocksVal; + } - body.appendChild( container ).appendChild( div ); + // Will be changed later if needed. + shrinkWrapBlocksVal = false; - // Will be changed later if needed. - shrinkWrapBlocksVal = false; + // Minified: var b,c,d + var div, body, container; - if ( typeof div.style.zoom !== strundefined ) { - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.cssText = divReset + ";width:1px;padding:1px;zoom:1"; - div.innerHTML = "<div></div>"; - div.firstChild.style.width = "5px"; - shrinkWrapBlocksVal = div.offsetWidth !== 3; - } + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body || !body.style ) { + // Test fired too early or in an unsupported environment, exit. + return; + } - body.removeChild( container ); + // Setup + div = document.createElement( "div" ); + container = document.createElement( "div" ); + container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; + body.appendChild( container ).appendChild( div ); - // Null elements to avoid leaks in IE. - body = container = div = null; + // Support: IE6 + // Check if elements with layout shrink-wrap their children + if ( typeof div.style.zoom !== strundefined ) { + // Reset CSS: box-sizing; display; margin; border + div.style.cssText = + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + + "box-sizing:content-box;display:block;margin:0;border:0;" + + "padding:1px;width:1px;zoom:1"; + div.appendChild( document.createElement( "div" ) ).style.width = "5px"; + shrinkWrapBlocksVal = div.offsetWidth !== 3; } + body.removeChild( container ); + return shrinkWrapBlocksVal; }; @@ -6242,92 +6247,46 @@ function addGetHookIf( conditionFn, hookFn ) { (function() { - var a, reliableHiddenOffsetsVal, boxSizingVal, boxSizingReliableVal, - pixelPositionVal, reliableMarginRightVal, - div = document.createElement( "div" ), - containerStyles = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px", - divReset = - "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;" + - "display:block;padding:0;margin:0;border:0"; + // Minified: var b,c,d,e,f,g, h,i + var div, style, a, pixelPositionVal, boxSizingReliableVal, + reliableHiddenOffsetsVal, reliableMarginRightVal; // Setup + div = document.createElement( "div" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName( "a" )[ 0 ]; + style = a && a.style; - a.style.cssText = "float:left;opacity:.5"; + // Finish early in limited (non-browser) environments + if ( !style ) { + return; + } - // 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 ); + style.cssText = "float:left;opacity:.5"; + + // Support: IE<9 + // Make sure that element opacity exists (as opposed to filter) + support.opacity = style.opacity === "0.5"; // Verify style float existence // (IE uses styleFloat instead of cssFloat) - support.cssFloat = !!a.style.cssFloat; + support.cssFloat = !!style.cssFloat; div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; - // Null elements to avoid leaks in IE. - a = div = null; + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" || + style.WebkitBoxSizing === ""; jQuery.extend(support, { reliableHiddenOffsets: function() { - if ( reliableHiddenOffsetsVal != null ) { - return reliableHiddenOffsetsVal; - } - - var container, tds, isSupported, - div = document.createElement( "div" ), - body = document.getElementsByTagName( "body" )[ 0 ]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - - container = document.createElement( "div" ); - container.style.cssText = containerStyles; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // 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). - div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName( "td" ); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - reliableHiddenOffsetsVal = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - body.removeChild( container ); - - // Null elements to avoid leaks in IE. - div = body = null; - - return reliableHiddenOffsetsVal; - }, - - boxSizing: function() { - if ( boxSizingVal == null ) { + if ( reliableHiddenOffsetsVal == null ) { computeStyleTests(); } - return boxSizingVal; + return reliableHiddenOffsetsVal; }, boxSizingReliable: function() { @@ -6344,84 +6303,86 @@ function addGetHookIf( conditionFn, hookFn ) { return pixelPositionVal; }, + // Support: Android 2.3 reliableMarginRight: function() { - var body, container, div, marginDiv; - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( reliableMarginRightVal == null && window.getComputedStyle ) { - body = document.getElementsByTagName( "body" )[ 0 ]; - if ( !body ) { - // Test fired too early or in an unsupported environment, exit. - return; - } - - container = document.createElement( "div" ); - div = document.createElement( "div" ); - container.style.cssText = containerStyles; - - body.appendChild( container ).appendChild( div ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement( "div" ) ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - reliableMarginRightVal = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - - body.removeChild( container ); + if ( reliableMarginRightVal == null ) { + computeStyleTests(); } - return reliableMarginRightVal; } }); function computeStyleTests() { - var container, div, - body = document.getElementsByTagName( "body" )[ 0 ]; + // Minified: var b,c,d,j + var div, body, container, contents; - if ( !body ) { + body = document.getElementsByTagName( "body" )[ 0 ]; + if ( !body || !body.style ) { // Test fired too early or in an unsupported environment, exit. return; } - container = document.createElement( "div" ); + // Setup div = document.createElement( "div" ); - container.style.cssText = containerStyles; - + container = document.createElement( "div" ); + container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; body.appendChild( container ).appendChild( div ); div.style.cssText = - "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;" + - "position:absolute;display:block;padding:1px;border:1px;width:4px;" + - "margin-top:1%;top:1%"; - - // 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() { - boxSizingVal = div.offsetWidth === 4; - }); + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" + + "box-sizing:border-box;display:block;margin-top:1%;top:1%;" + + "border:1px;padding:1px;width:4px;position:absolute"; - // Will be changed later if needed. - boxSizingReliableVal = true; - pixelPositionVal = false; + // Support: IE<9 + // Assume reasonable values in the absence of getComputedStyle + pixelPositionVal = boxSizingReliableVal = false; reliableMarginRightVal = true; - // Use window.getComputedStyle because jsdom on node.js will break without it. + // Check for getComputedStyle so that this code is not run in IE<9. if ( window.getComputedStyle ) { pixelPositionVal = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; boxSizingReliableVal = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Support: Android 2.3 + // 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 + contents = div.appendChild( document.createElement( "div" ) ); + + // Reset CSS: box-sizing; display; margin; border; padding + contents.style.cssText = div.style.cssText = + // Support: Firefox<29, Android 2.3 + // Vendor-prefix box-sizing + "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + + "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; + contents.style.marginRight = contents.style.width = "0"; + div.style.width = "1px"; + + reliableMarginRightVal = + !parseFloat( ( window.getComputedStyle( contents, null ) || {} ).marginRight ); + } + + // Support: IE8 + // 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). + div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; + contents = div.getElementsByTagName( "td" ); + contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; + reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; + if ( reliableHiddenOffsetsVal ) { + contents[ 0 ].style.display = ""; + contents[ 1 ].style.display = "none"; + reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; } body.removeChild( container ); - - // Null elements to avoid leaks in IE. - div = body = null; } })(); @@ -6461,8 +6422,8 @@ var cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 + letterSpacing: "0", + fontWeight: "400" }, cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; @@ -6519,13 +6480,10 @@ function showHide( elements, show ) { values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) ); } } else { + hidden = isHidden( elem ); - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); } } } @@ -6598,7 +6556,7 @@ function getWidthOrHeight( elem, name, extra ) { var valueIsBorderBox = true, val = name === "width" ? elem.offsetWidth : elem.offsetHeight, styles = getStyles( elem ), - isBorderBox = support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 @@ -6654,6 +6612,8 @@ jQuery.extend({ cssNumber: { "columnCount": true, "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, "fontWeight": true, "lineHeight": true, "opacity": true, @@ -6722,9 +6682,6 @@ jQuery.extend({ // Support: IE // Swallow errors from 'invalid' CSS values (#5509) try { - // Support: Chrome, Safari - // Setting style to blank string required to delete "style: x !important;" - style[ name ] = ""; style[ name ] = value; } catch(e) {} } @@ -6781,7 +6738,7 @@ jQuery.each([ "height", "width" ], function( i, name ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this - return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }) : @@ -6796,7 +6753,7 @@ jQuery.each([ "height", "width" ], function( i, name ) { elem, name, extra, - support.boxSizing() && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", styles ) : 0 ); @@ -7145,7 +7102,7 @@ function createTween( value, prop, animation ) { function defaultPrefilter( elem, props, opts ) { /* jshint validthis: true */ - var prop, value, toggle, tween, hooks, oldfire, display, dDisplay, + var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, @@ -7189,16 +7146,16 @@ function defaultPrefilter( elem, props, opts ) { // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated display = jQuery.css( elem, "display" ); - dDisplay = defaultDisplay( elem.nodeName ); - if ( display === "none" ) { - display = dDisplay; - } - if ( display === "inline" && - jQuery.css( elem, "float" ) === "none" ) { + + // Test default display if display is currently "none" + checkDisplay = display === "none" ? + jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; + + if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout - if ( !support.inlineBlockNeedsLayout || dDisplay === "inline" ) { + if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; @@ -7233,6 +7190,10 @@ function defaultPrefilter( elem, props, opts ) { } } orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + + // Any non-fx value stops us from restoring the original display value + } else { + display = undefined; } } @@ -7274,6 +7235,10 @@ function defaultPrefilter( elem, props, opts ) { } } } + + // If this is a noop like .hide().hide(), restore an overwritten display value + } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { + style.display = display; } } @@ -7690,10 +7655,11 @@ jQuery.fn.delay = function( time, type ) { (function() { - var a, input, select, opt, - div = document.createElement("div" ); + // Minified: var a,b,c,d,e + var input, div, select, a, opt; // Setup + div = document.createElement( "div" ); div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; a = div.getElementsByTagName("a")[ 0 ]; @@ -7741,9 +7707,6 @@ jQuery.fn.delay = function( time, type ) { input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; - - // Null elements to avoid leaks in IE. - a = input = select = opt = div = null; })(); @@ -7817,7 +7780,9 @@ jQuery.extend({ var val = jQuery.find.attr( elem, "value" ); return val != null ? val : - jQuery.text( elem ); + // Support: IE10-11+ + // option.text throws exceptions (#14686, #14858) + jQuery.trim( jQuery.text( elem ) ); } }, select: { @@ -9981,7 +9946,7 @@ jQuery.fn.load = function( url, params, callback ) { off = url.indexOf(" "); if ( off >= 0 ) { - selector = url.slice( off, url.length ); + selector = jQuery.trim( url.slice( off, url.length ) ); url = url.slice( 0, off ); } @@ -10294,6 +10259,12 @@ jQuery.fn.andSelf = jQuery.fn.addBack; // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. + +// Note that for maximum portability, libraries that are not jQuery should +// declare themselves as anonymous modules, and avoid setting a global if an +// AMD loader is present. jQuery is a special case. For more information, see +// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon + if ( typeof define === "function" && define.amd ) { define( "jquery", [], function() { return jQuery; |