From 2fcd7e7d71f6e7c189362a99b558fa43ba7ab0bf Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 10 Jul 2013 08:04:14 +0000 Subject: [PATCH] chore(dom) jquery: v2.0.0 -> v2.0.3 --- ChangeLog | 2 + lib/client/dom.js | 2 +- lib/client/jquery.js | 820 +++++++++++++++++++++++-------------------- 3 files changed, 450 insertions(+), 374 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d48b7d8..b13448d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -100,6 +100,8 @@ getJSONfromFileTable. * feature(edit) add diff +* chore(dom) jquery: v2.0.0 -> v2.0.3 + 2012.04.22, v0.2.0 diff --git a/lib/client/dom.js b/lib/client/dom.js index f6256335..879bab85 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -942,7 +942,7 @@ var CloudCmd, Util, DOM, CloudFunc; if (!pParams) pParams = {}; /* загружаем jquery: */ - Loader.jsload('//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js',{ + Loader.jsload('//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js',{ onload : Util.retExec(pParams.onload), onerror : Util.retExec(pParams.onerror) }); diff --git a/lib/client/jquery.js b/lib/client/jquery.js index e79cee49..2f7e0914 100644 --- a/lib/client/jquery.js +++ b/lib/client/jquery.js @@ -1,5 +1,5 @@ /*! - * jQuery JavaScript Library v2.0.0 + * jQuery JavaScript Library v2.0.3 * http://jquery.com/ * * Includes Sizzle.js @@ -9,7 +9,7 @@ * Released under the MIT license * http://jquery.org/license * - * Date: 2013-04-18 + * Date: 2013-07-03T13:30Z */ (function( window, undefined ) { @@ -46,7 +46,7 @@ var // List of deleted data cache ids, so we can reuse them core_deletedIds = [], - core_version = "2.0.0", + core_version = "2.0.3", // Save a reference to some core methods core_concat = core_deletedIds.concat, @@ -72,7 +72,7 @@ var // A simple way to check for HTML strings // Prioritize #id over to avoid XSS via location.hash (#9521) // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, @@ -865,18 +865,19 @@ function isArraylike( obj ) { // All jQuery objects should point back to these rootjQuery = jQuery(document); /*! - * Sizzle CSS Selector Engine v1.9.2-pre + * Sizzle CSS Selector Engine v1.9.4-pre * http://sizzlejs.com/ * * Copyright 2013 jQuery Foundation, Inc. and other contributors * Released under the MIT license * http://jquery.org/license * - * Date: 2013-04-16 + * Date: 2013-06-03 */ (function( window, undefined ) { var i, + support, cachedruns, Expr, getText, @@ -898,20 +899,26 @@ var i, // Instance-specific data expando = "sizzle" + -(new Date()), preferredDoc = window.document, - support = {}, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), hasDuplicate = false, - sortOrder = function() { return 0; }, + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + return 0; + } + return 0; + }, // General-purpose constants strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, - // Array methods + // Instance methods + hasOwn = ({}).hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, @@ -976,7 +983,7 @@ var i, "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "boolean": new RegExp( "^(?:" + booleans + ")$", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + @@ -994,11 +1001,13 @@ var i, rescape = /'|\\/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, - funescape = function( _, escaped ) { + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint - return high !== high ? + // Support: Firefox + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? escaped : // BMP codepoint high < 0 ? @@ -1036,63 +1045,6 @@ try { }; } -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var cache, - keys = []; - - return (cache = function( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - }); -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return !!fn( div ); - } catch (e) { - return false; - } finally { - if ( div.parentNode ) { - div.parentNode.removeChild( div ); - } - // release memory in IE - div = null; - } -} - function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars @@ -1202,6 +1154,143 @@ function Sizzle( selector, context, results, seed ) { return select( selector.replace( rtrim, "$1" ), context, results, seed ); } +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return !!fn( div ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( div.parentNode ) { + div.parentNode.removeChild( div ); + } + // release memory in IE + div = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = attrs.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + ( ~b.sourceIndex || MAX_NEGATIVE ) - + ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + /** * Detect xml * @param {Element|Object} elem An element or a document @@ -1213,13 +1302,17 @@ isXML = Sizzle.isXML = function( elem ) { return documentElement ? documentElement.nodeName !== "HTML" : false; }; +// Expose support vars for convenience +support = Sizzle.support = {}; + /** * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc; + var doc = node ? node.ownerDocument || node : preferredDoc, + parent = doc.defaultView; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { @@ -1233,11 +1326,18 @@ setDocument = Sizzle.setDocument = function( node ) { // Support tests documentIsHTML = !isXML( doc ); - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").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.attachEvent && parent !== parent.top ) { + parent.attachEvent( "onbeforeunload", function() { + setDocument(); + }); + } + + /* Attributes + ---------------------------------------------------------------------- */ // Support: IE<8 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans) @@ -1246,6 +1346,15 @@ setDocument = Sizzle.setDocument = function( node ) { return !div.getAttribute("className"); }); + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + // Check if getElementsByClassName can be trusted support.getElementsByClassName = assert(function( div ) { div.innerHTML = "
"; @@ -1258,19 +1367,9 @@ setDocument = Sizzle.setDocument = function( node ) { return div.getElementsByClassName("i").length === 2; }); - // 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<10 // Check if getElementById returns elements by name - // Support: Windows 8 Native Apps - // Assigning innerHTML with "name" attributes throws uncatchable exceptions - // (http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx) - // and the broken getElementById methods don't pick up programatically-set names, + // 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; @@ -1294,17 +1393,10 @@ setDocument = Sizzle.setDocument = function( node ) { }; }; } else { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && documentIsHTML ) { - var m = context.getElementById( id ); + // Support: IE6/7 + // getElementById is not reliable as a find shortcut + delete Expr.find["ID"]; - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { @@ -1347,6 +1439,9 @@ setDocument = Sizzle.setDocument = function( node ) { } }; + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) @@ -1359,7 +1454,7 @@ setDocument = Sizzle.setDocument = function( node ) { // See http://bugs.jquery.com/ticket/13378 rbuggyQSA = []; - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { @@ -1391,7 +1486,7 @@ setDocument = Sizzle.setDocument = function( node ) { // Should not select anything // Support: Windows 8 Native Apps // The type attribute is restricted during .innerHTML assignment - var input = document.createElement("input"); + var input = doc.createElement("input"); input.setAttribute( "type", "hidden" ); div.appendChild( input ).setAttribute( "t", "" ); @@ -1411,7 +1506,7 @@ setDocument = Sizzle.setDocument = function( node ) { }); } - if ( (support.matchesSelector = isNative( (matches = docElem.webkitMatchesSelector || + if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { @@ -1431,10 +1526,13 @@ setDocument = Sizzle.setDocument = function( node ) { rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); + /* Contains + ---------------------------------------------------------------------- */ + // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + contains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; @@ -1455,6 +1553,9 @@ setDocument = Sizzle.setDocument = function( node ) { return false; }; + /* Sorting + ---------------------------------------------------------------------- */ + // Document order sorting sortOrder = docElem.compareDocumentPosition ? function( a, b ) { @@ -1545,7 +1646,7 @@ setDocument = Sizzle.setDocument = function( node ) { 0; }; - return document; + return doc; }; Sizzle.matches = function( expr, elements ) { @@ -1561,10 +1662,9 @@ Sizzle.matchesSelector = function( elem, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); - // rbuggyQSA always contains :focus, so no need for an existence check if ( support.matchesSelector && documentIsHTML && - (!rbuggyMatches || !rbuggyMatches.test(expr)) && - (!rbuggyQSA || !rbuggyQSA.test(expr)) ) { + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); @@ -1597,7 +1697,10 @@ Sizzle.attr = function( elem, name ) { } var fn = Expr.attrHandle[ name.toLowerCase() ], - val = fn && fn( elem, name, !documentIsHTML ); + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; return val === undefined ? support.attributes || !documentIsHTML ? @@ -1612,7 +1715,10 @@ Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; -// Document sorting and removing duplicates +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], @@ -1638,87 +1744,6 @@ Sizzle.uniqueSort = function( results ) { return results; }; -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns Returns -1 if a precedes b, 1 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -// Fetches boolean attributes by node -function boolHandler( elem, name, isXML ) { - var val; - return isXML ? - undefined : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - elem[ name ] === true ? name.toLowerCase() : null; -} - -// Fetches attributes without interpolation -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -function interpolationHandler( elem, name, isXML ) { - var val; - return isXML ? - undefined : - (val = elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 )); -} - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem @@ -1829,7 +1854,7 @@ Expr = Sizzle.selectors = { } // Accept quoted arguments as-is - if ( match[4] ) { + if ( match[3] && match[4] !== undefined ) { match[2] = match[4]; // Strip excess characters from unquoted arguments @@ -2220,6 +2245,8 @@ Expr = Sizzle.selectors = { } }; +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); @@ -2228,6 +2255,11 @@ for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, @@ -2257,11 +2289,11 @@ function tokenize( selector, parseOnly ) { // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); - tokens.push( { + tokens.push({ value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) - } ); + }); soFar = soFar.slice( matched.length ); } @@ -2270,11 +2302,11 @@ function tokenize( selector, parseOnly ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); - tokens.push( { + tokens.push({ value: matched, type: type, matches: match - } ); + }); soFar = soFar.slice( matched.length ); } } @@ -2521,7 +2553,10 @@ function matcherFromTokens( tokens ) { } return setMatcher( i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + i > 1 && toSelector( + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) + ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), @@ -2683,14 +2718,13 @@ function select( selector, context, results, seed ) { // 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" && - context.nodeType === 9 && documentIsHTML && + 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 ); } @@ -2737,51 +2771,67 @@ function select( selector, context, results, seed ) { return results; } -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - // One-time assignments // Sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; +// Support: Chrome<14 +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = hasDuplicate; + // Initialize against the default document setDocument(); -// Support: Chrome<<14 -// Always assume duplicates if they aren't passed to the comparison function -[0, 0].sort( sortOrder ); -support.detectDuplicates = hasDuplicate; +// 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" -assert(function( div ) { +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert(function( div ) { div.innerHTML = ""; - if ( div.firstChild.getAttribute("href") !== "#" ) { - var attrs = "type|href|height|width".split("|"), - i = attrs.length; - while ( i-- ) { - Expr.attrHandle[ attrs[i] ] = interpolationHandler; + return div.firstChild.getAttribute("href") === "#" ; +}) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); } - } -}); + }); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert(function( div ) { + div.innerHTML = ""; + div.firstChild.setAttribute( "value", "" ); + return div.firstChild.getAttribute( "value" ) === ""; +}) ) { + addHandle( "value", function( elem, name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + }); +} // Support: IE<9 // Use getAttributeNode to fetch booleans when getAttribute lies -assert(function( div ) { - if ( div.getAttribute("disabled") != null ) { - var attrs = booleans.split("|"), - i = attrs.length; - while ( i-- ) { - Expr.attrHandle[ attrs[i] ] = boolHandler; +if ( !assert(function( div ) { + return div.getAttribute("disabled") == null; +}) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return (val = elem.getAttributeNode( name )) && val.specified ? + val.value : + elem[ name ] === true ? name.toLowerCase() : null; } - } -}); + }); +} jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; @@ -2966,9 +3016,9 @@ jQuery.Callbacks = function( options ) { }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; if ( firing ) { stack.push( args ); } else { @@ -3336,13 +3386,9 @@ Data.prototype = { // Handle: [ owner, { properties } ] args } else { - // Support an expectation from the old data system where plain - // objects used to initialize would be set to the cache by - // reference, instead of having properties and values copied. - // Note, this will kill the connection between - // "this.cache[ unlock ]" and "cache" + // Fresh assignments by object are shallow copied if ( jQuery.isEmptyObject( cache ) ) { - this.cache[ unlock ] = data; + jQuery.extend( this.cache[ unlock ], data ); // Otherwise, copy the properties one-by-one to the cache object } else { for ( prop in data ) { @@ -3350,6 +3396,7 @@ Data.prototype = { } } } + return cache; }, get: function( owner, key ) { // Either a valid cache is found, or will be created. @@ -3362,6 +3409,7 @@ Data.prototype = { cache : cache[ key ]; }, access: function( owner, key, value ) { + var stored; // In cases where either: // // 1. No key was specified @@ -3375,7 +3423,11 @@ Data.prototype = { // if ( key === undefined || ((key && typeof key === "string") && value === undefined) ) { - return this.get( owner, key ); + + stored = this.get( owner, key ); + + return stored !== undefined ? + stored : this.get( owner, jQuery.camelCase(key) ); } // [*]When the key is not a string, or both a key and value @@ -3391,7 +3443,7 @@ Data.prototype = { return value !== undefined ? value : key; }, remove: function( owner, key ) { - var i, name, + var i, name, camel, unlock = this.key( owner ), cache = this.cache[ unlock ]; @@ -3409,13 +3461,14 @@ Data.prototype = { // This will only penalize the array argument path. name = key.concat( key.map( jQuery.camelCase ) ); } else { + camel = jQuery.camelCase( key ); // Try the string as a key before any manipulation if ( key in cache ) { - name = [ key ]; + name = [ key, camel ]; } else { // If a key with the spaces exists, use it. // Otherwise, create an array by matching non-whitespace - name = jQuery.camelCase( key ); + name = camel; name = name in cache ? [ name ] : ( name.match( core_rnotwhite ) || [] ); } @@ -3433,7 +3486,9 @@ Data.prototype = { ); }, discard: function( owner ) { - delete this.cache[ this.key( owner ) ]; + if ( owner[ this.expando ] ) { + delete this.cache[ owner[ this.expando ] ]; + } } }; @@ -3486,7 +3541,7 @@ jQuery.fn.extend({ name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); + name = jQuery.camelCase( name.slice(5) ); dataAttr( elem, name, data[ name ] ); } } @@ -3632,7 +3687,6 @@ jQuery.extend({ startLength--; } - hooks.cur = fn; if ( fn ) { // Add a progress sentinel to prevent the fx queue from being @@ -3742,7 +3796,7 @@ jQuery.fn.extend({ } }); var nodeHook, boolHook, - rclass = /[\t\r\n]/g, + rclass = /[\t\r\n\f]/g, rreturn = /\r/g, rfocusable = /^(?:input|select|textarea|button)$/i; @@ -3845,8 +3899,11 @@ jQuery.fn.extend({ }, toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; + var type = typeof value; + + if ( typeof stateVal === "boolean" && type === "string" ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { @@ -3860,13 +3917,15 @@ jQuery.fn.extend({ var className, i = 0, self = jQuery( this ), - state = stateVal, classNames = value.match( core_rnotwhite ) || []; while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } } // Toggle whole class name @@ -3925,15 +3984,14 @@ jQuery.fn.extend({ isFunction = jQuery.isFunction( value ); return this.each(function( i ) { - var val, - self = jQuery(this); + var val; if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { - val = value.call( this, i, self.val() ); + val = value.call( this, i, jQuery( this ).val() ); } else { val = value; } @@ -4048,7 +4106,7 @@ jQuery.extend({ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || - ( jQuery.expr.match.boolean.test( name ) ? boolHook : nodeHook ); + ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { @@ -4087,7 +4145,7 @@ jQuery.extend({ propName = jQuery.propFix[ name ] || name; // Boolean attributes get special treatment (#10870) - if ( jQuery.expr.match.boolean.test( name ) ) { + if ( jQuery.expr.match.bool.test( name ) ) { // Set corresponding property to false elem[ propName ] = false; } @@ -4171,7 +4229,7 @@ boolHook = { return name; } }; -jQuery.each( jQuery.expr.match.boolean.source.match( /\w+/g ), function( i, name ) { +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr; jQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) { @@ -4752,6 +4810,12 @@ jQuery.event = { event[ prop ] = originalEvent[ prop ]; } + // Support: Cordova 2.5 (WebKit) (#13255) + // All events should have a target; Cordova deviceready doesn't + if ( !event.target ) { + event.target = document; + } + // Support: Safari 6.0+, Chrome < 28 // Target should not be a text node (#504, #13143) if ( event.target.nodeType === 3 ) { @@ -5063,6 +5127,7 @@ jQuery.fn.extend({ } }); var isSimple = /^.[^:#\[\.,]*$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { @@ -5074,13 +5139,14 @@ var isSimple = /^.[^:#\[\.,]*$/, jQuery.fn.extend({ find: function( selector ) { - var self, matched, i, - l = this.length; + var i, + ret = [], + self = this, + len = self.length; if ( typeof selector !== "string" ) { - self = this; return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < l; i++ ) { + for ( i = 0; i < len; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } @@ -5088,15 +5154,14 @@ jQuery.fn.extend({ }) ); } - matched = []; - for ( i = 0; i < l; i++ ) { - jQuery.find( selector, this[ i ], matched ); + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); } // Needed because $( selector, context ) becomes $( context ).find( selector ) - matched = this.pushStack( l > 1 ? jQuery.unique( matched ) : matched ); - matched.selector = ( this.selector ? this.selector + " " : "" ) + selector; - return matched; + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = this.selector ? this.selector + " " + selector : selector; + return ret; }, has: function( target ) { @@ -5122,14 +5187,16 @@ jQuery.fn.extend({ }, is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[ 0 ] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; }, closest: function( selectors, context ) { @@ -5240,9 +5307,7 @@ jQuery.each({ return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); + return elem.contentDocument || jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { @@ -5262,8 +5327,8 @@ jQuery.each({ jQuery.unique( matched ); } - // Reverse order for parents* and prev* - if ( name[ 0 ] === "p" ) { + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { matched.reverse(); } } @@ -5362,6 +5427,7 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^> option: [ 1, "" ], thead: [ 1, "", "
" ], + col: [ 2, "", "
" ], tr: [ 2, "", "
" ], td: [ 3, "", "
" ], @@ -5371,7 +5437,7 @@ var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^> // Support: IE 9 wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.col = wrapMap.thead; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; jQuery.fn.extend({ @@ -5519,6 +5585,10 @@ jQuery.fn.extend({ parent = args[ i++ ]; if ( parent ) { + // Don't use the snapshot next if it has moved (#13810) + if ( next && next.parentNode !== parent ) { + next = this.nextSibling; + } jQuery( this ).remove(); parent.insertBefore( elem, next ); } @@ -5720,7 +5790,7 @@ jQuery.extend({ // Descend through wrappers to the right content j = wrap[ 0 ]; while ( j-- ) { - tmp = tmp.firstChild; + tmp = tmp.lastChild; } // Support: QtWebKit @@ -5774,35 +5844,35 @@ jQuery.extend({ }, cleanData: function( elems ) { - var data, elem, type, - l = elems.length, - i = 0, - special = jQuery.event.special; + var data, elem, events, type, key, j, + special = jQuery.event.special, + i = 0; - for ( ; i < l; i++ ) { - elem = elems[ i ]; + for ( ; (elem = elems[ i ]) !== undefined; i++ ) { + if ( Data.accepts( elem ) ) { + key = elem[ data_priv.expando ]; - if ( jQuery.acceptData( elem ) ) { + if ( key && (data = data_priv.cache[ key ]) ) { + events = Object.keys( data.events || {} ); + if ( events.length ) { + for ( j = 0; (type = events[j]) !== undefined; j++ ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); - data = data_priv.access( elem ); - - if ( data ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } } } + if ( data_priv.cache[ key ] ) { + // Discard any remaining `private` data + delete data_priv.cache[ key ]; + } } } - // Discard any remaining `private` and `user` data - // One day we'll replace the dual arrays with a WeakMap and this won't be an issue. - // (Splices the data objects out of the internal cache arrays) - data_user.discard( elem ); - data_priv.discard( elem ); + // Discard any remaining `user` data + delete data_user.cache[ elem[ data_user.expando ] ]; } }, @@ -5810,10 +5880,10 @@ jQuery.extend({ return jQuery.ajax({ url: url, type: "GET", - dataType: "text", + dataType: "script", async: false, global: false, - success: jQuery.globalEval + "throws": true }); } }); @@ -5868,11 +5938,9 @@ function cloneCopyEvent( src, dest ) { // 1. Copy private data: events, handlers, etc. if ( data_priv.hasData( src ) ) { pdataOld = data_priv.access( src ); - pdataCur = jQuery.extend( {}, pdataOld ); + pdataCur = data_priv.set( dest, pdataOld ); events = pdataOld.events; - data_priv.set( dest, pdataCur ); - if ( events ) { delete pdataCur.handle; pdataCur.events = {}; @@ -6126,10 +6194,12 @@ jQuery.fn.extend({ return showHide( this ); }, toggle: function( state ) { - var bool = typeof state === "boolean"; + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } return this.each(function() { - if ( bool ? state : isHidden( this ) ) { + if ( isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); @@ -6153,13 +6223,14 @@ jQuery.extend({ } }, - // Exclude the following css properties to add px + // Don't automatically add "px" to these possibly-unitless properties cssNumber: { "columnCount": true, "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, + "order": true, "orphans": true, "widows": true, "zIndex": true, @@ -7294,7 +7365,7 @@ jQuery.extend({ } // if no content - if ( status === 204 ) { + if ( status === 204 || s.type === "HEAD" ) { statusText = "nocontent"; // if not modified @@ -7788,44 +7859,51 @@ var fxNow, timerId, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), + var tween = this.createTween( prop, value ), target = tween.cur(), - start = +target || 0, + parts = rfxnum.exec( value ), + unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) && + rfxnum.exec( jQuery.css( tween.elem, prop ) ), scale = 1, maxIterations = 20; - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + if ( start && start[ 3 ] !== unit ) { + // Trust units reported by jQuery.css + unit = unit || start[ 3 ]; - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; + // Make sure we update the tween properties later on + parts = parts || []; - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; + // Iteratively approximate from a nonzero starting point + start = +target || 1; - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); + do { + // If previous iteration zeroed out, double until we get *something* + // Use a string for doubling factor so we don't accidentally see scale as unchanged below + scale = scale || ".5"; - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } + // Adjust and apply + start = start / scale; + jQuery.style( tween.elem, prop, start + unit ); - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; + // Update scale, tolerating zero or NaN from tween.cur() + // And breaking the loop if scale is unchanged or perfect, or if we've just had enough + } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } + + // Update tween properties + if ( parts ) { + start = tween.start = +start || +target || 0; + tween.unit = unit; + // If a +=/-= token was provided, we're doing a relative animation + tween.end = parts[ 1 ] ? + start + ( parts[ 1 ] + 1 ) * parts[ 2 ] : + +parts[ 2 ]; + } + return tween; }] }; @@ -7838,19 +7916,18 @@ function createFxNow() { return ( fxNow = jQuery.now() ); } -function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { +function createTween( value, prop, animation ) { + var tween, + collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( (tween = collection[ index ].call( animation, prop, value )) ) { - // we're done with this property - return; - } + // we're done with this property + return tween; } - }); + } } function Animation( elem, properties, options ) { @@ -7936,7 +8013,7 @@ function Animation( elem, properties, options ) { } } - createTweens( animation, props ); + jQuery.map( props, createTween, animation ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); @@ -8026,12 +8103,12 @@ jQuery.Animation = jQuery.extend( Animation, { function defaultPrefilter( elem, props, opts ) { /* jshint validthis: true */ - var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, + var prop, value, toggle, tween, hooks, oldfire, anim = this, - style = elem.style, orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); + style = elem.style, + hidden = elem.nodeType && isHidden( elem ), + dataShow = data_priv.get( elem, "fxshow" ); // handle queue: false promises if ( !opts.queue ) { @@ -8087,30 +8164,31 @@ function defaultPrefilter( elem, props, opts ) { // show/hide pass - dataShow = data_priv.get( elem, "fxshow" ); - for ( index in props ) { - value = props[ index ]; + for ( prop in props ) { + value = props[ prop ]; if ( rfxtypes.exec( value ) ) { - delete props[ index ]; + delete props[ prop ]; toggle = toggle || value === "toggle"; if ( value === ( hidden ? "hide" : "show" ) ) { // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden - if( value === "show" && dataShow !== undefined && dataShow[ index ] !== undefined ) { + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { hidden = true; } else { continue; } } - handled.push( index ); + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); } } - length = handled.length; - if ( length ) { - dataShow = data_priv.get( elem, "fxshow" ) || data_priv.access( elem, "fxshow", {} ); - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; + if ( !jQuery.isEmptyObject( orig ) ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = data_priv.access( elem, "fxshow", {} ); } // store state if its toggle - enables .stop().toggle() to "reverse" @@ -8132,10 +8210,8 @@ function defaultPrefilter( elem, props, opts ) { jQuery.style( elem, prop, orig[ prop ] ); } }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); + for ( prop in orig ) { + tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; @@ -8266,9 +8342,7 @@ jQuery.fn.extend({ doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - doAnimation.finish = function() { - anim.stop( true ); - }; + // Empty animations, or finishing resolves immediately if ( empty || data_priv.get( this, "finish" ) ) { anim.stop( true ); @@ -8348,8 +8422,8 @@ jQuery.fn.extend({ // empty the queue first jQuery.queue( this, type, [] ); - if ( hooks && hooks.cur && hooks.cur.finish ) { - hooks.cur.finish.call( this ); + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); } // look for any active animations, and finish them @@ -8727,7 +8801,7 @@ jQuery.fn.size = function() { jQuery.fn.andSelf = jQuery.fn.addBack; // })(); -if ( typeof module === "object" && typeof module.exports === "object" ) { +if ( typeof module === "object" && module && typeof module.exports === "object" ) { // Expose jQuery as module.exports in loaders that implement the Node // module pattern (including browserify). Do not create the global, since // the user will be storing it themselves locally, and globals are frowned @@ -8752,4 +8826,4 @@ if ( typeof window === "object" && typeof window.document === "object" ) { window.jQuery = window.$ = jQuery; } -})( window ); \ No newline at end of file +})( window );