b@1605: /*! b@1605: * jQuery JavaScript Library v2.1.4 b@1605: * http://jquery.com/ b@1605: * b@1605: * Includes Sizzle.js b@1605: * http://sizzlejs.com/ b@1605: * b@1605: * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors b@1605: * Released under the MIT license b@1605: * http://jquery.org/license b@1605: * b@1605: * Date: 2015-04-28T16:01Z b@1605: */ b@1605: b@1605: (function( global, factory ) { b@1605: b@1605: if ( typeof module === "object" && typeof module.exports === "object" ) { b@1605: // For CommonJS and CommonJS-like environments where a proper `window` b@1605: // is present, execute the factory and get jQuery. b@1605: // For environments that do not have a `window` with a `document` b@1605: // (such as Node.js), expose a factory as module.exports. b@1605: // This accentuates the need for the creation of a real `window`. b@1605: // e.g. var jQuery = require("jquery")(window); b@1605: // See ticket #14549 for more info. b@1605: module.exports = global.document ? b@1605: factory( global, true ) : b@1605: function( w ) { b@1605: if ( !w.document ) { b@1605: throw new Error( "jQuery requires a window with a document" ); b@1605: } b@1605: return factory( w ); b@1605: }; b@1605: } else { b@1605: factory( global ); b@1605: } b@1605: b@1605: // Pass this if window is not defined yet b@1605: }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { b@1605: b@1605: // Support: Firefox 18+ b@1605: // Can't be in strict mode, several libs including ASP.NET trace b@1605: // the stack via arguments.caller.callee and Firefox dies if b@1605: // you try to trace through "use strict" call chains. (#13335) b@1605: // b@1605: b@1605: var arr = []; b@1605: b@1605: var slice = arr.slice; b@1605: b@1605: var concat = arr.concat; b@1605: b@1605: var push = arr.push; b@1605: b@1605: var indexOf = arr.indexOf; b@1605: b@1605: var class2type = {}; b@1605: b@1605: var toString = class2type.toString; b@1605: b@1605: var hasOwn = class2type.hasOwnProperty; b@1605: b@1605: var support = {}; b@1605: b@1605: b@1605: b@1605: var b@1605: // Use the correct document accordingly with window argument (sandbox) b@1605: document = window.document, b@1605: b@1605: version = "2.1.4", b@1605: b@1605: // Define a local copy of jQuery b@1605: jQuery = function( selector, context ) { b@1605: // The jQuery object is actually just the init constructor 'enhanced' b@1605: // Need init if jQuery is called (just allow error to be thrown if not included) b@1605: return new jQuery.fn.init( selector, context ); b@1605: }, b@1605: b@1605: // Support: Android<4.1 b@1605: // Make sure we trim BOM and NBSP b@1605: rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, b@1605: b@1605: // Matches dashed string for camelizing b@1605: rmsPrefix = /^-ms-/, b@1605: rdashAlpha = /-([\da-z])/gi, b@1605: b@1605: // Used by jQuery.camelCase as callback to replace() b@1605: fcamelCase = function( all, letter ) { b@1605: return letter.toUpperCase(); b@1605: }; b@1605: b@1605: jQuery.fn = jQuery.prototype = { b@1605: // The current version of jQuery being used b@1605: jquery: version, b@1605: b@1605: constructor: jQuery, b@1605: b@1605: // Start with an empty selector b@1605: selector: "", b@1605: b@1605: // The default length of a jQuery object is 0 b@1605: length: 0, b@1605: b@1605: toArray: function() { b@1605: return slice.call( this ); b@1605: }, b@1605: b@1605: // Get the Nth element in the matched element set OR b@1605: // Get the whole matched element set as a clean array b@1605: get: function( num ) { b@1605: return num != null ? b@1605: b@1605: // Return just the one element from the set b@1605: ( num < 0 ? this[ num + this.length ] : this[ num ] ) : b@1605: b@1605: // Return all the elements in a clean array b@1605: slice.call( this ); b@1605: }, b@1605: b@1605: // Take an array of elements and push it onto the stack b@1605: // (returning the new matched element set) b@1605: pushStack: function( elems ) { b@1605: b@1605: // Build a new jQuery matched element set b@1605: var ret = jQuery.merge( this.constructor(), elems ); b@1605: b@1605: // Add the old object onto the stack (as a reference) b@1605: ret.prevObject = this; b@1605: ret.context = this.context; b@1605: b@1605: // Return the newly-formed element set b@1605: return ret; b@1605: }, b@1605: b@1605: // Execute a callback for every element in the matched set. b@1605: // (You can seed the arguments with an array of args, but this is b@1605: // only used internally.) b@1605: each: function( callback, args ) { b@1605: return jQuery.each( this, callback, args ); b@1605: }, b@1605: b@1605: map: function( callback ) { b@1605: return this.pushStack( jQuery.map(this, function( elem, i ) { b@1605: return callback.call( elem, i, elem ); b@1605: })); b@1605: }, b@1605: b@1605: slice: function() { b@1605: return this.pushStack( slice.apply( this, arguments ) ); b@1605: }, b@1605: b@1605: first: function() { b@1605: return this.eq( 0 ); b@1605: }, b@1605: b@1605: last: function() { b@1605: return this.eq( -1 ); b@1605: }, b@1605: b@1605: eq: function( i ) { b@1605: var len = this.length, b@1605: j = +i + ( i < 0 ? len : 0 ); b@1605: return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); b@1605: }, b@1605: b@1605: end: function() { b@1605: return this.prevObject || this.constructor(null); b@1605: }, b@1605: b@1605: // For internal use only. b@1605: // Behaves like an Array's method, not like a jQuery method. b@1605: push: push, b@1605: sort: arr.sort, b@1605: splice: arr.splice b@1605: }; b@1605: b@1605: jQuery.extend = jQuery.fn.extend = function() { b@1605: var options, name, src, copy, copyIsArray, clone, b@1605: target = arguments[0] || {}, b@1605: i = 1, b@1605: length = arguments.length, b@1605: deep = false; b@1605: b@1605: // Handle a deep copy situation b@1605: if ( typeof target === "boolean" ) { b@1605: deep = target; b@1605: b@1605: // Skip the boolean and the target b@1605: target = arguments[ i ] || {}; b@1605: i++; b@1605: } b@1605: b@1605: // Handle case when target is a string or something (possible in deep copy) b@1605: if ( typeof target !== "object" && !jQuery.isFunction(target) ) { b@1605: target = {}; b@1605: } b@1605: b@1605: // Extend jQuery itself if only one argument is passed b@1605: if ( i === length ) { b@1605: target = this; b@1605: i--; b@1605: } b@1605: b@1605: for ( ; i < length; i++ ) { b@1605: // Only deal with non-null/undefined values b@1605: if ( (options = arguments[ i ]) != null ) { b@1605: // Extend the base object b@1605: for ( name in options ) { b@1605: src = target[ name ]; b@1605: copy = options[ name ]; b@1605: b@1605: // Prevent never-ending loop b@1605: if ( target === copy ) { b@1605: continue; b@1605: } b@1605: b@1605: // Recurse if we're merging plain objects or arrays b@1605: if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { b@1605: if ( copyIsArray ) { b@1605: copyIsArray = false; b@1605: clone = src && jQuery.isArray(src) ? src : []; b@1605: b@1605: } else { b@1605: clone = src && jQuery.isPlainObject(src) ? src : {}; b@1605: } b@1605: b@1605: // Never move original objects, clone them b@1605: target[ name ] = jQuery.extend( deep, clone, copy ); b@1605: b@1605: // Don't bring in undefined values b@1605: } else if ( copy !== undefined ) { b@1605: target[ name ] = copy; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Return the modified object b@1605: return target; b@1605: }; b@1605: b@1605: jQuery.extend({ b@1605: // Unique for each copy of jQuery on the page b@1605: expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), b@1605: b@1605: // Assume jQuery is ready without the ready module b@1605: isReady: true, b@1605: b@1605: error: function( msg ) { b@1605: throw new Error( msg ); b@1605: }, b@1605: b@1605: noop: function() {}, b@1605: b@1605: isFunction: function( obj ) { b@1605: return jQuery.type(obj) === "function"; b@1605: }, b@1605: b@1605: isArray: Array.isArray, b@1605: b@1605: isWindow: function( obj ) { b@1605: return obj != null && obj === obj.window; b@1605: }, b@1605: b@1605: isNumeric: function( obj ) { b@1605: // parseFloat NaNs numeric-cast false positives (null|true|false|"") b@1605: // ...but misinterprets leading-number strings, particularly hex literals ("0x...") b@1605: // subtraction forces infinities to NaN b@1605: // adding 1 corrects loss of precision from parseFloat (#15100) b@1605: return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0; b@1605: }, b@1605: b@1605: isPlainObject: function( obj ) { b@1605: // Not plain objects: b@1605: // - Any object or value whose internal [[Class]] property is not "[object Object]" b@1605: // - DOM nodes b@1605: // - window b@1605: if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { b@1605: return false; b@1605: } b@1605: b@1605: if ( obj.constructor && b@1605: !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { b@1605: return false; b@1605: } b@1605: b@1605: // If the function hasn't returned already, we're confident that b@1605: // |obj| is a plain object, created by {} or constructed with new Object b@1605: return true; b@1605: }, b@1605: b@1605: isEmptyObject: function( obj ) { b@1605: var name; b@1605: for ( name in obj ) { b@1605: return false; b@1605: } b@1605: return true; b@1605: }, b@1605: b@1605: type: function( obj ) { b@1605: if ( obj == null ) { b@1605: return obj + ""; b@1605: } b@1605: // Support: Android<4.0, iOS<6 (functionish RegExp) b@1605: return typeof obj === "object" || typeof obj === "function" ? b@1605: class2type[ toString.call(obj) ] || "object" : b@1605: typeof obj; b@1605: }, b@1605: b@1605: // Evaluates a script in a global context b@1605: globalEval: function( code ) { b@1605: var script, b@1605: indirect = eval; b@1605: b@1605: code = jQuery.trim( code ); b@1605: b@1605: if ( code ) { b@1605: // If the code includes a valid, prologue position b@1605: // strict mode pragma, execute code by injecting a b@1605: // script tag into the document. b@1605: if ( code.indexOf("use strict") === 1 ) { b@1605: script = document.createElement("script"); b@1605: script.text = code; b@1605: document.head.appendChild( script ).parentNode.removeChild( script ); b@1605: } else { b@1605: // Otherwise, avoid the DOM node creation, insertion b@1605: // and removal by using an indirect global eval b@1605: indirect( code ); b@1605: } b@1605: } b@1605: }, b@1605: b@1605: // Convert dashed to camelCase; used by the css and data modules b@1605: // Support: IE9-11+ b@1605: // Microsoft forgot to hump their vendor prefix (#9572) b@1605: camelCase: function( string ) { b@1605: return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); b@1605: }, b@1605: b@1605: nodeName: function( elem, name ) { b@1605: return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); b@1605: }, b@1605: b@1605: // args is for internal usage only b@1605: each: function( obj, callback, args ) { b@1605: var value, b@1605: i = 0, b@1605: length = obj.length, b@1605: isArray = isArraylike( obj ); b@1605: b@1605: if ( args ) { b@1605: if ( isArray ) { b@1605: for ( ; i < length; i++ ) { b@1605: value = callback.apply( obj[ i ], args ); b@1605: b@1605: if ( value === false ) { b@1605: break; b@1605: } b@1605: } b@1605: } else { b@1605: for ( i in obj ) { b@1605: value = callback.apply( obj[ i ], args ); b@1605: b@1605: if ( value === false ) { b@1605: break; b@1605: } b@1605: } b@1605: } b@1605: b@1605: // A special, fast, case for the most common use of each b@1605: } else { b@1605: if ( isArray ) { b@1605: for ( ; i < length; i++ ) { b@1605: value = callback.call( obj[ i ], i, obj[ i ] ); b@1605: b@1605: if ( value === false ) { b@1605: break; b@1605: } b@1605: } b@1605: } else { b@1605: for ( i in obj ) { b@1605: value = callback.call( obj[ i ], i, obj[ i ] ); b@1605: b@1605: if ( value === false ) { b@1605: break; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: return obj; b@1605: }, b@1605: b@1605: // Support: Android<4.1 b@1605: trim: function( text ) { b@1605: return text == null ? b@1605: "" : b@1605: ( text + "" ).replace( rtrim, "" ); b@1605: }, b@1605: b@1605: // results is for internal usage only b@1605: makeArray: function( arr, results ) { b@1605: var ret = results || []; b@1605: b@1605: if ( arr != null ) { b@1605: if ( isArraylike( Object(arr) ) ) { b@1605: jQuery.merge( ret, b@1605: typeof arr === "string" ? b@1605: [ arr ] : arr b@1605: ); b@1605: } else { b@1605: push.call( ret, arr ); b@1605: } b@1605: } b@1605: b@1605: return ret; b@1605: }, b@1605: b@1605: inArray: function( elem, arr, i ) { b@1605: return arr == null ? -1 : indexOf.call( arr, elem, i ); b@1605: }, b@1605: b@1605: merge: function( first, second ) { b@1605: var len = +second.length, b@1605: j = 0, b@1605: i = first.length; b@1605: b@1605: for ( ; j < len; j++ ) { b@1605: first[ i++ ] = second[ j ]; b@1605: } b@1605: b@1605: first.length = i; b@1605: b@1605: return first; b@1605: }, b@1605: b@1605: grep: function( elems, callback, invert ) { b@1605: var callbackInverse, b@1605: matches = [], b@1605: i = 0, b@1605: length = elems.length, b@1605: callbackExpect = !invert; b@1605: b@1605: // Go through the array, only saving the items b@1605: // that pass the validator function b@1605: for ( ; i < length; i++ ) { b@1605: callbackInverse = !callback( elems[ i ], i ); b@1605: if ( callbackInverse !== callbackExpect ) { b@1605: matches.push( elems[ i ] ); b@1605: } b@1605: } b@1605: b@1605: return matches; b@1605: }, b@1605: b@1605: // arg is for internal usage only b@1605: map: function( elems, callback, arg ) { b@1605: var value, b@1605: i = 0, b@1605: length = elems.length, b@1605: isArray = isArraylike( elems ), b@1605: ret = []; b@1605: b@1605: // Go through the array, translating each of the items to their new values b@1605: if ( isArray ) { b@1605: for ( ; i < length; i++ ) { b@1605: value = callback( elems[ i ], i, arg ); b@1605: b@1605: if ( value != null ) { b@1605: ret.push( value ); b@1605: } b@1605: } b@1605: b@1605: // Go through every key on the object, b@1605: } else { b@1605: for ( i in elems ) { b@1605: value = callback( elems[ i ], i, arg ); b@1605: b@1605: if ( value != null ) { b@1605: ret.push( value ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Flatten any nested arrays b@1605: return concat.apply( [], ret ); b@1605: }, b@1605: b@1605: // A global GUID counter for objects b@1605: guid: 1, b@1605: b@1605: // Bind a function to a context, optionally partially applying any b@1605: // arguments. b@1605: proxy: function( fn, context ) { b@1605: var tmp, args, proxy; b@1605: b@1605: if ( typeof context === "string" ) { b@1605: tmp = fn[ context ]; b@1605: context = fn; b@1605: fn = tmp; b@1605: } b@1605: b@1605: // Quick check to determine if target is callable, in the spec b@1605: // this throws a TypeError, but we will just return undefined. b@1605: if ( !jQuery.isFunction( fn ) ) { b@1605: return undefined; b@1605: } b@1605: b@1605: // Simulated bind b@1605: args = slice.call( arguments, 2 ); b@1605: proxy = function() { b@1605: return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); b@1605: }; b@1605: b@1605: // Set the guid of unique handler to the same of original handler, so it can be removed b@1605: proxy.guid = fn.guid = fn.guid || jQuery.guid++; b@1605: b@1605: return proxy; b@1605: }, b@1605: b@1605: now: Date.now, b@1605: b@1605: // jQuery.support is not used in Core but other projects attach their b@1605: // properties to it so it needs to exist. b@1605: support: support b@1605: }); b@1605: b@1605: // Populate the class2type map b@1605: jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { b@1605: class2type[ "[object " + name + "]" ] = name.toLowerCase(); b@1605: }); b@1605: b@1605: function isArraylike( obj ) { b@1605: b@1605: // Support: iOS 8.2 (not reproducible in simulator) b@1605: // `in` check used to prevent JIT error (gh-2145) b@1605: // hasOwn isn't used here due to false negatives b@1605: // regarding Nodelist length in IE b@1605: var length = "length" in obj && obj.length, b@1605: type = jQuery.type( obj ); b@1605: b@1605: if ( type === "function" || jQuery.isWindow( obj ) ) { b@1605: return false; b@1605: } b@1605: b@1605: if ( obj.nodeType === 1 && length ) { b@1605: return true; b@1605: } b@1605: b@1605: return type === "array" || length === 0 || b@1605: typeof length === "number" && length > 0 && ( length - 1 ) in obj; b@1605: } b@1605: var Sizzle = b@1605: /*! b@1605: * Sizzle CSS Selector Engine v2.2.0-pre b@1605: * http://sizzlejs.com/ b@1605: * b@1605: * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors b@1605: * Released under the MIT license b@1605: * http://jquery.org/license b@1605: * b@1605: * Date: 2014-12-16 b@1605: */ b@1605: (function( window ) { b@1605: b@1605: var i, b@1605: support, b@1605: Expr, b@1605: getText, b@1605: isXML, b@1605: tokenize, b@1605: compile, b@1605: select, b@1605: outermostContext, b@1605: sortInput, b@1605: hasDuplicate, b@1605: b@1605: // Local document vars b@1605: setDocument, b@1605: document, b@1605: docElem, b@1605: documentIsHTML, b@1605: rbuggyQSA, b@1605: rbuggyMatches, b@1605: matches, b@1605: contains, b@1605: b@1605: // Instance-specific data b@1605: expando = "sizzle" + 1 * new Date(), b@1605: preferredDoc = window.document, b@1605: dirruns = 0, b@1605: done = 0, b@1605: classCache = createCache(), b@1605: tokenCache = createCache(), b@1605: compilerCache = createCache(), b@1605: sortOrder = function( a, b ) { b@1605: if ( a === b ) { b@1605: hasDuplicate = true; b@1605: } b@1605: return 0; b@1605: }, b@1605: b@1605: // General-purpose constants b@1605: MAX_NEGATIVE = 1 << 31, b@1605: b@1605: // Instance methods b@1605: hasOwn = ({}).hasOwnProperty, b@1605: arr = [], b@1605: pop = arr.pop, b@1605: push_native = arr.push, b@1605: push = arr.push, b@1605: slice = arr.slice, b@1605: // Use a stripped-down indexOf as it's faster than native b@1605: // http://jsperf.com/thor-indexof-vs-for/5 b@1605: indexOf = function( list, elem ) { b@1605: var i = 0, b@1605: len = list.length; b@1605: for ( ; i < len; i++ ) { b@1605: if ( list[i] === elem ) { b@1605: return i; b@1605: } b@1605: } b@1605: return -1; b@1605: }, b@1605: b@1605: booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", b@1605: b@1605: // Regular expressions b@1605: b@1605: // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace b@1605: whitespace = "[\\x20\\t\\r\\n\\f]", b@1605: // http://www.w3.org/TR/css3-syntax/#characters b@1605: characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", b@1605: b@1605: // Loosely modeled on CSS identifier characters b@1605: // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors b@1605: // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier b@1605: identifier = characterEncoding.replace( "w", "w#" ), b@1605: b@1605: // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors b@1605: attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace + b@1605: // Operator (capture 2) b@1605: "*([*^$|!~]?=)" + whitespace + b@1605: // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" b@1605: "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + b@1605: "*\\]", b@1605: b@1605: pseudos = ":(" + characterEncoding + ")(?:\\((" + b@1605: // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: b@1605: // 1. quoted (capture 3; capture 4 or capture 5) b@1605: "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + b@1605: // 2. simple (capture 6) b@1605: "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + b@1605: // 3. anything else (capture 2) b@1605: ".*" + b@1605: ")\\)|)", b@1605: b@1605: // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter b@1605: rwhitespace = new RegExp( whitespace + "+", "g" ), b@1605: rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), b@1605: b@1605: rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), b@1605: rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), b@1605: b@1605: rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), b@1605: b@1605: rpseudo = new RegExp( pseudos ), b@1605: ridentifier = new RegExp( "^" + identifier + "$" ), b@1605: b@1605: matchExpr = { b@1605: "ID": new RegExp( "^#(" + characterEncoding + ")" ), b@1605: "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), b@1605: "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), b@1605: "ATTR": new RegExp( "^" + attributes ), b@1605: "PSEUDO": new RegExp( "^" + pseudos ), b@1605: "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + b@1605: "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + b@1605: "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), b@1605: "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), b@1605: // For use in libraries implementing .is() b@1605: // We use this for POS matching in `select` b@1605: "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + b@1605: whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) b@1605: }, b@1605: b@1605: rinputs = /^(?:input|select|textarea|button)$/i, b@1605: rheader = /^h\d$/i, b@1605: b@1605: rnative = /^[^{]+\{\s*\[native \w/, b@1605: b@1605: // Easily-parseable/retrievable ID or TAG or CLASS selectors b@1605: rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, b@1605: b@1605: rsibling = /[+~]/, b@1605: rescape = /'|\\/g, b@1605: b@1605: // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters b@1605: runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), b@1605: funescape = function( _, escaped, escapedWhitespace ) { b@1605: var high = "0x" + escaped - 0x10000; b@1605: // NaN means non-codepoint b@1605: // Support: Firefox<24 b@1605: // Workaround erroneous numeric interpretation of +"0x" b@1605: return high !== high || escapedWhitespace ? b@1605: escaped : b@1605: high < 0 ? b@1605: // BMP codepoint b@1605: String.fromCharCode( high + 0x10000 ) : b@1605: // Supplemental Plane codepoint (surrogate pair) b@1605: String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); b@1605: }, b@1605: b@1605: // Used for iframes b@1605: // See setDocument() b@1605: // Removing the function wrapper causes a "Permission Denied" b@1605: // error in IE b@1605: unloadHandler = function() { b@1605: setDocument(); b@1605: }; b@1605: b@1605: // Optimize for push.apply( _, NodeList ) b@1605: try { b@1605: push.apply( b@1605: (arr = slice.call( preferredDoc.childNodes )), b@1605: preferredDoc.childNodes b@1605: ); b@1605: // Support: Android<4.0 b@1605: // Detect silently failing push.apply b@1605: arr[ preferredDoc.childNodes.length ].nodeType; b@1605: } catch ( e ) { b@1605: push = { apply: arr.length ? b@1605: b@1605: // Leverage slice if possible b@1605: function( target, els ) { b@1605: push_native.apply( target, slice.call(els) ); b@1605: } : b@1605: b@1605: // Support: IE<9 b@1605: // Otherwise append directly b@1605: function( target, els ) { b@1605: var j = target.length, b@1605: i = 0; b@1605: // Can't trust NodeList.length b@1605: while ( (target[j++] = els[i++]) ) {} b@1605: target.length = j - 1; b@1605: } b@1605: }; b@1605: } b@1605: b@1605: function Sizzle( selector, context, results, seed ) { b@1605: var match, elem, m, nodeType, b@1605: // QSA vars b@1605: i, groups, old, nid, newContext, newSelector; b@1605: b@1605: if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { b@1605: setDocument( context ); b@1605: } b@1605: b@1605: context = context || document; b@1605: results = results || []; b@1605: nodeType = context.nodeType; b@1605: b@1605: if ( typeof selector !== "string" || !selector || b@1605: nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { b@1605: b@1605: return results; b@1605: } b@1605: b@1605: if ( !seed && documentIsHTML ) { b@1605: b@1605: // Try to shortcut find operations when possible (e.g., not under DocumentFragment) b@1605: if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { b@1605: // Speed-up: Sizzle("#ID") b@1605: if ( (m = match[1]) ) { b@1605: if ( nodeType === 9 ) { b@1605: elem = context.getElementById( m ); b@1605: // Check parentNode to catch when Blackberry 4.6 returns b@1605: // nodes that are no longer in the document (jQuery #6963) b@1605: if ( elem && elem.parentNode ) { b@1605: // Handle the case where IE, Opera, and Webkit return items b@1605: // by name instead of ID b@1605: if ( elem.id === m ) { b@1605: results.push( elem ); b@1605: return results; b@1605: } b@1605: } else { b@1605: return results; b@1605: } b@1605: } else { b@1605: // Context is not a document b@1605: if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && b@1605: contains( context, elem ) && elem.id === m ) { b@1605: results.push( elem ); b@1605: return results; b@1605: } b@1605: } b@1605: b@1605: // Speed-up: Sizzle("TAG") b@1605: } else if ( match[2] ) { b@1605: push.apply( results, context.getElementsByTagName( selector ) ); b@1605: return results; b@1605: b@1605: // Speed-up: Sizzle(".CLASS") b@1605: } else if ( (m = match[3]) && support.getElementsByClassName ) { b@1605: push.apply( results, context.getElementsByClassName( m ) ); b@1605: return results; b@1605: } b@1605: } b@1605: b@1605: // QSA path b@1605: if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { b@1605: nid = old = expando; b@1605: newContext = context; b@1605: newSelector = nodeType !== 1 && selector; b@1605: b@1605: // qSA works strangely on Element-rooted queries b@1605: // We can work around this by specifying an extra ID on the root b@1605: // and working up from there (Thanks to Andrew Dupont for the technique) b@1605: // IE 8 doesn't work on object elements b@1605: if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { b@1605: groups = tokenize( selector ); b@1605: b@1605: if ( (old = context.getAttribute("id")) ) { b@1605: nid = old.replace( rescape, "\\$&" ); b@1605: } else { b@1605: context.setAttribute( "id", nid ); b@1605: } b@1605: nid = "[id='" + nid + "'] "; b@1605: b@1605: i = groups.length; b@1605: while ( i-- ) { b@1605: groups[i] = nid + toSelector( groups[i] ); b@1605: } b@1605: newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context; b@1605: newSelector = groups.join(","); b@1605: } b@1605: b@1605: if ( newSelector ) { b@1605: try { b@1605: push.apply( results, b@1605: newContext.querySelectorAll( newSelector ) b@1605: ); b@1605: return results; b@1605: } catch(qsaError) { b@1605: } finally { b@1605: if ( !old ) { b@1605: context.removeAttribute("id"); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // All others b@1605: return select( selector.replace( rtrim, "$1" ), context, results, seed ); b@1605: } b@1605: b@1605: /** b@1605: * Create key-value caches of limited size b@1605: * @returns {Function(string, Object)} Returns the Object data after storing it on itself with b@1605: * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) b@1605: * deleting the oldest entry b@1605: */ b@1605: function createCache() { b@1605: var keys = []; b@1605: b@1605: function cache( key, value ) { b@1605: // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) b@1605: if ( keys.push( key + " " ) > Expr.cacheLength ) { b@1605: // Only keep the most recent entries b@1605: delete cache[ keys.shift() ]; b@1605: } b@1605: return (cache[ key + " " ] = value); b@1605: } b@1605: return cache; b@1605: } b@1605: b@1605: /** b@1605: * Mark a function for special use by Sizzle b@1605: * @param {Function} fn The function to mark b@1605: */ b@1605: function markFunction( fn ) { b@1605: fn[ expando ] = true; b@1605: return fn; b@1605: } b@1605: b@1605: /** b@1605: * Support testing using an element b@1605: * @param {Function} fn Passed the created div and expects a boolean result b@1605: */ b@1605: function assert( fn ) { b@1605: var div = document.createElement("div"); b@1605: b@1605: try { b@1605: return !!fn( div ); b@1605: } catch (e) { b@1605: return false; b@1605: } finally { b@1605: // Remove from its parent by default b@1605: if ( div.parentNode ) { b@1605: div.parentNode.removeChild( div ); b@1605: } b@1605: // release memory in IE b@1605: div = null; b@1605: } b@1605: } b@1605: b@1605: /** b@1605: * Adds the same handler for all of the specified attrs b@1605: * @param {String} attrs Pipe-separated list of attributes b@1605: * @param {Function} handler The method that will be applied b@1605: */ b@1605: function addHandle( attrs, handler ) { b@1605: var arr = attrs.split("|"), b@1605: i = attrs.length; b@1605: b@1605: while ( i-- ) { b@1605: Expr.attrHandle[ arr[i] ] = handler; b@1605: } b@1605: } b@1605: b@1605: /** b@1605: * Checks document order of two siblings b@1605: * @param {Element} a b@1605: * @param {Element} b b@1605: * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b b@1605: */ b@1605: function siblingCheck( a, b ) { b@1605: var cur = b && a, b@1605: diff = cur && a.nodeType === 1 && b.nodeType === 1 && b@1605: ( ~b.sourceIndex || MAX_NEGATIVE ) - b@1605: ( ~a.sourceIndex || MAX_NEGATIVE ); b@1605: b@1605: // Use IE sourceIndex if available on both nodes b@1605: if ( diff ) { b@1605: return diff; b@1605: } b@1605: b@1605: // Check if b follows a b@1605: if ( cur ) { b@1605: while ( (cur = cur.nextSibling) ) { b@1605: if ( cur === b ) { b@1605: return -1; b@1605: } b@1605: } b@1605: } b@1605: b@1605: return a ? 1 : -1; b@1605: } b@1605: b@1605: /** b@1605: * Returns a function to use in pseudos for input types b@1605: * @param {String} type b@1605: */ b@1605: function createInputPseudo( type ) { b@1605: return function( elem ) { b@1605: var name = elem.nodeName.toLowerCase(); b@1605: return name === "input" && elem.type === type; b@1605: }; b@1605: } b@1605: b@1605: /** b@1605: * Returns a function to use in pseudos for buttons b@1605: * @param {String} type b@1605: */ b@1605: function createButtonPseudo( type ) { b@1605: return function( elem ) { b@1605: var name = elem.nodeName.toLowerCase(); b@1605: return (name === "input" || name === "button") && elem.type === type; b@1605: }; b@1605: } b@1605: b@1605: /** b@1605: * Returns a function to use in pseudos for positionals b@1605: * @param {Function} fn b@1605: */ b@1605: function createPositionalPseudo( fn ) { b@1605: return markFunction(function( argument ) { b@1605: argument = +argument; b@1605: return markFunction(function( seed, matches ) { b@1605: var j, b@1605: matchIndexes = fn( [], seed.length, argument ), b@1605: i = matchIndexes.length; b@1605: b@1605: // Match elements found at the specified indexes b@1605: while ( i-- ) { b@1605: if ( seed[ (j = matchIndexes[i]) ] ) { b@1605: seed[j] = !(matches[j] = seed[j]); b@1605: } b@1605: } b@1605: }); b@1605: }); b@1605: } b@1605: b@1605: /** b@1605: * Checks a node for validity as a Sizzle context b@1605: * @param {Element|Object=} context b@1605: * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value b@1605: */ b@1605: function testContext( context ) { b@1605: return context && typeof context.getElementsByTagName !== "undefined" && context; b@1605: } b@1605: b@1605: // Expose support vars for convenience b@1605: support = Sizzle.support = {}; b@1605: b@1605: /** b@1605: * Detects XML nodes b@1605: * @param {Element|Object} elem An element or a document b@1605: * @returns {Boolean} True iff elem is a non-HTML XML node b@1605: */ b@1605: isXML = Sizzle.isXML = function( elem ) { b@1605: // documentElement is verified for cases where it doesn't yet exist b@1605: // (such as loading iframes in IE - #4833) b@1605: var documentElement = elem && (elem.ownerDocument || elem).documentElement; b@1605: return documentElement ? documentElement.nodeName !== "HTML" : false; b@1605: }; b@1605: b@1605: /** b@1605: * Sets document-related variables once based on the current document b@1605: * @param {Element|Object} [doc] An element or document object to use to set the document b@1605: * @returns {Object} Returns the current document b@1605: */ b@1605: setDocument = Sizzle.setDocument = function( node ) { b@1605: var hasCompare, parent, b@1605: doc = node ? node.ownerDocument || node : preferredDoc; b@1605: b@1605: // If no document and documentElement is available, return b@1605: if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { b@1605: return document; b@1605: } b@1605: b@1605: // Set our document b@1605: document = doc; b@1605: docElem = doc.documentElement; b@1605: parent = doc.defaultView; b@1605: b@1605: // Support: IE>8 b@1605: // If iframe document is assigned to "document" variable and if iframe has been reloaded, b@1605: // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936 b@1605: // IE6-8 do not support the defaultView property so parent will be undefined b@1605: if ( parent && parent !== parent.top ) { b@1605: // IE11 does not have attachEvent, so all must suffer b@1605: if ( parent.addEventListener ) { b@1605: parent.addEventListener( "unload", unloadHandler, false ); b@1605: } else if ( parent.attachEvent ) { b@1605: parent.attachEvent( "onunload", unloadHandler ); b@1605: } b@1605: } b@1605: b@1605: /* Support tests b@1605: ---------------------------------------------------------------------- */ b@1605: documentIsHTML = !isXML( doc ); b@1605: b@1605: /* Attributes b@1605: ---------------------------------------------------------------------- */ b@1605: b@1605: // Support: IE<8 b@1605: // Verify that getAttribute really returns attributes and not properties b@1605: // (excepting IE8 booleans) b@1605: support.attributes = assert(function( div ) { b@1605: div.className = "i"; b@1605: return !div.getAttribute("className"); b@1605: }); b@1605: b@1605: /* getElement(s)By* b@1605: ---------------------------------------------------------------------- */ b@1605: b@1605: // Check if getElementsByTagName("*") returns only elements b@1605: support.getElementsByTagName = assert(function( div ) { b@1605: div.appendChild( doc.createComment("") ); b@1605: return !div.getElementsByTagName("*").length; b@1605: }); b@1605: b@1605: // Support: IE<9 b@1605: support.getElementsByClassName = rnative.test( doc.getElementsByClassName ); b@1605: b@1605: // Support: IE<10 b@1605: // Check if getElementById returns elements by name b@1605: // The broken getElementById methods don't pick up programatically-set names, b@1605: // so use a roundabout getElementsByName test b@1605: support.getById = assert(function( div ) { b@1605: docElem.appendChild( div ).id = expando; b@1605: return !doc.getElementsByName || !doc.getElementsByName( expando ).length; b@1605: }); b@1605: b@1605: // ID find and filter b@1605: if ( support.getById ) { b@1605: Expr.find["ID"] = function( id, context ) { b@1605: if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { b@1605: var m = context.getElementById( id ); b@1605: // Check parentNode to catch when Blackberry 4.6 returns b@1605: // nodes that are no longer in the document #6963 b@1605: return m && m.parentNode ? [ m ] : []; b@1605: } b@1605: }; b@1605: Expr.filter["ID"] = function( id ) { b@1605: var attrId = id.replace( runescape, funescape ); b@1605: return function( elem ) { b@1605: return elem.getAttribute("id") === attrId; b@1605: }; b@1605: }; b@1605: } else { b@1605: // Support: IE6/7 b@1605: // getElementById is not reliable as a find shortcut b@1605: delete Expr.find["ID"]; b@1605: b@1605: Expr.filter["ID"] = function( id ) { b@1605: var attrId = id.replace( runescape, funescape ); b@1605: return function( elem ) { b@1605: var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); b@1605: return node && node.value === attrId; b@1605: }; b@1605: }; b@1605: } b@1605: b@1605: // Tag b@1605: Expr.find["TAG"] = support.getElementsByTagName ? b@1605: function( tag, context ) { b@1605: if ( typeof context.getElementsByTagName !== "undefined" ) { b@1605: return context.getElementsByTagName( tag ); b@1605: b@1605: // DocumentFragment nodes don't have gEBTN b@1605: } else if ( support.qsa ) { b@1605: return context.querySelectorAll( tag ); b@1605: } b@1605: } : b@1605: b@1605: function( tag, context ) { b@1605: var elem, b@1605: tmp = [], b@1605: i = 0, b@1605: // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too b@1605: results = context.getElementsByTagName( tag ); b@1605: b@1605: // Filter out possible comments b@1605: if ( tag === "*" ) { b@1605: while ( (elem = results[i++]) ) { b@1605: if ( elem.nodeType === 1 ) { b@1605: tmp.push( elem ); b@1605: } b@1605: } b@1605: b@1605: return tmp; b@1605: } b@1605: return results; b@1605: }; b@1605: b@1605: // Class b@1605: Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { b@1605: if ( documentIsHTML ) { b@1605: return context.getElementsByClassName( className ); b@1605: } b@1605: }; b@1605: b@1605: /* QSA/matchesSelector b@1605: ---------------------------------------------------------------------- */ b@1605: b@1605: // QSA and matchesSelector support b@1605: b@1605: // matchesSelector(:active) reports false when true (IE9/Opera 11.5) b@1605: rbuggyMatches = []; b@1605: b@1605: // qSa(:focus) reports false when true (Chrome 21) b@1605: // We allow this because of a bug in IE8/9 that throws an error b@1605: // whenever `document.activeElement` is accessed on an iframe b@1605: // So, we allow :focus to pass through QSA all the time to avoid the IE error b@1605: // See http://bugs.jquery.com/ticket/13378 b@1605: rbuggyQSA = []; b@1605: b@1605: if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { b@1605: // Build QSA regex b@1605: // Regex strategy adopted from Diego Perini b@1605: assert(function( div ) { b@1605: // Select is set to empty string on purpose b@1605: // This is to test IE's treatment of not explicitly b@1605: // setting a boolean content attribute, b@1605: // since its presence should be enough b@1605: // http://bugs.jquery.com/ticket/12359 b@1605: docElem.appendChild( div ).innerHTML = "" + b@1605: ""; b@1605: b@1605: // Support: IE8, Opera 11-12.16 b@1605: // Nothing should be selected when empty strings follow ^= or $= or *= b@1605: // The test attribute must be unknown in Opera but "safe" for WinRT b@1605: // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section b@1605: if ( div.querySelectorAll("[msallowcapture^='']").length ) { b@1605: rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); b@1605: } b@1605: b@1605: // Support: IE8 b@1605: // Boolean attributes and "value" are not treated correctly b@1605: if ( !div.querySelectorAll("[selected]").length ) { b@1605: rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); b@1605: } b@1605: b@1605: // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+ b@1605: if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { b@1605: rbuggyQSA.push("~="); b@1605: } b@1605: b@1605: // Webkit/Opera - :checked should return selected option elements b@1605: // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked b@1605: // IE8 throws error here and will not see later tests b@1605: if ( !div.querySelectorAll(":checked").length ) { b@1605: rbuggyQSA.push(":checked"); b@1605: } b@1605: b@1605: // Support: Safari 8+, iOS 8+ b@1605: // https://bugs.webkit.org/show_bug.cgi?id=136851 b@1605: // In-page `selector#id sibing-combinator selector` fails b@1605: if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { b@1605: rbuggyQSA.push(".#.+[+~]"); b@1605: } b@1605: }); b@1605: b@1605: assert(function( div ) { b@1605: // Support: Windows 8 Native Apps b@1605: // The type and name attributes are restricted during .innerHTML assignment b@1605: var input = doc.createElement("input"); b@1605: input.setAttribute( "type", "hidden" ); b@1605: div.appendChild( input ).setAttribute( "name", "D" ); b@1605: b@1605: // Support: IE8 b@1605: // Enforce case-sensitivity of name attribute b@1605: if ( div.querySelectorAll("[name=d]").length ) { b@1605: rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); b@1605: } b@1605: b@1605: // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) b@1605: // IE8 throws error here and will not see later tests b@1605: if ( !div.querySelectorAll(":enabled").length ) { b@1605: rbuggyQSA.push( ":enabled", ":disabled" ); b@1605: } b@1605: b@1605: // Opera 10-11 does not throw on post-comma invalid pseudos b@1605: div.querySelectorAll("*,:x"); b@1605: rbuggyQSA.push(",.*:"); b@1605: }); b@1605: } b@1605: b@1605: if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || b@1605: docElem.webkitMatchesSelector || b@1605: docElem.mozMatchesSelector || b@1605: docElem.oMatchesSelector || b@1605: docElem.msMatchesSelector) )) ) { b@1605: b@1605: assert(function( div ) { b@1605: // Check to see if it's possible to do matchesSelector b@1605: // on a disconnected node (IE 9) b@1605: support.disconnectedMatch = matches.call( div, "div" ); b@1605: b@1605: // This should fail with an exception b@1605: // Gecko does not error, returns false instead b@1605: matches.call( div, "[s!='']:x" ); b@1605: rbuggyMatches.push( "!=", pseudos ); b@1605: }); b@1605: } b@1605: b@1605: rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); b@1605: rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); b@1605: b@1605: /* Contains b@1605: ---------------------------------------------------------------------- */ b@1605: hasCompare = rnative.test( docElem.compareDocumentPosition ); b@1605: b@1605: // Element contains another b@1605: // Purposefully does not implement inclusive descendent b@1605: // As in, an element does not contain itself b@1605: contains = hasCompare || rnative.test( docElem.contains ) ? b@1605: function( a, b ) { b@1605: var adown = a.nodeType === 9 ? a.documentElement : a, b@1605: bup = b && b.parentNode; b@1605: return a === bup || !!( bup && bup.nodeType === 1 && ( b@1605: adown.contains ? b@1605: adown.contains( bup ) : b@1605: a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 b@1605: )); b@1605: } : b@1605: function( a, b ) { b@1605: if ( b ) { b@1605: while ( (b = b.parentNode) ) { b@1605: if ( b === a ) { b@1605: return true; b@1605: } b@1605: } b@1605: } b@1605: return false; b@1605: }; b@1605: b@1605: /* Sorting b@1605: ---------------------------------------------------------------------- */ b@1605: b@1605: // Document order sorting b@1605: sortOrder = hasCompare ? b@1605: function( a, b ) { b@1605: b@1605: // Flag for duplicate removal b@1605: if ( a === b ) { b@1605: hasDuplicate = true; b@1605: return 0; b@1605: } b@1605: b@1605: // Sort on method existence if only one input has compareDocumentPosition b@1605: var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; b@1605: if ( compare ) { b@1605: return compare; b@1605: } b@1605: b@1605: // Calculate position if both inputs belong to the same document b@1605: compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? b@1605: a.compareDocumentPosition( b ) : b@1605: b@1605: // Otherwise we know they are disconnected b@1605: 1; b@1605: b@1605: // Disconnected nodes b@1605: if ( compare & 1 || b@1605: (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { b@1605: b@1605: // Choose the first element that is related to our preferred document b@1605: if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { b@1605: return -1; b@1605: } b@1605: if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { b@1605: return 1; b@1605: } b@1605: b@1605: // Maintain original order b@1605: return sortInput ? b@1605: ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : b@1605: 0; b@1605: } b@1605: b@1605: return compare & 4 ? -1 : 1; b@1605: } : b@1605: function( a, b ) { b@1605: // Exit early if the nodes are identical b@1605: if ( a === b ) { b@1605: hasDuplicate = true; b@1605: return 0; b@1605: } b@1605: b@1605: var cur, b@1605: i = 0, b@1605: aup = a.parentNode, b@1605: bup = b.parentNode, b@1605: ap = [ a ], b@1605: bp = [ b ]; b@1605: b@1605: // Parentless nodes are either documents or disconnected b@1605: if ( !aup || !bup ) { b@1605: return a === doc ? -1 : b@1605: b === doc ? 1 : b@1605: aup ? -1 : b@1605: bup ? 1 : b@1605: sortInput ? b@1605: ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : b@1605: 0; b@1605: b@1605: // If the nodes are siblings, we can do a quick check b@1605: } else if ( aup === bup ) { b@1605: return siblingCheck( a, b ); b@1605: } b@1605: b@1605: // Otherwise we need full lists of their ancestors for comparison b@1605: cur = a; b@1605: while ( (cur = cur.parentNode) ) { b@1605: ap.unshift( cur ); b@1605: } b@1605: cur = b; b@1605: while ( (cur = cur.parentNode) ) { b@1605: bp.unshift( cur ); b@1605: } b@1605: b@1605: // Walk down the tree looking for a discrepancy b@1605: while ( ap[i] === bp[i] ) { b@1605: i++; b@1605: } b@1605: b@1605: return i ? b@1605: // Do a sibling check if the nodes have a common ancestor b@1605: siblingCheck( ap[i], bp[i] ) : b@1605: b@1605: // Otherwise nodes in our document sort first b@1605: ap[i] === preferredDoc ? -1 : b@1605: bp[i] === preferredDoc ? 1 : b@1605: 0; b@1605: }; b@1605: b@1605: return doc; b@1605: }; b@1605: b@1605: Sizzle.matches = function( expr, elements ) { b@1605: return Sizzle( expr, null, null, elements ); b@1605: }; b@1605: b@1605: Sizzle.matchesSelector = function( elem, expr ) { b@1605: // Set document vars if needed b@1605: if ( ( elem.ownerDocument || elem ) !== document ) { b@1605: setDocument( elem ); b@1605: } b@1605: b@1605: // Make sure that attribute selectors are quoted b@1605: expr = expr.replace( rattributeQuotes, "='$1']" ); b@1605: b@1605: if ( support.matchesSelector && documentIsHTML && b@1605: ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && b@1605: ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { b@1605: b@1605: try { b@1605: var ret = matches.call( elem, expr ); b@1605: b@1605: // IE 9's matchesSelector returns false on disconnected nodes b@1605: if ( ret || support.disconnectedMatch || b@1605: // As well, disconnected nodes are said to be in a document b@1605: // fragment in IE 9 b@1605: elem.document && elem.document.nodeType !== 11 ) { b@1605: return ret; b@1605: } b@1605: } catch (e) {} b@1605: } b@1605: b@1605: return Sizzle( expr, document, null, [ elem ] ).length > 0; b@1605: }; b@1605: b@1605: Sizzle.contains = function( context, elem ) { b@1605: // Set document vars if needed b@1605: if ( ( context.ownerDocument || context ) !== document ) { b@1605: setDocument( context ); b@1605: } b@1605: return contains( context, elem ); b@1605: }; b@1605: b@1605: Sizzle.attr = function( elem, name ) { b@1605: // Set document vars if needed b@1605: if ( ( elem.ownerDocument || elem ) !== document ) { b@1605: setDocument( elem ); b@1605: } b@1605: b@1605: var fn = Expr.attrHandle[ name.toLowerCase() ], b@1605: // Don't get fooled by Object.prototype properties (jQuery #13807) b@1605: val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? b@1605: fn( elem, name, !documentIsHTML ) : b@1605: undefined; b@1605: b@1605: return val !== undefined ? b@1605: val : b@1605: support.attributes || !documentIsHTML ? b@1605: elem.getAttribute( name ) : b@1605: (val = elem.getAttributeNode(name)) && val.specified ? b@1605: val.value : b@1605: null; b@1605: }; b@1605: b@1605: Sizzle.error = function( msg ) { b@1605: throw new Error( "Syntax error, unrecognized expression: " + msg ); b@1605: }; b@1605: b@1605: /** b@1605: * Document sorting and removing duplicates b@1605: * @param {ArrayLike} results b@1605: */ b@1605: Sizzle.uniqueSort = function( results ) { b@1605: var elem, b@1605: duplicates = [], b@1605: j = 0, b@1605: i = 0; b@1605: b@1605: // Unless we *know* we can detect duplicates, assume their presence b@1605: hasDuplicate = !support.detectDuplicates; b@1605: sortInput = !support.sortStable && results.slice( 0 ); b@1605: results.sort( sortOrder ); b@1605: b@1605: if ( hasDuplicate ) { b@1605: while ( (elem = results[i++]) ) { b@1605: if ( elem === results[ i ] ) { b@1605: j = duplicates.push( i ); b@1605: } b@1605: } b@1605: while ( j-- ) { b@1605: results.splice( duplicates[ j ], 1 ); b@1605: } b@1605: } b@1605: b@1605: // Clear input after sorting to release objects b@1605: // See https://github.com/jquery/sizzle/pull/225 b@1605: sortInput = null; b@1605: b@1605: return results; b@1605: }; b@1605: b@1605: /** b@1605: * Utility function for retrieving the text value of an array of DOM nodes b@1605: * @param {Array|Element} elem b@1605: */ b@1605: getText = Sizzle.getText = function( elem ) { b@1605: var node, b@1605: ret = "", b@1605: i = 0, b@1605: nodeType = elem.nodeType; b@1605: b@1605: if ( !nodeType ) { b@1605: // If no nodeType, this is expected to be an array b@1605: while ( (node = elem[i++]) ) { b@1605: // Do not traverse comment nodes b@1605: ret += getText( node ); b@1605: } b@1605: } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { b@1605: // Use textContent for elements b@1605: // innerText usage removed for consistency of new lines (jQuery #11153) b@1605: if ( typeof elem.textContent === "string" ) { b@1605: return elem.textContent; b@1605: } else { b@1605: // Traverse its children b@1605: for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { b@1605: ret += getText( elem ); b@1605: } b@1605: } b@1605: } else if ( nodeType === 3 || nodeType === 4 ) { b@1605: return elem.nodeValue; b@1605: } b@1605: // Do not include comment or processing instruction nodes b@1605: b@1605: return ret; b@1605: }; b@1605: b@1605: Expr = Sizzle.selectors = { b@1605: b@1605: // Can be adjusted by the user b@1605: cacheLength: 50, b@1605: b@1605: createPseudo: markFunction, b@1605: b@1605: match: matchExpr, b@1605: b@1605: attrHandle: {}, b@1605: b@1605: find: {}, b@1605: b@1605: relative: { b@1605: ">": { dir: "parentNode", first: true }, b@1605: " ": { dir: "parentNode" }, b@1605: "+": { dir: "previousSibling", first: true }, b@1605: "~": { dir: "previousSibling" } b@1605: }, b@1605: b@1605: preFilter: { b@1605: "ATTR": function( match ) { b@1605: match[1] = match[1].replace( runescape, funescape ); b@1605: b@1605: // Move the given value to match[3] whether quoted or unquoted b@1605: match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); b@1605: b@1605: if ( match[2] === "~=" ) { b@1605: match[3] = " " + match[3] + " "; b@1605: } b@1605: b@1605: return match.slice( 0, 4 ); b@1605: }, b@1605: b@1605: "CHILD": function( match ) { b@1605: /* matches from matchExpr["CHILD"] b@1605: 1 type (only|nth|...) b@1605: 2 what (child|of-type) b@1605: 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) b@1605: 4 xn-component of xn+y argument ([+-]?\d*n|) b@1605: 5 sign of xn-component b@1605: 6 x of xn-component b@1605: 7 sign of y-component b@1605: 8 y of y-component b@1605: */ b@1605: match[1] = match[1].toLowerCase(); b@1605: b@1605: if ( match[1].slice( 0, 3 ) === "nth" ) { b@1605: // nth-* requires argument b@1605: if ( !match[3] ) { b@1605: Sizzle.error( match[0] ); b@1605: } b@1605: b@1605: // numeric x and y parameters for Expr.filter.CHILD b@1605: // remember that false/true cast respectively to 0/1 b@1605: match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); b@1605: match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); b@1605: b@1605: // other types prohibit arguments b@1605: } else if ( match[3] ) { b@1605: Sizzle.error( match[0] ); b@1605: } b@1605: b@1605: return match; b@1605: }, b@1605: b@1605: "PSEUDO": function( match ) { b@1605: var excess, b@1605: unquoted = !match[6] && match[2]; b@1605: b@1605: if ( matchExpr["CHILD"].test( match[0] ) ) { b@1605: return null; b@1605: } b@1605: b@1605: // Accept quoted arguments as-is b@1605: if ( match[3] ) { b@1605: match[2] = match[4] || match[5] || ""; b@1605: b@1605: // Strip excess characters from unquoted arguments b@1605: } else if ( unquoted && rpseudo.test( unquoted ) && b@1605: // Get excess from tokenize (recursively) b@1605: (excess = tokenize( unquoted, true )) && b@1605: // advance to the next closing parenthesis b@1605: (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { b@1605: b@1605: // excess is a negative index b@1605: match[0] = match[0].slice( 0, excess ); b@1605: match[2] = unquoted.slice( 0, excess ); b@1605: } b@1605: b@1605: // Return only captures needed by the pseudo filter method (type and argument) b@1605: return match.slice( 0, 3 ); b@1605: } b@1605: }, b@1605: b@1605: filter: { b@1605: b@1605: "TAG": function( nodeNameSelector ) { b@1605: var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); b@1605: return nodeNameSelector === "*" ? b@1605: function() { return true; } : b@1605: function( elem ) { b@1605: return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; b@1605: }; b@1605: }, b@1605: b@1605: "CLASS": function( className ) { b@1605: var pattern = classCache[ className + " " ]; b@1605: b@1605: return pattern || b@1605: (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && b@1605: classCache( className, function( elem ) { b@1605: return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); b@1605: }); b@1605: }, b@1605: b@1605: "ATTR": function( name, operator, check ) { b@1605: return function( elem ) { b@1605: var result = Sizzle.attr( elem, name ); b@1605: b@1605: if ( result == null ) { b@1605: return operator === "!="; b@1605: } b@1605: if ( !operator ) { b@1605: return true; b@1605: } b@1605: b@1605: result += ""; b@1605: b@1605: return operator === "=" ? result === check : b@1605: operator === "!=" ? result !== check : b@1605: operator === "^=" ? check && result.indexOf( check ) === 0 : b@1605: operator === "*=" ? check && result.indexOf( check ) > -1 : b@1605: operator === "$=" ? check && result.slice( -check.length ) === check : b@1605: operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : b@1605: operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : b@1605: false; b@1605: }; b@1605: }, b@1605: b@1605: "CHILD": function( type, what, argument, first, last ) { b@1605: var simple = type.slice( 0, 3 ) !== "nth", b@1605: forward = type.slice( -4 ) !== "last", b@1605: ofType = what === "of-type"; b@1605: b@1605: return first === 1 && last === 0 ? b@1605: b@1605: // Shortcut for :nth-*(n) b@1605: function( elem ) { b@1605: return !!elem.parentNode; b@1605: } : b@1605: b@1605: function( elem, context, xml ) { b@1605: var cache, outerCache, node, diff, nodeIndex, start, b@1605: dir = simple !== forward ? "nextSibling" : "previousSibling", b@1605: parent = elem.parentNode, b@1605: name = ofType && elem.nodeName.toLowerCase(), b@1605: useCache = !xml && !ofType; b@1605: b@1605: if ( parent ) { b@1605: b@1605: // :(first|last|only)-(child|of-type) b@1605: if ( simple ) { b@1605: while ( dir ) { b@1605: node = elem; b@1605: while ( (node = node[ dir ]) ) { b@1605: if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { b@1605: return false; b@1605: } b@1605: } b@1605: // Reverse direction for :only-* (if we haven't yet done so) b@1605: start = dir = type === "only" && !start && "nextSibling"; b@1605: } b@1605: return true; b@1605: } b@1605: b@1605: start = [ forward ? parent.firstChild : parent.lastChild ]; b@1605: b@1605: // non-xml :nth-child(...) stores cache data on `parent` b@1605: if ( forward && useCache ) { b@1605: // Seek `elem` from a previously-cached index b@1605: outerCache = parent[ expando ] || (parent[ expando ] = {}); b@1605: cache = outerCache[ type ] || []; b@1605: nodeIndex = cache[0] === dirruns && cache[1]; b@1605: diff = cache[0] === dirruns && cache[2]; b@1605: node = nodeIndex && parent.childNodes[ nodeIndex ]; b@1605: b@1605: while ( (node = ++nodeIndex && node && node[ dir ] || b@1605: b@1605: // Fallback to seeking `elem` from the start b@1605: (diff = nodeIndex = 0) || start.pop()) ) { b@1605: b@1605: // When found, cache indexes on `parent` and break b@1605: if ( node.nodeType === 1 && ++diff && node === elem ) { b@1605: outerCache[ type ] = [ dirruns, nodeIndex, diff ]; b@1605: break; b@1605: } b@1605: } b@1605: b@1605: // Use previously-cached element index if available b@1605: } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { b@1605: diff = cache[1]; b@1605: b@1605: // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) b@1605: } else { b@1605: // Use the same loop as above to seek `elem` from the start b@1605: while ( (node = ++nodeIndex && node && node[ dir ] || b@1605: (diff = nodeIndex = 0) || start.pop()) ) { b@1605: b@1605: if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { b@1605: // Cache the index of each encountered element b@1605: if ( useCache ) { b@1605: (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; b@1605: } b@1605: b@1605: if ( node === elem ) { b@1605: break; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Incorporate the offset, then check against cycle size b@1605: diff -= last; b@1605: return diff === first || ( diff % first === 0 && diff / first >= 0 ); b@1605: } b@1605: }; b@1605: }, b@1605: b@1605: "PSEUDO": function( pseudo, argument ) { b@1605: // pseudo-class names are case-insensitive b@1605: // http://www.w3.org/TR/selectors/#pseudo-classes b@1605: // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters b@1605: // Remember that setFilters inherits from pseudos b@1605: var args, b@1605: fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || b@1605: Sizzle.error( "unsupported pseudo: " + pseudo ); b@1605: b@1605: // The user may use createPseudo to indicate that b@1605: // arguments are needed to create the filter function b@1605: // just as Sizzle does b@1605: if ( fn[ expando ] ) { b@1605: return fn( argument ); b@1605: } b@1605: b@1605: // But maintain support for old signatures b@1605: if ( fn.length > 1 ) { b@1605: args = [ pseudo, pseudo, "", argument ]; b@1605: return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? b@1605: markFunction(function( seed, matches ) { b@1605: var idx, b@1605: matched = fn( seed, argument ), b@1605: i = matched.length; b@1605: while ( i-- ) { b@1605: idx = indexOf( seed, matched[i] ); b@1605: seed[ idx ] = !( matches[ idx ] = matched[i] ); b@1605: } b@1605: }) : b@1605: function( elem ) { b@1605: return fn( elem, 0, args ); b@1605: }; b@1605: } b@1605: b@1605: return fn; b@1605: } b@1605: }, b@1605: b@1605: pseudos: { b@1605: // Potentially complex pseudos b@1605: "not": markFunction(function( selector ) { b@1605: // Trim the selector passed to compile b@1605: // to avoid treating leading and trailing b@1605: // spaces as combinators b@1605: var input = [], b@1605: results = [], b@1605: matcher = compile( selector.replace( rtrim, "$1" ) ); b@1605: b@1605: return matcher[ expando ] ? b@1605: markFunction(function( seed, matches, context, xml ) { b@1605: var elem, b@1605: unmatched = matcher( seed, null, xml, [] ), b@1605: i = seed.length; b@1605: b@1605: // Match elements unmatched by `matcher` b@1605: while ( i-- ) { b@1605: if ( (elem = unmatched[i]) ) { b@1605: seed[i] = !(matches[i] = elem); b@1605: } b@1605: } b@1605: }) : b@1605: function( elem, context, xml ) { b@1605: input[0] = elem; b@1605: matcher( input, null, xml, results ); b@1605: // Don't keep the element (issue #299) b@1605: input[0] = null; b@1605: return !results.pop(); b@1605: }; b@1605: }), b@1605: b@1605: "has": markFunction(function( selector ) { b@1605: return function( elem ) { b@1605: return Sizzle( selector, elem ).length > 0; b@1605: }; b@1605: }), b@1605: b@1605: "contains": markFunction(function( text ) { b@1605: text = text.replace( runescape, funescape ); b@1605: return function( elem ) { b@1605: return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; b@1605: }; b@1605: }), b@1605: b@1605: // "Whether an element is represented by a :lang() selector b@1605: // is based solely on the element's language value b@1605: // being equal to the identifier C, b@1605: // or beginning with the identifier C immediately followed by "-". b@1605: // The matching of C against the element's language value is performed case-insensitively. b@1605: // The identifier C does not have to be a valid language name." b@1605: // http://www.w3.org/TR/selectors/#lang-pseudo b@1605: "lang": markFunction( function( lang ) { b@1605: // lang value must be a valid identifier b@1605: if ( !ridentifier.test(lang || "") ) { b@1605: Sizzle.error( "unsupported lang: " + lang ); b@1605: } b@1605: lang = lang.replace( runescape, funescape ).toLowerCase(); b@1605: return function( elem ) { b@1605: var elemLang; b@1605: do { b@1605: if ( (elemLang = documentIsHTML ? b@1605: elem.lang : b@1605: elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { b@1605: b@1605: elemLang = elemLang.toLowerCase(); b@1605: return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; b@1605: } b@1605: } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); b@1605: return false; b@1605: }; b@1605: }), b@1605: b@1605: // Miscellaneous b@1605: "target": function( elem ) { b@1605: var hash = window.location && window.location.hash; b@1605: return hash && hash.slice( 1 ) === elem.id; b@1605: }, b@1605: b@1605: "root": function( elem ) { b@1605: return elem === docElem; b@1605: }, b@1605: b@1605: "focus": function( elem ) { b@1605: return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); b@1605: }, b@1605: b@1605: // Boolean properties b@1605: "enabled": function( elem ) { b@1605: return elem.disabled === false; b@1605: }, b@1605: b@1605: "disabled": function( elem ) { b@1605: return elem.disabled === true; b@1605: }, b@1605: b@1605: "checked": function( elem ) { b@1605: // In CSS3, :checked should return both checked and selected elements b@1605: // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked b@1605: var nodeName = elem.nodeName.toLowerCase(); b@1605: return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); b@1605: }, b@1605: b@1605: "selected": function( elem ) { b@1605: // Accessing this property makes selected-by-default b@1605: // options in Safari work properly b@1605: if ( elem.parentNode ) { b@1605: elem.parentNode.selectedIndex; b@1605: } b@1605: b@1605: return elem.selected === true; b@1605: }, b@1605: b@1605: // Contents b@1605: "empty": function( elem ) { b@1605: // http://www.w3.org/TR/selectors/#empty-pseudo b@1605: // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), b@1605: // but not by others (comment: 8; processing instruction: 7; etc.) b@1605: // nodeType < 6 works because attributes (2) do not appear as children b@1605: for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { b@1605: if ( elem.nodeType < 6 ) { b@1605: return false; b@1605: } b@1605: } b@1605: return true; b@1605: }, b@1605: b@1605: "parent": function( elem ) { b@1605: return !Expr.pseudos["empty"]( elem ); b@1605: }, b@1605: b@1605: // Element/input types b@1605: "header": function( elem ) { b@1605: return rheader.test( elem.nodeName ); b@1605: }, b@1605: b@1605: "input": function( elem ) { b@1605: return rinputs.test( elem.nodeName ); b@1605: }, b@1605: b@1605: "button": function( elem ) { b@1605: var name = elem.nodeName.toLowerCase(); b@1605: return name === "input" && elem.type === "button" || name === "button"; b@1605: }, b@1605: b@1605: "text": function( elem ) { b@1605: var attr; b@1605: return elem.nodeName.toLowerCase() === "input" && b@1605: elem.type === "text" && b@1605: b@1605: // Support: IE<8 b@1605: // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" b@1605: ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); b@1605: }, b@1605: b@1605: // Position-in-collection b@1605: "first": createPositionalPseudo(function() { b@1605: return [ 0 ]; b@1605: }), b@1605: b@1605: "last": createPositionalPseudo(function( matchIndexes, length ) { b@1605: return [ length - 1 ]; b@1605: }), b@1605: b@1605: "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { b@1605: return [ argument < 0 ? argument + length : argument ]; b@1605: }), b@1605: b@1605: "even": createPositionalPseudo(function( matchIndexes, length ) { b@1605: var i = 0; b@1605: for ( ; i < length; i += 2 ) { b@1605: matchIndexes.push( i ); b@1605: } b@1605: return matchIndexes; b@1605: }), b@1605: b@1605: "odd": createPositionalPseudo(function( matchIndexes, length ) { b@1605: var i = 1; b@1605: for ( ; i < length; i += 2 ) { b@1605: matchIndexes.push( i ); b@1605: } b@1605: return matchIndexes; b@1605: }), b@1605: b@1605: "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { b@1605: var i = argument < 0 ? argument + length : argument; b@1605: for ( ; --i >= 0; ) { b@1605: matchIndexes.push( i ); b@1605: } b@1605: return matchIndexes; b@1605: }), b@1605: b@1605: "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { b@1605: var i = argument < 0 ? argument + length : argument; b@1605: for ( ; ++i < length; ) { b@1605: matchIndexes.push( i ); b@1605: } b@1605: return matchIndexes; b@1605: }) b@1605: } b@1605: }; b@1605: b@1605: Expr.pseudos["nth"] = Expr.pseudos["eq"]; b@1605: b@1605: // Add button/input type pseudos b@1605: for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { b@1605: Expr.pseudos[ i ] = createInputPseudo( i ); b@1605: } b@1605: for ( i in { submit: true, reset: true } ) { b@1605: Expr.pseudos[ i ] = createButtonPseudo( i ); b@1605: } b@1605: b@1605: // Easy API for creating new setFilters b@1605: function setFilters() {} b@1605: setFilters.prototype = Expr.filters = Expr.pseudos; b@1605: Expr.setFilters = new setFilters(); b@1605: b@1605: tokenize = Sizzle.tokenize = function( selector, parseOnly ) { b@1605: var matched, match, tokens, type, b@1605: soFar, groups, preFilters, b@1605: cached = tokenCache[ selector + " " ]; b@1605: b@1605: if ( cached ) { b@1605: return parseOnly ? 0 : cached.slice( 0 ); b@1605: } b@1605: b@1605: soFar = selector; b@1605: groups = []; b@1605: preFilters = Expr.preFilter; b@1605: b@1605: while ( soFar ) { b@1605: b@1605: // Comma and first run b@1605: if ( !matched || (match = rcomma.exec( soFar )) ) { b@1605: if ( match ) { b@1605: // Don't consume trailing commas as valid b@1605: soFar = soFar.slice( match[0].length ) || soFar; b@1605: } b@1605: groups.push( (tokens = []) ); b@1605: } b@1605: b@1605: matched = false; b@1605: b@1605: // Combinators b@1605: if ( (match = rcombinators.exec( soFar )) ) { b@1605: matched = match.shift(); b@1605: tokens.push({ b@1605: value: matched, b@1605: // Cast descendant combinators to space b@1605: type: match[0].replace( rtrim, " " ) b@1605: }); b@1605: soFar = soFar.slice( matched.length ); b@1605: } b@1605: b@1605: // Filters b@1605: for ( type in Expr.filter ) { b@1605: if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || b@1605: (match = preFilters[ type ]( match ))) ) { b@1605: matched = match.shift(); b@1605: tokens.push({ b@1605: value: matched, b@1605: type: type, b@1605: matches: match b@1605: }); b@1605: soFar = soFar.slice( matched.length ); b@1605: } b@1605: } b@1605: b@1605: if ( !matched ) { b@1605: break; b@1605: } b@1605: } b@1605: b@1605: // Return the length of the invalid excess b@1605: // if we're just parsing b@1605: // Otherwise, throw an error or return tokens b@1605: return parseOnly ? b@1605: soFar.length : b@1605: soFar ? b@1605: Sizzle.error( selector ) : b@1605: // Cache the tokens b@1605: tokenCache( selector, groups ).slice( 0 ); b@1605: }; b@1605: b@1605: function toSelector( tokens ) { b@1605: var i = 0, b@1605: len = tokens.length, b@1605: selector = ""; b@1605: for ( ; i < len; i++ ) { b@1605: selector += tokens[i].value; b@1605: } b@1605: return selector; b@1605: } b@1605: b@1605: function addCombinator( matcher, combinator, base ) { b@1605: var dir = combinator.dir, b@1605: checkNonElements = base && dir === "parentNode", b@1605: doneName = done++; b@1605: b@1605: return combinator.first ? b@1605: // Check against closest ancestor/preceding element b@1605: function( elem, context, xml ) { b@1605: while ( (elem = elem[ dir ]) ) { b@1605: if ( elem.nodeType === 1 || checkNonElements ) { b@1605: return matcher( elem, context, xml ); b@1605: } b@1605: } b@1605: } : b@1605: b@1605: // Check against all ancestor/preceding elements b@1605: function( elem, context, xml ) { b@1605: var oldCache, outerCache, b@1605: newCache = [ dirruns, doneName ]; b@1605: b@1605: // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching b@1605: if ( xml ) { b@1605: while ( (elem = elem[ dir ]) ) { b@1605: if ( elem.nodeType === 1 || checkNonElements ) { b@1605: if ( matcher( elem, context, xml ) ) { b@1605: return true; b@1605: } b@1605: } b@1605: } b@1605: } else { b@1605: while ( (elem = elem[ dir ]) ) { b@1605: if ( elem.nodeType === 1 || checkNonElements ) { b@1605: outerCache = elem[ expando ] || (elem[ expando ] = {}); b@1605: if ( (oldCache = outerCache[ dir ]) && b@1605: oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { b@1605: b@1605: // Assign to newCache so results back-propagate to previous elements b@1605: return (newCache[ 2 ] = oldCache[ 2 ]); b@1605: } else { b@1605: // Reuse newcache so results back-propagate to previous elements b@1605: outerCache[ dir ] = newCache; b@1605: b@1605: // A match means we're done; a fail means we have to keep checking b@1605: if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { b@1605: return true; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: } b@1605: }; b@1605: } b@1605: b@1605: function elementMatcher( matchers ) { b@1605: return matchers.length > 1 ? b@1605: function( elem, context, xml ) { b@1605: var i = matchers.length; b@1605: while ( i-- ) { b@1605: if ( !matchers[i]( elem, context, xml ) ) { b@1605: return false; b@1605: } b@1605: } b@1605: return true; b@1605: } : b@1605: matchers[0]; b@1605: } b@1605: b@1605: function multipleContexts( selector, contexts, results ) { b@1605: var i = 0, b@1605: len = contexts.length; b@1605: for ( ; i < len; i++ ) { b@1605: Sizzle( selector, contexts[i], results ); b@1605: } b@1605: return results; b@1605: } b@1605: b@1605: function condense( unmatched, map, filter, context, xml ) { b@1605: var elem, b@1605: newUnmatched = [], b@1605: i = 0, b@1605: len = unmatched.length, b@1605: mapped = map != null; b@1605: b@1605: for ( ; i < len; i++ ) { b@1605: if ( (elem = unmatched[i]) ) { b@1605: if ( !filter || filter( elem, context, xml ) ) { b@1605: newUnmatched.push( elem ); b@1605: if ( mapped ) { b@1605: map.push( i ); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: return newUnmatched; b@1605: } b@1605: b@1605: function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { b@1605: if ( postFilter && !postFilter[ expando ] ) { b@1605: postFilter = setMatcher( postFilter ); b@1605: } b@1605: if ( postFinder && !postFinder[ expando ] ) { b@1605: postFinder = setMatcher( postFinder, postSelector ); b@1605: } b@1605: return markFunction(function( seed, results, context, xml ) { b@1605: var temp, i, elem, b@1605: preMap = [], b@1605: postMap = [], b@1605: preexisting = results.length, b@1605: b@1605: // Get initial elements from seed or context b@1605: elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), b@1605: b@1605: // Prefilter to get matcher input, preserving a map for seed-results synchronization b@1605: matcherIn = preFilter && ( seed || !selector ) ? b@1605: condense( elems, preMap, preFilter, context, xml ) : b@1605: elems, b@1605: b@1605: matcherOut = matcher ? b@1605: // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, b@1605: postFinder || ( seed ? preFilter : preexisting || postFilter ) ? b@1605: b@1605: // ...intermediate processing is necessary b@1605: [] : b@1605: b@1605: // ...otherwise use results directly b@1605: results : b@1605: matcherIn; b@1605: b@1605: // Find primary matches b@1605: if ( matcher ) { b@1605: matcher( matcherIn, matcherOut, context, xml ); b@1605: } b@1605: b@1605: // Apply postFilter b@1605: if ( postFilter ) { b@1605: temp = condense( matcherOut, postMap ); b@1605: postFilter( temp, [], context, xml ); b@1605: b@1605: // Un-match failing elements by moving them back to matcherIn b@1605: i = temp.length; b@1605: while ( i-- ) { b@1605: if ( (elem = temp[i]) ) { b@1605: matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); b@1605: } b@1605: } b@1605: } b@1605: b@1605: if ( seed ) { b@1605: if ( postFinder || preFilter ) { b@1605: if ( postFinder ) { b@1605: // Get the final matcherOut by condensing this intermediate into postFinder contexts b@1605: temp = []; b@1605: i = matcherOut.length; b@1605: while ( i-- ) { b@1605: if ( (elem = matcherOut[i]) ) { b@1605: // Restore matcherIn since elem is not yet a final match b@1605: temp.push( (matcherIn[i] = elem) ); b@1605: } b@1605: } b@1605: postFinder( null, (matcherOut = []), temp, xml ); b@1605: } b@1605: b@1605: // Move matched elements from seed to results to keep them synchronized b@1605: i = matcherOut.length; b@1605: while ( i-- ) { b@1605: if ( (elem = matcherOut[i]) && b@1605: (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { b@1605: b@1605: seed[temp] = !(results[temp] = elem); b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Add elements to results, through postFinder if defined b@1605: } else { b@1605: matcherOut = condense( b@1605: matcherOut === results ? b@1605: matcherOut.splice( preexisting, matcherOut.length ) : b@1605: matcherOut b@1605: ); b@1605: if ( postFinder ) { b@1605: postFinder( null, results, matcherOut, xml ); b@1605: } else { b@1605: push.apply( results, matcherOut ); b@1605: } b@1605: } b@1605: }); b@1605: } b@1605: b@1605: function matcherFromTokens( tokens ) { b@1605: var checkContext, matcher, j, b@1605: len = tokens.length, b@1605: leadingRelative = Expr.relative[ tokens[0].type ], b@1605: implicitRelative = leadingRelative || Expr.relative[" "], b@1605: i = leadingRelative ? 1 : 0, b@1605: b@1605: // The foundational matcher ensures that elements are reachable from top-level context(s) b@1605: matchContext = addCombinator( function( elem ) { b@1605: return elem === checkContext; b@1605: }, implicitRelative, true ), b@1605: matchAnyContext = addCombinator( function( elem ) { b@1605: return indexOf( checkContext, elem ) > -1; b@1605: }, implicitRelative, true ), b@1605: matchers = [ function( elem, context, xml ) { b@1605: var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( b@1605: (checkContext = context).nodeType ? b@1605: matchContext( elem, context, xml ) : b@1605: matchAnyContext( elem, context, xml ) ); b@1605: // Avoid hanging onto element (issue #299) b@1605: checkContext = null; b@1605: return ret; b@1605: } ]; b@1605: b@1605: for ( ; i < len; i++ ) { b@1605: if ( (matcher = Expr.relative[ tokens[i].type ]) ) { b@1605: matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; b@1605: } else { b@1605: matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); b@1605: b@1605: // Return special upon seeing a positional matcher b@1605: if ( matcher[ expando ] ) { b@1605: // Find the next relative operator (if any) for proper handling b@1605: j = ++i; b@1605: for ( ; j < len; j++ ) { b@1605: if ( Expr.relative[ tokens[j].type ] ) { b@1605: break; b@1605: } b@1605: } b@1605: return setMatcher( b@1605: i > 1 && elementMatcher( matchers ), b@1605: i > 1 && toSelector( b@1605: // If the preceding token was a descendant combinator, insert an implicit any-element `*` b@1605: tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) b@1605: ).replace( rtrim, "$1" ), b@1605: matcher, b@1605: i < j && matcherFromTokens( tokens.slice( i, j ) ), b@1605: j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), b@1605: j < len && toSelector( tokens ) b@1605: ); b@1605: } b@1605: matchers.push( matcher ); b@1605: } b@1605: } b@1605: b@1605: return elementMatcher( matchers ); b@1605: } b@1605: b@1605: function matcherFromGroupMatchers( elementMatchers, setMatchers ) { b@1605: var bySet = setMatchers.length > 0, b@1605: byElement = elementMatchers.length > 0, b@1605: superMatcher = function( seed, context, xml, results, outermost ) { b@1605: var elem, j, matcher, b@1605: matchedCount = 0, b@1605: i = "0", b@1605: unmatched = seed && [], b@1605: setMatched = [], b@1605: contextBackup = outermostContext, b@1605: // We must always have either seed elements or outermost context b@1605: elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), b@1605: // Use integer dirruns iff this is the outermost matcher b@1605: dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), b@1605: len = elems.length; b@1605: b@1605: if ( outermost ) { b@1605: outermostContext = context !== document && context; b@1605: } b@1605: b@1605: // Add elements passing elementMatchers directly to results b@1605: // Keep `i` a string if there are no elements so `matchedCount` will be "00" below b@1605: // Support: IE<9, Safari b@1605: // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id b@1605: for ( ; i !== len && (elem = elems[i]) != null; i++ ) { b@1605: if ( byElement && elem ) { b@1605: j = 0; b@1605: while ( (matcher = elementMatchers[j++]) ) { b@1605: if ( matcher( elem, context, xml ) ) { b@1605: results.push( elem ); b@1605: break; b@1605: } b@1605: } b@1605: if ( outermost ) { b@1605: dirruns = dirrunsUnique; b@1605: } b@1605: } b@1605: b@1605: // Track unmatched elements for set filters b@1605: if ( bySet ) { b@1605: // They will have gone through all possible matchers b@1605: if ( (elem = !matcher && elem) ) { b@1605: matchedCount--; b@1605: } b@1605: b@1605: // Lengthen the array for every element, matched or not b@1605: if ( seed ) { b@1605: unmatched.push( elem ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Apply set filters to unmatched elements b@1605: matchedCount += i; b@1605: if ( bySet && i !== matchedCount ) { b@1605: j = 0; b@1605: while ( (matcher = setMatchers[j++]) ) { b@1605: matcher( unmatched, setMatched, context, xml ); b@1605: } b@1605: b@1605: if ( seed ) { b@1605: // Reintegrate element matches to eliminate the need for sorting b@1605: if ( matchedCount > 0 ) { b@1605: while ( i-- ) { b@1605: if ( !(unmatched[i] || setMatched[i]) ) { b@1605: setMatched[i] = pop.call( results ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Discard index placeholder values to get only actual matches b@1605: setMatched = condense( setMatched ); b@1605: } b@1605: b@1605: // Add matches to results b@1605: push.apply( results, setMatched ); b@1605: b@1605: // Seedless set matches succeeding multiple successful matchers stipulate sorting b@1605: if ( outermost && !seed && setMatched.length > 0 && b@1605: ( matchedCount + setMatchers.length ) > 1 ) { b@1605: b@1605: Sizzle.uniqueSort( results ); b@1605: } b@1605: } b@1605: b@1605: // Override manipulation of globals by nested matchers b@1605: if ( outermost ) { b@1605: dirruns = dirrunsUnique; b@1605: outermostContext = contextBackup; b@1605: } b@1605: b@1605: return unmatched; b@1605: }; b@1605: b@1605: return bySet ? b@1605: markFunction( superMatcher ) : b@1605: superMatcher; b@1605: } b@1605: b@1605: compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { b@1605: var i, b@1605: setMatchers = [], b@1605: elementMatchers = [], b@1605: cached = compilerCache[ selector + " " ]; b@1605: b@1605: if ( !cached ) { b@1605: // Generate a function of recursive functions that can be used to check each element b@1605: if ( !match ) { b@1605: match = tokenize( selector ); b@1605: } b@1605: i = match.length; b@1605: while ( i-- ) { b@1605: cached = matcherFromTokens( match[i] ); b@1605: if ( cached[ expando ] ) { b@1605: setMatchers.push( cached ); b@1605: } else { b@1605: elementMatchers.push( cached ); b@1605: } b@1605: } b@1605: b@1605: // Cache the compiled function b@1605: cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); b@1605: b@1605: // Save selector and tokenization b@1605: cached.selector = selector; b@1605: } b@1605: return cached; b@1605: }; b@1605: b@1605: /** b@1605: * A low-level selection function that works with Sizzle's compiled b@1605: * selector functions b@1605: * @param {String|Function} selector A selector or a pre-compiled b@1605: * selector function built with Sizzle.compile b@1605: * @param {Element} context b@1605: * @param {Array} [results] b@1605: * @param {Array} [seed] A set of elements to match against b@1605: */ b@1605: select = Sizzle.select = function( selector, context, results, seed ) { b@1605: var i, tokens, token, type, find, b@1605: compiled = typeof selector === "function" && selector, b@1605: match = !seed && tokenize( (selector = compiled.selector || selector) ); b@1605: b@1605: results = results || []; b@1605: b@1605: // Try to minimize operations if there is no seed and only one group b@1605: if ( match.length === 1 ) { b@1605: b@1605: // Take a shortcut and set the context if the root selector is an ID b@1605: tokens = match[0] = match[0].slice( 0 ); b@1605: if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && b@1605: support.getById && context.nodeType === 9 && documentIsHTML && b@1605: Expr.relative[ tokens[1].type ] ) { b@1605: b@1605: context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; b@1605: if ( !context ) { b@1605: return results; b@1605: b@1605: // Precompiled matchers will still verify ancestry, so step up a level b@1605: } else if ( compiled ) { b@1605: context = context.parentNode; b@1605: } b@1605: b@1605: selector = selector.slice( tokens.shift().value.length ); b@1605: } b@1605: b@1605: // Fetch a seed set for right-to-left matching b@1605: i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; b@1605: while ( i-- ) { b@1605: token = tokens[i]; b@1605: b@1605: // Abort if we hit a combinator b@1605: if ( Expr.relative[ (type = token.type) ] ) { b@1605: break; b@1605: } b@1605: if ( (find = Expr.find[ type ]) ) { b@1605: // Search, expanding context for leading sibling combinators b@1605: if ( (seed = find( b@1605: token.matches[0].replace( runescape, funescape ), b@1605: rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context b@1605: )) ) { b@1605: b@1605: // If seed is empty or no tokens remain, we can return early b@1605: tokens.splice( i, 1 ); b@1605: selector = seed.length && toSelector( tokens ); b@1605: if ( !selector ) { b@1605: push.apply( results, seed ); b@1605: return results; b@1605: } b@1605: b@1605: break; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Compile and execute a filtering function if one is not provided b@1605: // Provide `match` to avoid retokenization if we modified the selector above b@1605: ( compiled || compile( selector, match ) )( b@1605: seed, b@1605: context, b@1605: !documentIsHTML, b@1605: results, b@1605: rsibling.test( selector ) && testContext( context.parentNode ) || context b@1605: ); b@1605: return results; b@1605: }; b@1605: b@1605: // One-time assignments b@1605: b@1605: // Sort stability b@1605: support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; b@1605: b@1605: // Support: Chrome 14-35+ b@1605: // Always assume duplicates if they aren't passed to the comparison function b@1605: support.detectDuplicates = !!hasDuplicate; b@1605: b@1605: // Initialize against the default document b@1605: setDocument(); b@1605: b@1605: // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) b@1605: // Detached nodes confoundingly follow *each other* b@1605: support.sortDetached = assert(function( div1 ) { b@1605: // Should return 1, but returns 4 (following) b@1605: return div1.compareDocumentPosition( document.createElement("div") ) & 1; b@1605: }); b@1605: b@1605: // Support: IE<8 b@1605: // Prevent attribute/property "interpolation" b@1605: // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx b@1605: if ( !assert(function( div ) { b@1605: div.innerHTML = ""; b@1605: return div.firstChild.getAttribute("href") === "#" ; b@1605: }) ) { b@1605: addHandle( "type|href|height|width", function( elem, name, isXML ) { b@1605: if ( !isXML ) { b@1605: return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); b@1605: } b@1605: }); b@1605: } b@1605: b@1605: // Support: IE<9 b@1605: // Use defaultValue in place of getAttribute("value") b@1605: if ( !support.attributes || !assert(function( div ) { b@1605: div.innerHTML = ""; b@1605: div.firstChild.setAttribute( "value", "" ); b@1605: return div.firstChild.getAttribute( "value" ) === ""; b@1605: }) ) { b@1605: addHandle( "value", function( elem, name, isXML ) { b@1605: if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { b@1605: return elem.defaultValue; b@1605: } b@1605: }); b@1605: } b@1605: b@1605: // Support: IE<9 b@1605: // Use getAttributeNode to fetch booleans when getAttribute lies b@1605: if ( !assert(function( div ) { b@1605: return div.getAttribute("disabled") == null; b@1605: }) ) { b@1605: addHandle( booleans, function( elem, name, isXML ) { b@1605: var val; b@1605: if ( !isXML ) { b@1605: return elem[ name ] === true ? name.toLowerCase() : b@1605: (val = elem.getAttributeNode( name )) && val.specified ? b@1605: val.value : b@1605: null; b@1605: } b@1605: }); b@1605: } b@1605: b@1605: return Sizzle; b@1605: b@1605: })( window ); b@1605: b@1605: b@1605: b@1605: jQuery.find = Sizzle; b@1605: jQuery.expr = Sizzle.selectors; b@1605: jQuery.expr[":"] = jQuery.expr.pseudos; b@1605: jQuery.unique = Sizzle.uniqueSort; b@1605: jQuery.text = Sizzle.getText; b@1605: jQuery.isXMLDoc = Sizzle.isXML; b@1605: jQuery.contains = Sizzle.contains; b@1605: b@1605: b@1605: b@1605: var rneedsContext = jQuery.expr.match.needsContext; b@1605: b@1605: var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); b@1605: b@1605: b@1605: b@1605: var risSimple = /^.[^:#\[\.,]*$/; b@1605: b@1605: // Implement the identical functionality for filter and not b@1605: function winnow( elements, qualifier, not ) { b@1605: if ( jQuery.isFunction( qualifier ) ) { b@1605: return jQuery.grep( elements, function( elem, i ) { b@1605: /* jshint -W018 */ b@1605: return !!qualifier.call( elem, i, elem ) !== not; b@1605: }); b@1605: b@1605: } b@1605: b@1605: if ( qualifier.nodeType ) { b@1605: return jQuery.grep( elements, function( elem ) { b@1605: return ( elem === qualifier ) !== not; b@1605: }); b@1605: b@1605: } b@1605: b@1605: if ( typeof qualifier === "string" ) { b@1605: if ( risSimple.test( qualifier ) ) { b@1605: return jQuery.filter( qualifier, elements, not ); b@1605: } b@1605: b@1605: qualifier = jQuery.filter( qualifier, elements ); b@1605: } b@1605: b@1605: return jQuery.grep( elements, function( elem ) { b@1605: return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; b@1605: }); b@1605: } b@1605: b@1605: jQuery.filter = function( expr, elems, not ) { b@1605: var elem = elems[ 0 ]; b@1605: b@1605: if ( not ) { b@1605: expr = ":not(" + expr + ")"; b@1605: } b@1605: b@1605: return elems.length === 1 && elem.nodeType === 1 ? b@1605: jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : b@1605: jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { b@1605: return elem.nodeType === 1; b@1605: })); b@1605: }; b@1605: b@1605: jQuery.fn.extend({ b@1605: find: function( selector ) { b@1605: var i, b@1605: len = this.length, b@1605: ret = [], b@1605: self = this; b@1605: b@1605: if ( typeof selector !== "string" ) { b@1605: return this.pushStack( jQuery( selector ).filter(function() { b@1605: for ( i = 0; i < len; i++ ) { b@1605: if ( jQuery.contains( self[ i ], this ) ) { b@1605: return true; b@1605: } b@1605: } b@1605: }) ); b@1605: } b@1605: b@1605: for ( i = 0; i < len; i++ ) { b@1605: jQuery.find( selector, self[ i ], ret ); b@1605: } b@1605: b@1605: // Needed because $( selector, context ) becomes $( context ).find( selector ) b@1605: ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); b@1605: ret.selector = this.selector ? this.selector + " " + selector : selector; b@1605: return ret; b@1605: }, b@1605: filter: function( selector ) { b@1605: return this.pushStack( winnow(this, selector || [], false) ); b@1605: }, b@1605: not: function( selector ) { b@1605: return this.pushStack( winnow(this, selector || [], true) ); b@1605: }, b@1605: is: function( selector ) { b@1605: return !!winnow( b@1605: this, b@1605: b@1605: // If this is a positional/relative selector, check membership in the returned set b@1605: // so $("p:first").is("p:last") won't return true for a doc with two "p". b@1605: typeof selector === "string" && rneedsContext.test( selector ) ? b@1605: jQuery( selector ) : b@1605: selector || [], b@1605: false b@1605: ).length; b@1605: } b@1605: }); b@1605: b@1605: b@1605: // Initialize a jQuery object b@1605: b@1605: b@1605: // A central reference to the root jQuery(document) b@1605: var rootjQuery, b@1605: b@1605: // A simple way to check for HTML strings b@1605: // Prioritize #id over to avoid XSS via location.hash (#9521) b@1605: // Strict HTML recognition (#11290: must start with <) b@1605: rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, b@1605: b@1605: init = jQuery.fn.init = function( selector, context ) { b@1605: var match, elem; b@1605: b@1605: // HANDLE: $(""), $(null), $(undefined), $(false) b@1605: if ( !selector ) { b@1605: return this; b@1605: } b@1605: b@1605: // Handle HTML strings b@1605: if ( typeof selector === "string" ) { b@1605: if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { b@1605: // Assume that strings that start and end with <> are HTML and skip the regex check b@1605: match = [ null, selector, null ]; b@1605: b@1605: } else { b@1605: match = rquickExpr.exec( selector ); b@1605: } b@1605: b@1605: // Match html or make sure no context is specified for #id b@1605: if ( match && (match[1] || !context) ) { b@1605: b@1605: // HANDLE: $(html) -> $(array) b@1605: if ( match[1] ) { b@1605: context = context instanceof jQuery ? context[0] : context; b@1605: b@1605: // Option to run scripts is true for back-compat b@1605: // Intentionally let the error be thrown if parseHTML is not present b@1605: jQuery.merge( this, jQuery.parseHTML( b@1605: match[1], b@1605: context && context.nodeType ? context.ownerDocument || context : document, b@1605: true b@1605: ) ); b@1605: b@1605: // HANDLE: $(html, props) b@1605: if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { b@1605: for ( match in context ) { b@1605: // Properties of context are called as methods if possible b@1605: if ( jQuery.isFunction( this[ match ] ) ) { b@1605: this[ match ]( context[ match ] ); b@1605: b@1605: // ...and otherwise set as attributes b@1605: } else { b@1605: this.attr( match, context[ match ] ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: return this; b@1605: b@1605: // HANDLE: $(#id) b@1605: } else { b@1605: elem = document.getElementById( match[2] ); b@1605: b@1605: // Support: Blackberry 4.6 b@1605: // gEBID returns nodes no longer in the document (#6963) b@1605: if ( elem && elem.parentNode ) { b@1605: // Inject the element directly into the jQuery object b@1605: this.length = 1; b@1605: this[0] = elem; b@1605: } b@1605: b@1605: this.context = document; b@1605: this.selector = selector; b@1605: return this; b@1605: } b@1605: b@1605: // HANDLE: $(expr, $(...)) b@1605: } else if ( !context || context.jquery ) { b@1605: return ( context || rootjQuery ).find( selector ); b@1605: b@1605: // HANDLE: $(expr, context) b@1605: // (which is just equivalent to: $(context).find(expr) b@1605: } else { b@1605: return this.constructor( context ).find( selector ); b@1605: } b@1605: b@1605: // HANDLE: $(DOMElement) b@1605: } else if ( selector.nodeType ) { b@1605: this.context = this[0] = selector; b@1605: this.length = 1; b@1605: return this; b@1605: b@1605: // HANDLE: $(function) b@1605: // Shortcut for document ready b@1605: } else if ( jQuery.isFunction( selector ) ) { b@1605: return typeof rootjQuery.ready !== "undefined" ? b@1605: rootjQuery.ready( selector ) : b@1605: // Execute immediately if ready is not present b@1605: selector( jQuery ); b@1605: } b@1605: b@1605: if ( selector.selector !== undefined ) { b@1605: this.selector = selector.selector; b@1605: this.context = selector.context; b@1605: } b@1605: b@1605: return jQuery.makeArray( selector, this ); b@1605: }; b@1605: b@1605: // Give the init function the jQuery prototype for later instantiation b@1605: init.prototype = jQuery.fn; b@1605: b@1605: // Initialize central reference b@1605: rootjQuery = jQuery( document ); b@1605: b@1605: b@1605: var rparentsprev = /^(?:parents|prev(?:Until|All))/, b@1605: // Methods guaranteed to produce a unique set when starting from a unique set b@1605: guaranteedUnique = { b@1605: children: true, b@1605: contents: true, b@1605: next: true, b@1605: prev: true b@1605: }; b@1605: b@1605: jQuery.extend({ b@1605: dir: function( elem, dir, until ) { b@1605: var matched = [], b@1605: truncate = until !== undefined; b@1605: b@1605: while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) { b@1605: if ( elem.nodeType === 1 ) { b@1605: if ( truncate && jQuery( elem ).is( until ) ) { b@1605: break; b@1605: } b@1605: matched.push( elem ); b@1605: } b@1605: } b@1605: return matched; b@1605: }, b@1605: b@1605: sibling: function( n, elem ) { b@1605: var matched = []; b@1605: b@1605: for ( ; n; n = n.nextSibling ) { b@1605: if ( n.nodeType === 1 && n !== elem ) { b@1605: matched.push( n ); b@1605: } b@1605: } b@1605: b@1605: return matched; b@1605: } b@1605: }); b@1605: b@1605: jQuery.fn.extend({ b@1605: has: function( target ) { b@1605: var targets = jQuery( target, this ), b@1605: l = targets.length; b@1605: b@1605: return this.filter(function() { b@1605: var i = 0; b@1605: for ( ; i < l; i++ ) { b@1605: if ( jQuery.contains( this, targets[i] ) ) { b@1605: return true; b@1605: } b@1605: } b@1605: }); b@1605: }, b@1605: b@1605: closest: function( selectors, context ) { b@1605: var cur, b@1605: i = 0, b@1605: l = this.length, b@1605: matched = [], b@1605: pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? b@1605: jQuery( selectors, context || this.context ) : b@1605: 0; b@1605: b@1605: for ( ; i < l; i++ ) { b@1605: for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) { b@1605: // Always skip document fragments b@1605: if ( cur.nodeType < 11 && (pos ? b@1605: pos.index(cur) > -1 : b@1605: b@1605: // Don't pass non-elements to Sizzle b@1605: cur.nodeType === 1 && b@1605: jQuery.find.matchesSelector(cur, selectors)) ) { b@1605: b@1605: matched.push( cur ); b@1605: break; b@1605: } b@1605: } b@1605: } b@1605: b@1605: return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched ); b@1605: }, b@1605: b@1605: // Determine the position of an element within the set b@1605: index: function( elem ) { b@1605: b@1605: // No argument, return index in parent b@1605: if ( !elem ) { b@1605: return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; b@1605: } b@1605: b@1605: // Index in selector b@1605: if ( typeof elem === "string" ) { b@1605: return indexOf.call( jQuery( elem ), this[ 0 ] ); b@1605: } b@1605: b@1605: // Locate the position of the desired element b@1605: return indexOf.call( this, b@1605: b@1605: // If it receives a jQuery object, the first element is used b@1605: elem.jquery ? elem[ 0 ] : elem b@1605: ); b@1605: }, b@1605: b@1605: add: function( selector, context ) { b@1605: return this.pushStack( b@1605: jQuery.unique( b@1605: jQuery.merge( this.get(), jQuery( selector, context ) ) b@1605: ) b@1605: ); b@1605: }, b@1605: b@1605: addBack: function( selector ) { b@1605: return this.add( selector == null ? b@1605: this.prevObject : this.prevObject.filter(selector) b@1605: ); b@1605: } b@1605: }); b@1605: b@1605: function sibling( cur, dir ) { b@1605: while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {} b@1605: return cur; b@1605: } b@1605: b@1605: jQuery.each({ b@1605: parent: function( elem ) { b@1605: var parent = elem.parentNode; b@1605: return parent && parent.nodeType !== 11 ? parent : null; b@1605: }, b@1605: parents: function( elem ) { b@1605: return jQuery.dir( elem, "parentNode" ); b@1605: }, b@1605: parentsUntil: function( elem, i, until ) { b@1605: return jQuery.dir( elem, "parentNode", until ); b@1605: }, b@1605: next: function( elem ) { b@1605: return sibling( elem, "nextSibling" ); b@1605: }, b@1605: prev: function( elem ) { b@1605: return sibling( elem, "previousSibling" ); b@1605: }, b@1605: nextAll: function( elem ) { b@1605: return jQuery.dir( elem, "nextSibling" ); b@1605: }, b@1605: prevAll: function( elem ) { b@1605: return jQuery.dir( elem, "previousSibling" ); b@1605: }, b@1605: nextUntil: function( elem, i, until ) { b@1605: return jQuery.dir( elem, "nextSibling", until ); b@1605: }, b@1605: prevUntil: function( elem, i, until ) { b@1605: return jQuery.dir( elem, "previousSibling", until ); b@1605: }, b@1605: siblings: function( elem ) { b@1605: return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); b@1605: }, b@1605: children: function( elem ) { b@1605: return jQuery.sibling( elem.firstChild ); b@1605: }, b@1605: contents: function( elem ) { b@1605: return elem.contentDocument || jQuery.merge( [], elem.childNodes ); b@1605: } b@1605: }, function( name, fn ) { b@1605: jQuery.fn[ name ] = function( until, selector ) { b@1605: var matched = jQuery.map( this, fn, until ); b@1605: b@1605: if ( name.slice( -5 ) !== "Until" ) { b@1605: selector = until; b@1605: } b@1605: b@1605: if ( selector && typeof selector === "string" ) { b@1605: matched = jQuery.filter( selector, matched ); b@1605: } b@1605: b@1605: if ( this.length > 1 ) { b@1605: // Remove duplicates b@1605: if ( !guaranteedUnique[ name ] ) { b@1605: jQuery.unique( matched ); b@1605: } b@1605: b@1605: // Reverse order for parents* and prev-derivatives b@1605: if ( rparentsprev.test( name ) ) { b@1605: matched.reverse(); b@1605: } b@1605: } b@1605: b@1605: return this.pushStack( matched ); b@1605: }; b@1605: }); b@1605: var rnotwhite = (/\S+/g); b@1605: b@1605: b@1605: b@1605: // String to Object options format cache b@1605: var optionsCache = {}; b@1605: b@1605: // Convert String-formatted options into Object-formatted ones and store in cache b@1605: function createOptions( options ) { b@1605: var object = optionsCache[ options ] = {}; b@1605: jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { b@1605: object[ flag ] = true; b@1605: }); b@1605: return object; b@1605: } b@1605: b@1605: /* b@1605: * Create a callback list using the following parameters: b@1605: * b@1605: * options: an optional list of space-separated options that will change how b@1605: * the callback list behaves or a more traditional option object b@1605: * b@1605: * By default a callback list will act like an event callback list and can be b@1605: * "fired" multiple times. b@1605: * b@1605: * Possible options: b@1605: * b@1605: * once: will ensure the callback list can only be fired once (like a Deferred) b@1605: * b@1605: * memory: will keep track of previous values and will call any callback added b@1605: * after the list has been fired right away with the latest "memorized" b@1605: * values (like a Deferred) b@1605: * b@1605: * unique: will ensure a callback can only be added once (no duplicate in the list) b@1605: * b@1605: * stopOnFalse: interrupt callings when a callback returns false b@1605: * b@1605: */ b@1605: jQuery.Callbacks = function( options ) { b@1605: b@1605: // Convert options from String-formatted to Object-formatted if needed b@1605: // (we check in cache first) b@1605: options = typeof options === "string" ? b@1605: ( optionsCache[ options ] || createOptions( options ) ) : b@1605: jQuery.extend( {}, options ); b@1605: b@1605: var // Last fire value (for non-forgettable lists) b@1605: memory, b@1605: // Flag to know if list was already fired b@1605: fired, b@1605: // Flag to know if list is currently firing b@1605: firing, b@1605: // First callback to fire (used internally by add and fireWith) b@1605: firingStart, b@1605: // End of the loop when firing b@1605: firingLength, b@1605: // Index of currently firing callback (modified by remove if needed) b@1605: firingIndex, b@1605: // Actual callback list b@1605: list = [], b@1605: // Stack of fire calls for repeatable lists b@1605: stack = !options.once && [], b@1605: // Fire callbacks b@1605: fire = function( data ) { b@1605: memory = options.memory && data; b@1605: fired = true; b@1605: firingIndex = firingStart || 0; b@1605: firingStart = 0; b@1605: firingLength = list.length; b@1605: firing = true; b@1605: for ( ; list && firingIndex < firingLength; firingIndex++ ) { b@1605: if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { b@1605: memory = false; // To prevent further calls using add b@1605: break; b@1605: } b@1605: } b@1605: firing = false; b@1605: if ( list ) { b@1605: if ( stack ) { b@1605: if ( stack.length ) { b@1605: fire( stack.shift() ); b@1605: } b@1605: } else if ( memory ) { b@1605: list = []; b@1605: } else { b@1605: self.disable(); b@1605: } b@1605: } b@1605: }, b@1605: // Actual Callbacks object b@1605: self = { b@1605: // Add a callback or a collection of callbacks to the list b@1605: add: function() { b@1605: if ( list ) { b@1605: // First, we save the current length b@1605: var start = list.length; b@1605: (function add( args ) { b@1605: jQuery.each( args, function( _, arg ) { b@1605: var type = jQuery.type( arg ); b@1605: if ( type === "function" ) { b@1605: if ( !options.unique || !self.has( arg ) ) { b@1605: list.push( arg ); b@1605: } b@1605: } else if ( arg && arg.length && type !== "string" ) { b@1605: // Inspect recursively b@1605: add( arg ); b@1605: } b@1605: }); b@1605: })( arguments ); b@1605: // Do we need to add the callbacks to the b@1605: // current firing batch? b@1605: if ( firing ) { b@1605: firingLength = list.length; b@1605: // With memory, if we're not firing then b@1605: // we should call right away b@1605: } else if ( memory ) { b@1605: firingStart = start; b@1605: fire( memory ); b@1605: } b@1605: } b@1605: return this; b@1605: }, b@1605: // Remove a callback from the list b@1605: remove: function() { b@1605: if ( list ) { b@1605: jQuery.each( arguments, function( _, arg ) { b@1605: var index; b@1605: while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { b@1605: list.splice( index, 1 ); b@1605: // Handle firing indexes b@1605: if ( firing ) { b@1605: if ( index <= firingLength ) { b@1605: firingLength--; b@1605: } b@1605: if ( index <= firingIndex ) { b@1605: firingIndex--; b@1605: } b@1605: } b@1605: } b@1605: }); b@1605: } b@1605: return this; b@1605: }, b@1605: // Check if a given callback is in the list. b@1605: // If no argument is given, return whether or not list has callbacks attached. b@1605: has: function( fn ) { b@1605: return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); b@1605: }, b@1605: // Remove all callbacks from the list b@1605: empty: function() { b@1605: list = []; b@1605: firingLength = 0; b@1605: return this; b@1605: }, b@1605: // Have the list do nothing anymore b@1605: disable: function() { b@1605: list = stack = memory = undefined; b@1605: return this; b@1605: }, b@1605: // Is it disabled? b@1605: disabled: function() { b@1605: return !list; b@1605: }, b@1605: // Lock the list in its current state b@1605: lock: function() { b@1605: stack = undefined; b@1605: if ( !memory ) { b@1605: self.disable(); b@1605: } b@1605: return this; b@1605: }, b@1605: // Is it locked? b@1605: locked: function() { b@1605: return !stack; b@1605: }, b@1605: // Call all callbacks with the given context and arguments b@1605: fireWith: function( context, args ) { b@1605: if ( list && ( !fired || stack ) ) { b@1605: args = args || []; b@1605: args = [ context, args.slice ? args.slice() : args ]; b@1605: if ( firing ) { b@1605: stack.push( args ); b@1605: } else { b@1605: fire( args ); b@1605: } b@1605: } b@1605: return this; b@1605: }, b@1605: // Call all the callbacks with the given arguments b@1605: fire: function() { b@1605: self.fireWith( this, arguments ); b@1605: return this; b@1605: }, b@1605: // To know if the callbacks have already been called at least once b@1605: fired: function() { b@1605: return !!fired; b@1605: } b@1605: }; b@1605: b@1605: return self; b@1605: }; b@1605: b@1605: b@1605: jQuery.extend({ b@1605: b@1605: Deferred: function( func ) { b@1605: var tuples = [ b@1605: // action, add listener, listener list, final state b@1605: [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], b@1605: [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], b@1605: [ "notify", "progress", jQuery.Callbacks("memory") ] b@1605: ], b@1605: state = "pending", b@1605: promise = { b@1605: state: function() { b@1605: return state; b@1605: }, b@1605: always: function() { b@1605: deferred.done( arguments ).fail( arguments ); b@1605: return this; b@1605: }, b@1605: then: function( /* fnDone, fnFail, fnProgress */ ) { b@1605: var fns = arguments; b@1605: return jQuery.Deferred(function( newDefer ) { b@1605: jQuery.each( tuples, function( i, tuple ) { b@1605: var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; b@1605: // deferred[ done | fail | progress ] for forwarding actions to newDefer b@1605: deferred[ tuple[1] ](function() { b@1605: var returned = fn && fn.apply( this, arguments ); b@1605: if ( returned && jQuery.isFunction( returned.promise ) ) { b@1605: returned.promise() b@1605: .done( newDefer.resolve ) b@1605: .fail( newDefer.reject ) b@1605: .progress( newDefer.notify ); b@1605: } else { b@1605: newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); b@1605: } b@1605: }); b@1605: }); b@1605: fns = null; b@1605: }).promise(); b@1605: }, b@1605: // Get a promise for this deferred b@1605: // If obj is provided, the promise aspect is added to the object b@1605: promise: function( obj ) { b@1605: return obj != null ? jQuery.extend( obj, promise ) : promise; b@1605: } b@1605: }, b@1605: deferred = {}; b@1605: b@1605: // Keep pipe for back-compat b@1605: promise.pipe = promise.then; b@1605: b@1605: // Add list-specific methods b@1605: jQuery.each( tuples, function( i, tuple ) { b@1605: var list = tuple[ 2 ], b@1605: stateString = tuple[ 3 ]; b@1605: b@1605: // promise[ done | fail | progress ] = list.add b@1605: promise[ tuple[1] ] = list.add; b@1605: b@1605: // Handle state b@1605: if ( stateString ) { b@1605: list.add(function() { b@1605: // state = [ resolved | rejected ] b@1605: state = stateString; b@1605: b@1605: // [ reject_list | resolve_list ].disable; progress_list.lock b@1605: }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); b@1605: } b@1605: b@1605: // deferred[ resolve | reject | notify ] b@1605: deferred[ tuple[0] ] = function() { b@1605: deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); b@1605: return this; b@1605: }; b@1605: deferred[ tuple[0] + "With" ] = list.fireWith; b@1605: }); b@1605: b@1605: // Make the deferred a promise b@1605: promise.promise( deferred ); b@1605: b@1605: // Call given func if any b@1605: if ( func ) { b@1605: func.call( deferred, deferred ); b@1605: } b@1605: b@1605: // All done! b@1605: return deferred; b@1605: }, b@1605: b@1605: // Deferred helper b@1605: when: function( subordinate /* , ..., subordinateN */ ) { b@1605: var i = 0, b@1605: resolveValues = slice.call( arguments ), b@1605: length = resolveValues.length, b@1605: b@1605: // the count of uncompleted subordinates b@1605: remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, b@1605: b@1605: // the master Deferred. If resolveValues consist of only a single Deferred, just use that. b@1605: deferred = remaining === 1 ? subordinate : jQuery.Deferred(), b@1605: b@1605: // Update function for both resolve and progress values b@1605: updateFunc = function( i, contexts, values ) { b@1605: return function( value ) { b@1605: contexts[ i ] = this; b@1605: values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; b@1605: if ( values === progressValues ) { b@1605: deferred.notifyWith( contexts, values ); b@1605: } else if ( !( --remaining ) ) { b@1605: deferred.resolveWith( contexts, values ); b@1605: } b@1605: }; b@1605: }, b@1605: b@1605: progressValues, progressContexts, resolveContexts; b@1605: b@1605: // Add listeners to Deferred subordinates; treat others as resolved b@1605: if ( length > 1 ) { b@1605: progressValues = new Array( length ); b@1605: progressContexts = new Array( length ); b@1605: resolveContexts = new Array( length ); b@1605: for ( ; i < length; i++ ) { b@1605: if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { b@1605: resolveValues[ i ].promise() b@1605: .done( updateFunc( i, resolveContexts, resolveValues ) ) b@1605: .fail( deferred.reject ) b@1605: .progress( updateFunc( i, progressContexts, progressValues ) ); b@1605: } else { b@1605: --remaining; b@1605: } b@1605: } b@1605: } b@1605: b@1605: // If we're not waiting on anything, resolve the master b@1605: if ( !remaining ) { b@1605: deferred.resolveWith( resolveContexts, resolveValues ); b@1605: } b@1605: b@1605: return deferred.promise(); b@1605: } b@1605: }); b@1605: b@1605: b@1605: // The deferred used on DOM ready b@1605: var readyList; b@1605: b@1605: jQuery.fn.ready = function( fn ) { b@1605: // Add the callback b@1605: jQuery.ready.promise().done( fn ); b@1605: b@1605: return this; b@1605: }; b@1605: b@1605: jQuery.extend({ b@1605: // Is the DOM ready to be used? Set to true once it occurs. b@1605: isReady: false, b@1605: b@1605: // A counter to track how many items to wait for before b@1605: // the ready event fires. See #6781 b@1605: readyWait: 1, b@1605: b@1605: // Hold (or release) the ready event b@1605: holdReady: function( hold ) { b@1605: if ( hold ) { b@1605: jQuery.readyWait++; b@1605: } else { b@1605: jQuery.ready( true ); b@1605: } b@1605: }, b@1605: b@1605: // Handle when the DOM is ready b@1605: ready: function( wait ) { b@1605: b@1605: // Abort if there are pending holds or we're already ready b@1605: if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { b@1605: return; b@1605: } b@1605: b@1605: // Remember that the DOM is ready b@1605: jQuery.isReady = true; b@1605: b@1605: // If a normal DOM Ready event fired, decrement, and wait if need be b@1605: if ( wait !== true && --jQuery.readyWait > 0 ) { b@1605: return; b@1605: } b@1605: b@1605: // If there are functions bound, to execute b@1605: readyList.resolveWith( document, [ jQuery ] ); b@1605: b@1605: // Trigger any bound ready events b@1605: if ( jQuery.fn.triggerHandler ) { b@1605: jQuery( document ).triggerHandler( "ready" ); b@1605: jQuery( document ).off( "ready" ); b@1605: } b@1605: } b@1605: }); b@1605: b@1605: /** b@1605: * The ready event handler and self cleanup method b@1605: */ b@1605: function completed() { b@1605: document.removeEventListener( "DOMContentLoaded", completed, false ); b@1605: window.removeEventListener( "load", completed, false ); b@1605: jQuery.ready(); b@1605: } b@1605: b@1605: jQuery.ready.promise = function( obj ) { b@1605: if ( !readyList ) { b@1605: b@1605: readyList = jQuery.Deferred(); b@1605: b@1605: // Catch cases where $(document).ready() is called after the browser event has already occurred. b@1605: // We once tried to use readyState "interactive" here, but it caused issues like the one b@1605: // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 b@1605: if ( document.readyState === "complete" ) { b@1605: // Handle it asynchronously to allow scripts the opportunity to delay ready b@1605: setTimeout( jQuery.ready ); b@1605: b@1605: } else { b@1605: b@1605: // Use the handy event callback b@1605: document.addEventListener( "DOMContentLoaded", completed, false ); b@1605: b@1605: // A fallback to window.onload, that will always work b@1605: window.addEventListener( "load", completed, false ); b@1605: } b@1605: } b@1605: return readyList.promise( obj ); b@1605: }; b@1605: b@1605: // Kick off the DOM ready check even if the user does not b@1605: jQuery.ready.promise(); b@1605: b@1605: b@1605: b@1605: b@1605: // Multifunctional method to get and set values of a collection b@1605: // The value/s can optionally be executed if it's a function b@1605: var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { b@1605: var i = 0, b@1605: len = elems.length, b@1605: bulk = key == null; b@1605: b@1605: // Sets many values b@1605: if ( jQuery.type( key ) === "object" ) { b@1605: chainable = true; b@1605: for ( i in key ) { b@1605: jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); b@1605: } b@1605: b@1605: // Sets one value b@1605: } else if ( value !== undefined ) { b@1605: chainable = true; b@1605: b@1605: if ( !jQuery.isFunction( value ) ) { b@1605: raw = true; b@1605: } b@1605: b@1605: if ( bulk ) { b@1605: // Bulk operations run against the entire set b@1605: if ( raw ) { b@1605: fn.call( elems, value ); b@1605: fn = null; b@1605: b@1605: // ...except when executing function values b@1605: } else { b@1605: bulk = fn; b@1605: fn = function( elem, key, value ) { b@1605: return bulk.call( jQuery( elem ), value ); b@1605: }; b@1605: } b@1605: } b@1605: b@1605: if ( fn ) { b@1605: for ( ; i < len; i++ ) { b@1605: fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: return chainable ? b@1605: elems : b@1605: b@1605: // Gets b@1605: bulk ? b@1605: fn.call( elems ) : b@1605: len ? fn( elems[0], key ) : emptyGet; b@1605: }; b@1605: b@1605: b@1605: /** b@1605: * Determines whether an object can have data b@1605: */ b@1605: jQuery.acceptData = function( owner ) { b@1605: // Accepts only: b@1605: // - Node b@1605: // - Node.ELEMENT_NODE b@1605: // - Node.DOCUMENT_NODE b@1605: // - Object b@1605: // - Any b@1605: /* jshint -W018 */ b@1605: return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); b@1605: }; b@1605: b@1605: b@1605: function Data() { b@1605: // Support: Android<4, b@1605: // Old WebKit does not have Object.preventExtensions/freeze method, b@1605: // return new empty object instead with no [[set]] accessor b@1605: Object.defineProperty( this.cache = {}, 0, { b@1605: get: function() { b@1605: return {}; b@1605: } b@1605: }); b@1605: b@1605: this.expando = jQuery.expando + Data.uid++; b@1605: } b@1605: b@1605: Data.uid = 1; b@1605: Data.accepts = jQuery.acceptData; b@1605: b@1605: Data.prototype = { b@1605: key: function( owner ) { b@1605: // We can accept data for non-element nodes in modern browsers, b@1605: // but we should not, see #8335. b@1605: // Always return the key for a frozen object. b@1605: if ( !Data.accepts( owner ) ) { b@1605: return 0; b@1605: } b@1605: b@1605: var descriptor = {}, b@1605: // Check if the owner object already has a cache key b@1605: unlock = owner[ this.expando ]; b@1605: b@1605: // If not, create one b@1605: if ( !unlock ) { b@1605: unlock = Data.uid++; b@1605: b@1605: // Secure it in a non-enumerable, non-writable property b@1605: try { b@1605: descriptor[ this.expando ] = { value: unlock }; b@1605: Object.defineProperties( owner, descriptor ); b@1605: b@1605: // Support: Android<4 b@1605: // Fallback to a less secure definition b@1605: } catch ( e ) { b@1605: descriptor[ this.expando ] = unlock; b@1605: jQuery.extend( owner, descriptor ); b@1605: } b@1605: } b@1605: b@1605: // Ensure the cache object b@1605: if ( !this.cache[ unlock ] ) { b@1605: this.cache[ unlock ] = {}; b@1605: } b@1605: b@1605: return unlock; b@1605: }, b@1605: set: function( owner, data, value ) { b@1605: var prop, b@1605: // There may be an unlock assigned to this node, b@1605: // if there is no entry for this "owner", create one inline b@1605: // and set the unlock as though an owner entry had always existed b@1605: unlock = this.key( owner ), b@1605: cache = this.cache[ unlock ]; b@1605: b@1605: // Handle: [ owner, key, value ] args b@1605: if ( typeof data === "string" ) { b@1605: cache[ data ] = value; b@1605: b@1605: // Handle: [ owner, { properties } ] args b@1605: } else { b@1605: // Fresh assignments by object are shallow copied b@1605: if ( jQuery.isEmptyObject( cache ) ) { b@1605: jQuery.extend( this.cache[ unlock ], data ); b@1605: // Otherwise, copy the properties one-by-one to the cache object b@1605: } else { b@1605: for ( prop in data ) { b@1605: cache[ prop ] = data[ prop ]; b@1605: } b@1605: } b@1605: } b@1605: return cache; b@1605: }, b@1605: get: function( owner, key ) { b@1605: // Either a valid cache is found, or will be created. b@1605: // New caches will be created and the unlock returned, b@1605: // allowing direct access to the newly created b@1605: // empty data object. A valid owner object must be provided. b@1605: var cache = this.cache[ this.key( owner ) ]; b@1605: b@1605: return key === undefined ? b@1605: cache : cache[ key ]; b@1605: }, b@1605: access: function( owner, key, value ) { b@1605: var stored; b@1605: // In cases where either: b@1605: // b@1605: // 1. No key was specified b@1605: // 2. A string key was specified, but no value provided b@1605: // b@1605: // Take the "read" path and allow the get method to determine b@1605: // which value to return, respectively either: b@1605: // b@1605: // 1. The entire cache object b@1605: // 2. The data stored at the key b@1605: // b@1605: if ( key === undefined || b@1605: ((key && typeof key === "string") && value === undefined) ) { b@1605: b@1605: stored = this.get( owner, key ); b@1605: b@1605: return stored !== undefined ? b@1605: stored : this.get( owner, jQuery.camelCase(key) ); b@1605: } b@1605: b@1605: // [*]When the key is not a string, or both a key and value b@1605: // are specified, set or extend (existing objects) with either: b@1605: // b@1605: // 1. An object of properties b@1605: // 2. A key and value b@1605: // b@1605: this.set( owner, key, value ); b@1605: b@1605: // Since the "set" path can have two possible entry points b@1605: // return the expected data based on which path was taken[*] b@1605: return value !== undefined ? value : key; b@1605: }, b@1605: remove: function( owner, key ) { b@1605: var i, name, camel, b@1605: unlock = this.key( owner ), b@1605: cache = this.cache[ unlock ]; b@1605: b@1605: if ( key === undefined ) { b@1605: this.cache[ unlock ] = {}; b@1605: b@1605: } else { b@1605: // Support array or space separated string of keys b@1605: if ( jQuery.isArray( key ) ) { b@1605: // If "name" is an array of keys... b@1605: // When data is initially created, via ("key", "val") signature, b@1605: // keys will be converted to camelCase. b@1605: // Since there is no way to tell _how_ a key was added, remove b@1605: // both plain key and camelCase key. #12786 b@1605: // This will only penalize the array argument path. b@1605: name = key.concat( key.map( jQuery.camelCase ) ); b@1605: } else { b@1605: camel = jQuery.camelCase( key ); b@1605: // Try the string as a key before any manipulation b@1605: if ( key in cache ) { b@1605: name = [ key, camel ]; b@1605: } else { b@1605: // If a key with the spaces exists, use it. b@1605: // Otherwise, create an array by matching non-whitespace b@1605: name = camel; b@1605: name = name in cache ? b@1605: [ name ] : ( name.match( rnotwhite ) || [] ); b@1605: } b@1605: } b@1605: b@1605: i = name.length; b@1605: while ( i-- ) { b@1605: delete cache[ name[ i ] ]; b@1605: } b@1605: } b@1605: }, b@1605: hasData: function( owner ) { b@1605: return !jQuery.isEmptyObject( b@1605: this.cache[ owner[ this.expando ] ] || {} b@1605: ); b@1605: }, b@1605: discard: function( owner ) { b@1605: if ( owner[ this.expando ] ) { b@1605: delete this.cache[ owner[ this.expando ] ]; b@1605: } b@1605: } b@1605: }; b@1605: var data_priv = new Data(); b@1605: b@1605: var data_user = new Data(); b@1605: b@1605: b@1605: b@1605: // Implementation Summary b@1605: // b@1605: // 1. Enforce API surface and semantic compatibility with 1.9.x branch b@1605: // 2. Improve the module's maintainability by reducing the storage b@1605: // paths to a single mechanism. b@1605: // 3. Use the same single mechanism to support "private" and "user" data. b@1605: // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) b@1605: // 5. Avoid exposing implementation details on user objects (eg. expando properties) b@1605: // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 b@1605: b@1605: var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, b@1605: rmultiDash = /([A-Z])/g; b@1605: b@1605: function dataAttr( elem, key, data ) { b@1605: var name; b@1605: b@1605: // If nothing was found internally, try to fetch any b@1605: // data from the HTML5 data-* attribute b@1605: if ( data === undefined && elem.nodeType === 1 ) { b@1605: name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); b@1605: data = elem.getAttribute( name ); b@1605: b@1605: if ( typeof data === "string" ) { b@1605: try { b@1605: data = data === "true" ? true : b@1605: data === "false" ? false : b@1605: data === "null" ? null : b@1605: // Only convert to a number if it doesn't change the string b@1605: +data + "" === data ? +data : b@1605: rbrace.test( data ) ? jQuery.parseJSON( data ) : b@1605: data; b@1605: } catch( e ) {} b@1605: b@1605: // Make sure we set the data so it isn't changed later b@1605: data_user.set( elem, key, data ); b@1605: } else { b@1605: data = undefined; b@1605: } b@1605: } b@1605: return data; b@1605: } b@1605: b@1605: jQuery.extend({ b@1605: hasData: function( elem ) { b@1605: return data_user.hasData( elem ) || data_priv.hasData( elem ); b@1605: }, b@1605: b@1605: data: function( elem, name, data ) { b@1605: return data_user.access( elem, name, data ); b@1605: }, b@1605: b@1605: removeData: function( elem, name ) { b@1605: data_user.remove( elem, name ); b@1605: }, b@1605: b@1605: // TODO: Now that all calls to _data and _removeData have been replaced b@1605: // with direct calls to data_priv methods, these can be deprecated. b@1605: _data: function( elem, name, data ) { b@1605: return data_priv.access( elem, name, data ); b@1605: }, b@1605: b@1605: _removeData: function( elem, name ) { b@1605: data_priv.remove( elem, name ); b@1605: } b@1605: }); b@1605: b@1605: jQuery.fn.extend({ b@1605: data: function( key, value ) { b@1605: var i, name, data, b@1605: elem = this[ 0 ], b@1605: attrs = elem && elem.attributes; b@1605: b@1605: // Gets all values b@1605: if ( key === undefined ) { b@1605: if ( this.length ) { b@1605: data = data_user.get( elem ); b@1605: b@1605: if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) { b@1605: i = attrs.length; b@1605: while ( i-- ) { b@1605: b@1605: // Support: IE11+ b@1605: // The attrs elements can be null (#14894) b@1605: if ( attrs[ i ] ) { b@1605: name = attrs[ i ].name; b@1605: if ( name.indexOf( "data-" ) === 0 ) { b@1605: name = jQuery.camelCase( name.slice(5) ); b@1605: dataAttr( elem, name, data[ name ] ); b@1605: } b@1605: } b@1605: } b@1605: data_priv.set( elem, "hasDataAttrs", true ); b@1605: } b@1605: } b@1605: b@1605: return data; b@1605: } b@1605: b@1605: // Sets multiple values b@1605: if ( typeof key === "object" ) { b@1605: return this.each(function() { b@1605: data_user.set( this, key ); b@1605: }); b@1605: } b@1605: b@1605: return access( this, function( value ) { b@1605: var data, b@1605: camelKey = jQuery.camelCase( key ); b@1605: b@1605: // The calling jQuery object (element matches) is not empty b@1605: // (and therefore has an element appears at this[ 0 ]) and the b@1605: // `value` parameter was not undefined. An empty jQuery object b@1605: // will result in `undefined` for elem = this[ 0 ] which will b@1605: // throw an exception if an attempt to read a data cache is made. b@1605: if ( elem && value === undefined ) { b@1605: // Attempt to get data from the cache b@1605: // with the key as-is b@1605: data = data_user.get( elem, key ); b@1605: if ( data !== undefined ) { b@1605: return data; b@1605: } b@1605: b@1605: // Attempt to get data from the cache b@1605: // with the key camelized b@1605: data = data_user.get( elem, camelKey ); b@1605: if ( data !== undefined ) { b@1605: return data; b@1605: } b@1605: b@1605: // Attempt to "discover" the data in b@1605: // HTML5 custom data-* attrs b@1605: data = dataAttr( elem, camelKey, undefined ); b@1605: if ( data !== undefined ) { b@1605: return data; b@1605: } b@1605: b@1605: // We tried really hard, but the data doesn't exist. b@1605: return; b@1605: } b@1605: b@1605: // Set the data... b@1605: this.each(function() { b@1605: // First, attempt to store a copy or reference of any b@1605: // data that might've been store with a camelCased key. b@1605: var data = data_user.get( this, camelKey ); b@1605: b@1605: // For HTML5 data-* attribute interop, we have to b@1605: // store property names with dashes in a camelCase form. b@1605: // This might not apply to all properties...* b@1605: data_user.set( this, camelKey, value ); b@1605: b@1605: // *... In the case of properties that might _actually_ b@1605: // have dashes, we need to also store a copy of that b@1605: // unchanged property. b@1605: if ( key.indexOf("-") !== -1 && data !== undefined ) { b@1605: data_user.set( this, key, value ); b@1605: } b@1605: }); b@1605: }, null, value, arguments.length > 1, null, true ); b@1605: }, b@1605: b@1605: removeData: function( key ) { b@1605: return this.each(function() { b@1605: data_user.remove( this, key ); b@1605: }); b@1605: } b@1605: }); b@1605: b@1605: b@1605: jQuery.extend({ b@1605: queue: function( elem, type, data ) { b@1605: var queue; b@1605: b@1605: if ( elem ) { b@1605: type = ( type || "fx" ) + "queue"; b@1605: queue = data_priv.get( elem, type ); b@1605: b@1605: // Speed up dequeue by getting out quickly if this is just a lookup b@1605: if ( data ) { b@1605: if ( !queue || jQuery.isArray( data ) ) { b@1605: queue = data_priv.access( elem, type, jQuery.makeArray(data) ); b@1605: } else { b@1605: queue.push( data ); b@1605: } b@1605: } b@1605: return queue || []; b@1605: } b@1605: }, b@1605: b@1605: dequeue: function( elem, type ) { b@1605: type = type || "fx"; b@1605: b@1605: var queue = jQuery.queue( elem, type ), b@1605: startLength = queue.length, b@1605: fn = queue.shift(), b@1605: hooks = jQuery._queueHooks( elem, type ), b@1605: next = function() { b@1605: jQuery.dequeue( elem, type ); b@1605: }; b@1605: b@1605: // If the fx queue is dequeued, always remove the progress sentinel b@1605: if ( fn === "inprogress" ) { b@1605: fn = queue.shift(); b@1605: startLength--; b@1605: } b@1605: b@1605: if ( fn ) { b@1605: b@1605: // Add a progress sentinel to prevent the fx queue from being b@1605: // automatically dequeued b@1605: if ( type === "fx" ) { b@1605: queue.unshift( "inprogress" ); b@1605: } b@1605: b@1605: // Clear up the last queue stop function b@1605: delete hooks.stop; b@1605: fn.call( elem, next, hooks ); b@1605: } b@1605: b@1605: if ( !startLength && hooks ) { b@1605: hooks.empty.fire(); b@1605: } b@1605: }, b@1605: b@1605: // Not public - generate a queueHooks object, or return the current one b@1605: _queueHooks: function( elem, type ) { b@1605: var key = type + "queueHooks"; b@1605: return data_priv.get( elem, key ) || data_priv.access( elem, key, { b@1605: empty: jQuery.Callbacks("once memory").add(function() { b@1605: data_priv.remove( elem, [ type + "queue", key ] ); b@1605: }) b@1605: }); b@1605: } b@1605: }); b@1605: b@1605: jQuery.fn.extend({ b@1605: queue: function( type, data ) { b@1605: var setter = 2; b@1605: b@1605: if ( typeof type !== "string" ) { b@1605: data = type; b@1605: type = "fx"; b@1605: setter--; b@1605: } b@1605: b@1605: if ( arguments.length < setter ) { b@1605: return jQuery.queue( this[0], type ); b@1605: } b@1605: b@1605: return data === undefined ? b@1605: this : b@1605: this.each(function() { b@1605: var queue = jQuery.queue( this, type, data ); b@1605: b@1605: // Ensure a hooks for this queue b@1605: jQuery._queueHooks( this, type ); b@1605: b@1605: if ( type === "fx" && queue[0] !== "inprogress" ) { b@1605: jQuery.dequeue( this, type ); b@1605: } b@1605: }); b@1605: }, b@1605: dequeue: function( type ) { b@1605: return this.each(function() { b@1605: jQuery.dequeue( this, type ); b@1605: }); b@1605: }, b@1605: clearQueue: function( type ) { b@1605: return this.queue( type || "fx", [] ); b@1605: }, b@1605: // Get a promise resolved when queues of a certain type b@1605: // are emptied (fx is the type by default) b@1605: promise: function( type, obj ) { b@1605: var tmp, b@1605: count = 1, b@1605: defer = jQuery.Deferred(), b@1605: elements = this, b@1605: i = this.length, b@1605: resolve = function() { b@1605: if ( !( --count ) ) { b@1605: defer.resolveWith( elements, [ elements ] ); b@1605: } b@1605: }; b@1605: b@1605: if ( typeof type !== "string" ) { b@1605: obj = type; b@1605: type = undefined; b@1605: } b@1605: type = type || "fx"; b@1605: b@1605: while ( i-- ) { b@1605: tmp = data_priv.get( elements[ i ], type + "queueHooks" ); b@1605: if ( tmp && tmp.empty ) { b@1605: count++; b@1605: tmp.empty.add( resolve ); b@1605: } b@1605: } b@1605: resolve(); b@1605: return defer.promise( obj ); b@1605: } b@1605: }); b@1605: var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; b@1605: b@1605: var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; b@1605: b@1605: var isHidden = function( elem, el ) { b@1605: // isHidden might be called from jQuery#filter function; b@1605: // in that case, element will be second argument b@1605: elem = el || elem; b@1605: return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); b@1605: }; b@1605: b@1605: var rcheckableType = (/^(?:checkbox|radio)$/i); b@1605: b@1605: b@1605: b@1605: (function() { b@1605: var fragment = document.createDocumentFragment(), b@1605: div = fragment.appendChild( document.createElement( "div" ) ), b@1605: input = document.createElement( "input" ); b@1605: b@1605: // Support: Safari<=5.1 b@1605: // Check state lost if the name is set (#11217) b@1605: // Support: Windows Web Apps (WWA) b@1605: // `name` and `type` must use .setAttribute for WWA (#14901) b@1605: input.setAttribute( "type", "radio" ); b@1605: input.setAttribute( "checked", "checked" ); b@1605: input.setAttribute( "name", "t" ); b@1605: b@1605: div.appendChild( input ); b@1605: b@1605: // Support: Safari<=5.1, Android<4.2 b@1605: // Older WebKit doesn't clone checked state correctly in fragments b@1605: support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; b@1605: b@1605: // Support: IE<=11+ b@1605: // Make sure textarea (and checkbox) defaultValue is properly cloned b@1605: div.innerHTML = ""; b@1605: support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; b@1605: })(); b@1605: var strundefined = typeof undefined; b@1605: b@1605: b@1605: b@1605: support.focusinBubbles = "onfocusin" in window; b@1605: b@1605: b@1605: var b@1605: rkeyEvent = /^key/, b@1605: rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, b@1605: rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, b@1605: rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; b@1605: b@1605: function returnTrue() { b@1605: return true; b@1605: } b@1605: b@1605: function returnFalse() { b@1605: return false; b@1605: } b@1605: b@1605: function safeActiveElement() { b@1605: try { b@1605: return document.activeElement; b@1605: } catch ( err ) { } b@1605: } b@1605: b@1605: /* b@1605: * Helper functions for managing events -- not part of the public interface. b@1605: * Props to Dean Edwards' addEvent library for many of the ideas. b@1605: */ b@1605: jQuery.event = { b@1605: b@1605: global: {}, b@1605: b@1605: add: function( elem, types, handler, data, selector ) { b@1605: b@1605: var handleObjIn, eventHandle, tmp, b@1605: events, t, handleObj, b@1605: special, handlers, type, namespaces, origType, b@1605: elemData = data_priv.get( elem ); b@1605: b@1605: // Don't attach events to noData or text/comment nodes (but allow plain objects) b@1605: if ( !elemData ) { b@1605: return; b@1605: } b@1605: b@1605: // Caller can pass in an object of custom data in lieu of the handler b@1605: if ( handler.handler ) { b@1605: handleObjIn = handler; b@1605: handler = handleObjIn.handler; b@1605: selector = handleObjIn.selector; b@1605: } b@1605: b@1605: // Make sure that the handler has a unique ID, used to find/remove it later b@1605: if ( !handler.guid ) { b@1605: handler.guid = jQuery.guid++; b@1605: } b@1605: b@1605: // Init the element's event structure and main handler, if this is the first b@1605: if ( !(events = elemData.events) ) { b@1605: events = elemData.events = {}; b@1605: } b@1605: if ( !(eventHandle = elemData.handle) ) { b@1605: eventHandle = elemData.handle = function( e ) { b@1605: // Discard the second event of a jQuery.event.trigger() and b@1605: // when an event is called after a page has unloaded b@1605: return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ? b@1605: jQuery.event.dispatch.apply( elem, arguments ) : undefined; b@1605: }; b@1605: } b@1605: b@1605: // Handle multiple events separated by a space b@1605: types = ( types || "" ).match( rnotwhite ) || [ "" ]; b@1605: t = types.length; b@1605: while ( t-- ) { b@1605: tmp = rtypenamespace.exec( types[t] ) || []; b@1605: type = origType = tmp[1]; b@1605: namespaces = ( tmp[2] || "" ).split( "." ).sort(); b@1605: b@1605: // There *must* be a type, no attaching namespace-only handlers b@1605: if ( !type ) { b@1605: continue; b@1605: } b@1605: b@1605: // If event changes its type, use the special event handlers for the changed type b@1605: special = jQuery.event.special[ type ] || {}; b@1605: b@1605: // If selector defined, determine special event api type, otherwise given type b@1605: type = ( selector ? special.delegateType : special.bindType ) || type; b@1605: b@1605: // Update special based on newly reset type b@1605: special = jQuery.event.special[ type ] || {}; b@1605: b@1605: // handleObj is passed to all event handlers b@1605: handleObj = jQuery.extend({ b@1605: type: type, b@1605: origType: origType, b@1605: data: data, b@1605: handler: handler, b@1605: guid: handler.guid, b@1605: selector: selector, b@1605: needsContext: selector && jQuery.expr.match.needsContext.test( selector ), b@1605: namespace: namespaces.join(".") b@1605: }, handleObjIn ); b@1605: b@1605: // Init the event handler queue if we're the first b@1605: if ( !(handlers = events[ type ]) ) { b@1605: handlers = events[ type ] = []; b@1605: handlers.delegateCount = 0; b@1605: b@1605: // Only use addEventListener if the special events handler returns false b@1605: if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { b@1605: if ( elem.addEventListener ) { b@1605: elem.addEventListener( type, eventHandle, false ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: if ( special.add ) { b@1605: special.add.call( elem, handleObj ); b@1605: b@1605: if ( !handleObj.handler.guid ) { b@1605: handleObj.handler.guid = handler.guid; b@1605: } b@1605: } b@1605: b@1605: // Add to the element's handler list, delegates in front b@1605: if ( selector ) { b@1605: handlers.splice( handlers.delegateCount++, 0, handleObj ); b@1605: } else { b@1605: handlers.push( handleObj ); b@1605: } b@1605: b@1605: // Keep track of which events have ever been used, for event optimization b@1605: jQuery.event.global[ type ] = true; b@1605: } b@1605: b@1605: }, b@1605: b@1605: // Detach an event or set of events from an element b@1605: remove: function( elem, types, handler, selector, mappedTypes ) { b@1605: b@1605: var j, origCount, tmp, b@1605: events, t, handleObj, b@1605: special, handlers, type, namespaces, origType, b@1605: elemData = data_priv.hasData( elem ) && data_priv.get( elem ); b@1605: b@1605: if ( !elemData || !(events = elemData.events) ) { b@1605: return; b@1605: } b@1605: b@1605: // Once for each type.namespace in types; type may be omitted b@1605: types = ( types || "" ).match( rnotwhite ) || [ "" ]; b@1605: t = types.length; b@1605: while ( t-- ) { b@1605: tmp = rtypenamespace.exec( types[t] ) || []; b@1605: type = origType = tmp[1]; b@1605: namespaces = ( tmp[2] || "" ).split( "." ).sort(); b@1605: b@1605: // Unbind all events (on this namespace, if provided) for the element b@1605: if ( !type ) { b@1605: for ( type in events ) { b@1605: jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); b@1605: } b@1605: continue; b@1605: } b@1605: b@1605: special = jQuery.event.special[ type ] || {}; b@1605: type = ( selector ? special.delegateType : special.bindType ) || type; b@1605: handlers = events[ type ] || []; b@1605: tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); b@1605: b@1605: // Remove matching events b@1605: origCount = j = handlers.length; b@1605: while ( j-- ) { b@1605: handleObj = handlers[ j ]; b@1605: b@1605: if ( ( mappedTypes || origType === handleObj.origType ) && b@1605: ( !handler || handler.guid === handleObj.guid ) && b@1605: ( !tmp || tmp.test( handleObj.namespace ) ) && b@1605: ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { b@1605: handlers.splice( j, 1 ); b@1605: b@1605: if ( handleObj.selector ) { b@1605: handlers.delegateCount--; b@1605: } b@1605: if ( special.remove ) { b@1605: special.remove.call( elem, handleObj ); b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Remove generic event handler if we removed something and no more handlers exist b@1605: // (avoids potential for endless recursion during removal of special event handlers) b@1605: if ( origCount && !handlers.length ) { b@1605: if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { b@1605: jQuery.removeEvent( elem, type, elemData.handle ); b@1605: } b@1605: b@1605: delete events[ type ]; b@1605: } b@1605: } b@1605: b@1605: // Remove the expando if it's no longer used b@1605: if ( jQuery.isEmptyObject( events ) ) { b@1605: delete elemData.handle; b@1605: data_priv.remove( elem, "events" ); b@1605: } b@1605: }, b@1605: b@1605: trigger: function( event, data, elem, onlyHandlers ) { b@1605: b@1605: var i, cur, tmp, bubbleType, ontype, handle, special, b@1605: eventPath = [ elem || document ], b@1605: type = hasOwn.call( event, "type" ) ? event.type : event, b@1605: namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; b@1605: b@1605: cur = tmp = elem = elem || document; b@1605: b@1605: // Don't do events on text and comment nodes b@1605: if ( elem.nodeType === 3 || elem.nodeType === 8 ) { b@1605: return; b@1605: } b@1605: b@1605: // focus/blur morphs to focusin/out; ensure we're not firing them right now b@1605: if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { b@1605: return; b@1605: } b@1605: b@1605: if ( type.indexOf(".") >= 0 ) { b@1605: // Namespaced trigger; create a regexp to match event type in handle() b@1605: namespaces = type.split("."); b@1605: type = namespaces.shift(); b@1605: namespaces.sort(); b@1605: } b@1605: ontype = type.indexOf(":") < 0 && "on" + type; b@1605: b@1605: // Caller can pass in a jQuery.Event object, Object, or just an event type string b@1605: event = event[ jQuery.expando ] ? b@1605: event : b@1605: new jQuery.Event( type, typeof event === "object" && event ); b@1605: b@1605: // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) b@1605: event.isTrigger = onlyHandlers ? 2 : 3; b@1605: event.namespace = namespaces.join("."); b@1605: event.namespace_re = event.namespace ? b@1605: new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : b@1605: null; b@1605: b@1605: // Clean up the event in case it is being reused b@1605: event.result = undefined; b@1605: if ( !event.target ) { b@1605: event.target = elem; b@1605: } b@1605: b@1605: // Clone any incoming data and prepend the event, creating the handler arg list b@1605: data = data == null ? b@1605: [ event ] : b@1605: jQuery.makeArray( data, [ event ] ); b@1605: b@1605: // Allow special events to draw outside the lines b@1605: special = jQuery.event.special[ type ] || {}; b@1605: if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { b@1605: return; b@1605: } b@1605: b@1605: // Determine event propagation path in advance, per W3C events spec (#9951) b@1605: // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) b@1605: if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { b@1605: b@1605: bubbleType = special.delegateType || type; b@1605: if ( !rfocusMorph.test( bubbleType + type ) ) { b@1605: cur = cur.parentNode; b@1605: } b@1605: for ( ; cur; cur = cur.parentNode ) { b@1605: eventPath.push( cur ); b@1605: tmp = cur; b@1605: } b@1605: b@1605: // Only add window if we got to document (e.g., not plain obj or detached DOM) b@1605: if ( tmp === (elem.ownerDocument || document) ) { b@1605: eventPath.push( tmp.defaultView || tmp.parentWindow || window ); b@1605: } b@1605: } b@1605: b@1605: // Fire handlers on the event path b@1605: i = 0; b@1605: while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { b@1605: b@1605: event.type = i > 1 ? b@1605: bubbleType : b@1605: special.bindType || type; b@1605: b@1605: // jQuery handler b@1605: handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" ); b@1605: if ( handle ) { b@1605: handle.apply( cur, data ); b@1605: } b@1605: b@1605: // Native handler b@1605: handle = ontype && cur[ ontype ]; b@1605: if ( handle && handle.apply && jQuery.acceptData( cur ) ) { b@1605: event.result = handle.apply( cur, data ); b@1605: if ( event.result === false ) { b@1605: event.preventDefault(); b@1605: } b@1605: } b@1605: } b@1605: event.type = type; b@1605: b@1605: // If nobody prevented the default action, do it now b@1605: if ( !onlyHandlers && !event.isDefaultPrevented() ) { b@1605: b@1605: if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && b@1605: jQuery.acceptData( elem ) ) { b@1605: b@1605: // Call a native DOM method on the target with the same name name as the event. b@1605: // Don't do default actions on window, that's where global variables be (#6170) b@1605: if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { b@1605: b@1605: // Don't re-trigger an onFOO event when we call its FOO() method b@1605: tmp = elem[ ontype ]; b@1605: b@1605: if ( tmp ) { b@1605: elem[ ontype ] = null; b@1605: } b@1605: b@1605: // Prevent re-triggering of the same event, since we already bubbled it above b@1605: jQuery.event.triggered = type; b@1605: elem[ type ](); b@1605: jQuery.event.triggered = undefined; b@1605: b@1605: if ( tmp ) { b@1605: elem[ ontype ] = tmp; b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: return event.result; b@1605: }, b@1605: b@1605: dispatch: function( event ) { b@1605: b@1605: // Make a writable jQuery.Event from the native event object b@1605: event = jQuery.event.fix( event ); b@1605: b@1605: var i, j, ret, matched, handleObj, b@1605: handlerQueue = [], b@1605: args = slice.call( arguments ), b@1605: handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [], b@1605: special = jQuery.event.special[ event.type ] || {}; b@1605: b@1605: // Use the fix-ed jQuery.Event rather than the (read-only) native event b@1605: args[0] = event; b@1605: event.delegateTarget = this; b@1605: b@1605: // Call the preDispatch hook for the mapped type, and let it bail if desired b@1605: if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { b@1605: return; b@1605: } b@1605: b@1605: // Determine handlers b@1605: handlerQueue = jQuery.event.handlers.call( this, event, handlers ); b@1605: b@1605: // Run delegates first; they may want to stop propagation beneath us b@1605: i = 0; b@1605: while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { b@1605: event.currentTarget = matched.elem; b@1605: b@1605: j = 0; b@1605: while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { b@1605: b@1605: // Triggered event must either 1) have no namespace, or 2) have namespace(s) b@1605: // a subset or equal to those in the bound event (both can have no namespace). b@1605: if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { b@1605: b@1605: event.handleObj = handleObj; b@1605: event.data = handleObj.data; b@1605: b@1605: ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) b@1605: .apply( matched.elem, args ); b@1605: b@1605: if ( ret !== undefined ) { b@1605: if ( (event.result = ret) === false ) { b@1605: event.preventDefault(); b@1605: event.stopPropagation(); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Call the postDispatch hook for the mapped type b@1605: if ( special.postDispatch ) { b@1605: special.postDispatch.call( this, event ); b@1605: } b@1605: b@1605: return event.result; b@1605: }, b@1605: b@1605: handlers: function( event, handlers ) { b@1605: var i, matches, sel, handleObj, b@1605: handlerQueue = [], b@1605: delegateCount = handlers.delegateCount, b@1605: cur = event.target; b@1605: b@1605: // Find delegate handlers b@1605: // Black-hole SVG instance trees (#13180) b@1605: // Avoid non-left-click bubbling in Firefox (#3861) b@1605: if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { b@1605: b@1605: for ( ; cur !== this; cur = cur.parentNode || this ) { b@1605: b@1605: // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) b@1605: if ( cur.disabled !== true || event.type !== "click" ) { b@1605: matches = []; b@1605: for ( i = 0; i < delegateCount; i++ ) { b@1605: handleObj = handlers[ i ]; b@1605: b@1605: // Don't conflict with Object.prototype properties (#13203) b@1605: sel = handleObj.selector + " "; b@1605: b@1605: if ( matches[ sel ] === undefined ) { b@1605: matches[ sel ] = handleObj.needsContext ? b@1605: jQuery( sel, this ).index( cur ) >= 0 : b@1605: jQuery.find( sel, this, null, [ cur ] ).length; b@1605: } b@1605: if ( matches[ sel ] ) { b@1605: matches.push( handleObj ); b@1605: } b@1605: } b@1605: if ( matches.length ) { b@1605: handlerQueue.push({ elem: cur, handlers: matches }); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Add the remaining (directly-bound) handlers b@1605: if ( delegateCount < handlers.length ) { b@1605: handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); b@1605: } b@1605: b@1605: return handlerQueue; b@1605: }, b@1605: b@1605: // Includes some event props shared by KeyEvent and MouseEvent b@1605: props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), b@1605: b@1605: fixHooks: {}, b@1605: b@1605: keyHooks: { b@1605: props: "char charCode key keyCode".split(" "), b@1605: filter: function( event, original ) { b@1605: b@1605: // Add which for key events b@1605: if ( event.which == null ) { b@1605: event.which = original.charCode != null ? original.charCode : original.keyCode; b@1605: } b@1605: b@1605: return event; b@1605: } b@1605: }, b@1605: b@1605: mouseHooks: { b@1605: props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "), b@1605: filter: function( event, original ) { b@1605: var eventDoc, doc, body, b@1605: button = original.button; b@1605: b@1605: // Calculate pageX/Y if missing and clientX/Y available b@1605: if ( event.pageX == null && original.clientX != null ) { b@1605: eventDoc = event.target.ownerDocument || document; b@1605: doc = eventDoc.documentElement; b@1605: body = eventDoc.body; b@1605: b@1605: event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); b@1605: event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); b@1605: } b@1605: b@1605: // Add which for click: 1 === left; 2 === middle; 3 === right b@1605: // Note: button is not normalized, so don't use it b@1605: if ( !event.which && button !== undefined ) { b@1605: event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); b@1605: } b@1605: b@1605: return event; b@1605: } b@1605: }, b@1605: b@1605: fix: function( event ) { b@1605: if ( event[ jQuery.expando ] ) { b@1605: return event; b@1605: } b@1605: b@1605: // Create a writable copy of the event object and normalize some properties b@1605: var i, prop, copy, b@1605: type = event.type, b@1605: originalEvent = event, b@1605: fixHook = this.fixHooks[ type ]; b@1605: b@1605: if ( !fixHook ) { b@1605: this.fixHooks[ type ] = fixHook = b@1605: rmouseEvent.test( type ) ? this.mouseHooks : b@1605: rkeyEvent.test( type ) ? this.keyHooks : b@1605: {}; b@1605: } b@1605: copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; b@1605: b@1605: event = new jQuery.Event( originalEvent ); b@1605: b@1605: i = copy.length; b@1605: while ( i-- ) { b@1605: prop = copy[ i ]; b@1605: event[ prop ] = originalEvent[ prop ]; b@1605: } b@1605: b@1605: // Support: Cordova 2.5 (WebKit) (#13255) b@1605: // All events should have a target; Cordova deviceready doesn't b@1605: if ( !event.target ) { b@1605: event.target = document; b@1605: } b@1605: b@1605: // Support: Safari 6.0+, Chrome<28 b@1605: // Target should not be a text node (#504, #13143) b@1605: if ( event.target.nodeType === 3 ) { b@1605: event.target = event.target.parentNode; b@1605: } b@1605: b@1605: return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; b@1605: }, b@1605: b@1605: special: { b@1605: load: { b@1605: // Prevent triggered image.load events from bubbling to window.load b@1605: noBubble: true b@1605: }, b@1605: focus: { b@1605: // Fire native event if possible so blur/focus sequence is correct b@1605: trigger: function() { b@1605: if ( this !== safeActiveElement() && this.focus ) { b@1605: this.focus(); b@1605: return false; b@1605: } b@1605: }, b@1605: delegateType: "focusin" b@1605: }, b@1605: blur: { b@1605: trigger: function() { b@1605: if ( this === safeActiveElement() && this.blur ) { b@1605: this.blur(); b@1605: return false; b@1605: } b@1605: }, b@1605: delegateType: "focusout" b@1605: }, b@1605: click: { b@1605: // For checkbox, fire native event so checked state will be right b@1605: trigger: function() { b@1605: if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { b@1605: this.click(); b@1605: return false; b@1605: } b@1605: }, b@1605: b@1605: // For cross-browser consistency, don't fire native .click() on links b@1605: _default: function( event ) { b@1605: return jQuery.nodeName( event.target, "a" ); b@1605: } b@1605: }, b@1605: b@1605: beforeunload: { b@1605: postDispatch: function( event ) { b@1605: b@1605: // Support: Firefox 20+ b@1605: // Firefox doesn't alert if the returnValue field is not set. b@1605: if ( event.result !== undefined && event.originalEvent ) { b@1605: event.originalEvent.returnValue = event.result; b@1605: } b@1605: } b@1605: } b@1605: }, b@1605: b@1605: simulate: function( type, elem, event, bubble ) { b@1605: // Piggyback on a donor event to simulate a different one. b@1605: // Fake originalEvent to avoid donor's stopPropagation, but if the b@1605: // simulated event prevents default then we do the same on the donor. b@1605: var e = jQuery.extend( b@1605: new jQuery.Event(), b@1605: event, b@1605: { b@1605: type: type, b@1605: isSimulated: true, b@1605: originalEvent: {} b@1605: } b@1605: ); b@1605: if ( bubble ) { b@1605: jQuery.event.trigger( e, null, elem ); b@1605: } else { b@1605: jQuery.event.dispatch.call( elem, e ); b@1605: } b@1605: if ( e.isDefaultPrevented() ) { b@1605: event.preventDefault(); b@1605: } b@1605: } b@1605: }; b@1605: b@1605: jQuery.removeEvent = function( elem, type, handle ) { b@1605: if ( elem.removeEventListener ) { b@1605: elem.removeEventListener( type, handle, false ); b@1605: } b@1605: }; b@1605: b@1605: jQuery.Event = function( src, props ) { b@1605: // Allow instantiation without the 'new' keyword b@1605: if ( !(this instanceof jQuery.Event) ) { b@1605: return new jQuery.Event( src, props ); b@1605: } b@1605: b@1605: // Event object b@1605: if ( src && src.type ) { b@1605: this.originalEvent = src; b@1605: this.type = src.type; b@1605: b@1605: // Events bubbling up the document may have been marked as prevented b@1605: // by a handler lower down the tree; reflect the correct value. b@1605: this.isDefaultPrevented = src.defaultPrevented || b@1605: src.defaultPrevented === undefined && b@1605: // Support: Android<4.0 b@1605: src.returnValue === false ? b@1605: returnTrue : b@1605: returnFalse; b@1605: b@1605: // Event type b@1605: } else { b@1605: this.type = src; b@1605: } b@1605: b@1605: // Put explicitly provided properties onto the event object b@1605: if ( props ) { b@1605: jQuery.extend( this, props ); b@1605: } b@1605: b@1605: // Create a timestamp if incoming event doesn't have one b@1605: this.timeStamp = src && src.timeStamp || jQuery.now(); b@1605: b@1605: // Mark it as fixed b@1605: this[ jQuery.expando ] = true; b@1605: }; b@1605: b@1605: // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding b@1605: // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html b@1605: jQuery.Event.prototype = { b@1605: isDefaultPrevented: returnFalse, b@1605: isPropagationStopped: returnFalse, b@1605: isImmediatePropagationStopped: returnFalse, b@1605: b@1605: preventDefault: function() { b@1605: var e = this.originalEvent; b@1605: b@1605: this.isDefaultPrevented = returnTrue; b@1605: b@1605: if ( e && e.preventDefault ) { b@1605: e.preventDefault(); b@1605: } b@1605: }, b@1605: stopPropagation: function() { b@1605: var e = this.originalEvent; b@1605: b@1605: this.isPropagationStopped = returnTrue; b@1605: b@1605: if ( e && e.stopPropagation ) { b@1605: e.stopPropagation(); b@1605: } b@1605: }, b@1605: stopImmediatePropagation: function() { b@1605: var e = this.originalEvent; b@1605: b@1605: this.isImmediatePropagationStopped = returnTrue; b@1605: b@1605: if ( e && e.stopImmediatePropagation ) { b@1605: e.stopImmediatePropagation(); b@1605: } b@1605: b@1605: this.stopPropagation(); b@1605: } b@1605: }; b@1605: b@1605: // Create mouseenter/leave events using mouseover/out and event-time checks b@1605: // Support: Chrome 15+ b@1605: jQuery.each({ b@1605: mouseenter: "mouseover", b@1605: mouseleave: "mouseout", b@1605: pointerenter: "pointerover", b@1605: pointerleave: "pointerout" b@1605: }, function( orig, fix ) { b@1605: jQuery.event.special[ orig ] = { b@1605: delegateType: fix, b@1605: bindType: fix, b@1605: b@1605: handle: function( event ) { b@1605: var ret, b@1605: target = this, b@1605: related = event.relatedTarget, b@1605: handleObj = event.handleObj; b@1605: b@1605: // For mousenter/leave call the handler if related is outside the target. b@1605: // NB: No relatedTarget if the mouse left/entered the browser window b@1605: if ( !related || (related !== target && !jQuery.contains( target, related )) ) { b@1605: event.type = handleObj.origType; b@1605: ret = handleObj.handler.apply( this, arguments ); b@1605: event.type = fix; b@1605: } b@1605: return ret; b@1605: } b@1605: }; b@1605: }); b@1605: b@1605: // Support: Firefox, Chrome, Safari b@1605: // Create "bubbling" focus and blur events b@1605: if ( !support.focusinBubbles ) { b@1605: jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { b@1605: b@1605: // Attach a single capturing handler on the document while someone wants focusin/focusout b@1605: var handler = function( event ) { b@1605: jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); b@1605: }; b@1605: b@1605: jQuery.event.special[ fix ] = { b@1605: setup: function() { b@1605: var doc = this.ownerDocument || this, b@1605: attaches = data_priv.access( doc, fix ); b@1605: b@1605: if ( !attaches ) { b@1605: doc.addEventListener( orig, handler, true ); b@1605: } b@1605: data_priv.access( doc, fix, ( attaches || 0 ) + 1 ); b@1605: }, b@1605: teardown: function() { b@1605: var doc = this.ownerDocument || this, b@1605: attaches = data_priv.access( doc, fix ) - 1; b@1605: b@1605: if ( !attaches ) { b@1605: doc.removeEventListener( orig, handler, true ); b@1605: data_priv.remove( doc, fix ); b@1605: b@1605: } else { b@1605: data_priv.access( doc, fix, attaches ); b@1605: } b@1605: } b@1605: }; b@1605: }); b@1605: } b@1605: b@1605: jQuery.fn.extend({ b@1605: b@1605: on: function( types, selector, data, fn, /*INTERNAL*/ one ) { b@1605: var origFn, type; b@1605: b@1605: // Types can be a map of types/handlers b@1605: if ( typeof types === "object" ) { b@1605: // ( types-Object, selector, data ) b@1605: if ( typeof selector !== "string" ) { b@1605: // ( types-Object, data ) b@1605: data = data || selector; b@1605: selector = undefined; b@1605: } b@1605: for ( type in types ) { b@1605: this.on( type, selector, data, types[ type ], one ); b@1605: } b@1605: return this; b@1605: } b@1605: b@1605: if ( data == null && fn == null ) { b@1605: // ( types, fn ) b@1605: fn = selector; b@1605: data = selector = undefined; b@1605: } else if ( fn == null ) { b@1605: if ( typeof selector === "string" ) { b@1605: // ( types, selector, fn ) b@1605: fn = data; b@1605: data = undefined; b@1605: } else { b@1605: // ( types, data, fn ) b@1605: fn = data; b@1605: data = selector; b@1605: selector = undefined; b@1605: } b@1605: } b@1605: if ( fn === false ) { b@1605: fn = returnFalse; b@1605: } else if ( !fn ) { b@1605: return this; b@1605: } b@1605: b@1605: if ( one === 1 ) { b@1605: origFn = fn; b@1605: fn = function( event ) { b@1605: // Can use an empty set, since event contains the info b@1605: jQuery().off( event ); b@1605: return origFn.apply( this, arguments ); b@1605: }; b@1605: // Use same guid so caller can remove using origFn b@1605: fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); b@1605: } b@1605: return this.each( function() { b@1605: jQuery.event.add( this, types, fn, data, selector ); b@1605: }); b@1605: }, b@1605: one: function( types, selector, data, fn ) { b@1605: return this.on( types, selector, data, fn, 1 ); b@1605: }, b@1605: off: function( types, selector, fn ) { b@1605: var handleObj, type; b@1605: if ( types && types.preventDefault && types.handleObj ) { b@1605: // ( event ) dispatched jQuery.Event b@1605: handleObj = types.handleObj; b@1605: jQuery( types.delegateTarget ).off( b@1605: handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, b@1605: handleObj.selector, b@1605: handleObj.handler b@1605: ); b@1605: return this; b@1605: } b@1605: if ( typeof types === "object" ) { b@1605: // ( types-object [, selector] ) b@1605: for ( type in types ) { b@1605: this.off( type, selector, types[ type ] ); b@1605: } b@1605: return this; b@1605: } b@1605: if ( selector === false || typeof selector === "function" ) { b@1605: // ( types [, fn] ) b@1605: fn = selector; b@1605: selector = undefined; b@1605: } b@1605: if ( fn === false ) { b@1605: fn = returnFalse; b@1605: } b@1605: return this.each(function() { b@1605: jQuery.event.remove( this, types, fn, selector ); b@1605: }); b@1605: }, b@1605: b@1605: trigger: function( type, data ) { b@1605: return this.each(function() { b@1605: jQuery.event.trigger( type, data, this ); b@1605: }); b@1605: }, b@1605: triggerHandler: function( type, data ) { b@1605: var elem = this[0]; b@1605: if ( elem ) { b@1605: return jQuery.event.trigger( type, data, elem, true ); b@1605: } b@1605: } b@1605: }); b@1605: b@1605: b@1605: var b@1605: rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, b@1605: rtagName = /<([\w:]+)/, b@1605: rhtml = /<|&#?\w+;/, b@1605: rnoInnerhtml = /<(?:script|style|link)/i, b@1605: // checked="checked" or checked b@1605: rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, b@1605: rscriptType = /^$|\/(?:java|ecma)script/i, b@1605: rscriptTypeMasked = /^true\/(.*)/, b@1605: rcleanScript = /^\s*\s*$/g, b@1605: b@1605: // We have to close these tags to support XHTML (#13200) b@1605: wrapMap = { b@1605: b@1605: // Support: IE9 b@1605: option: [ 1, "" ], b@1605: b@1605: thead: [ 1, "", "
" ], b@1605: col: [ 2, "", "
" ], b@1605: tr: [ 2, "", "
" ], b@1605: td: [ 3, "", "
" ], b@1605: b@1605: _default: [ 0, "", "" ] b@1605: }; b@1605: b@1605: // Support: IE9 b@1605: wrapMap.optgroup = wrapMap.option; b@1605: b@1605: wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; b@1605: wrapMap.th = wrapMap.td; b@1605: b@1605: // Support: 1.x compatibility b@1605: // Manipulating tables requires a tbody b@1605: function manipulationTarget( elem, content ) { b@1605: return jQuery.nodeName( elem, "table" ) && b@1605: jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? b@1605: b@1605: elem.getElementsByTagName("tbody")[0] || b@1605: elem.appendChild( elem.ownerDocument.createElement("tbody") ) : b@1605: elem; b@1605: } b@1605: b@1605: // Replace/restore the type attribute of script elements for safe DOM manipulation b@1605: function disableScript( elem ) { b@1605: elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; b@1605: return elem; b@1605: } b@1605: function restoreScript( elem ) { b@1605: var match = rscriptTypeMasked.exec( elem.type ); b@1605: b@1605: if ( match ) { b@1605: elem.type = match[ 1 ]; b@1605: } else { b@1605: elem.removeAttribute("type"); b@1605: } b@1605: b@1605: return elem; b@1605: } b@1605: b@1605: // Mark scripts as having already been evaluated b@1605: function setGlobalEval( elems, refElements ) { b@1605: var i = 0, b@1605: l = elems.length; b@1605: b@1605: for ( ; i < l; i++ ) { b@1605: data_priv.set( b@1605: elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) b@1605: ); b@1605: } b@1605: } b@1605: b@1605: function cloneCopyEvent( src, dest ) { b@1605: var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; b@1605: b@1605: if ( dest.nodeType !== 1 ) { b@1605: return; b@1605: } b@1605: b@1605: // 1. Copy private data: events, handlers, etc. b@1605: if ( data_priv.hasData( src ) ) { b@1605: pdataOld = data_priv.access( src ); b@1605: pdataCur = data_priv.set( dest, pdataOld ); b@1605: events = pdataOld.events; b@1605: b@1605: if ( events ) { b@1605: delete pdataCur.handle; b@1605: pdataCur.events = {}; b@1605: b@1605: for ( type in events ) { b@1605: for ( i = 0, l = events[ type ].length; i < l; i++ ) { b@1605: jQuery.event.add( dest, type, events[ type ][ i ] ); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: // 2. Copy user data b@1605: if ( data_user.hasData( src ) ) { b@1605: udataOld = data_user.access( src ); b@1605: udataCur = jQuery.extend( {}, udataOld ); b@1605: b@1605: data_user.set( dest, udataCur ); b@1605: } b@1605: } b@1605: b@1605: function getAll( context, tag ) { b@1605: var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : b@1605: context.querySelectorAll ? context.querySelectorAll( tag || "*" ) : b@1605: []; b@1605: b@1605: return tag === undefined || tag && jQuery.nodeName( context, tag ) ? b@1605: jQuery.merge( [ context ], ret ) : b@1605: ret; b@1605: } b@1605: b@1605: // Fix IE bugs, see support tests b@1605: function fixInput( src, dest ) { b@1605: var nodeName = dest.nodeName.toLowerCase(); b@1605: b@1605: // Fails to persist the checked state of a cloned checkbox or radio button. b@1605: if ( nodeName === "input" && rcheckableType.test( src.type ) ) { b@1605: dest.checked = src.checked; b@1605: b@1605: // Fails to return the selected option to the default selected state when cloning options b@1605: } else if ( nodeName === "input" || nodeName === "textarea" ) { b@1605: dest.defaultValue = src.defaultValue; b@1605: } b@1605: } b@1605: b@1605: jQuery.extend({ b@1605: clone: function( elem, dataAndEvents, deepDataAndEvents ) { b@1605: var i, l, srcElements, destElements, b@1605: clone = elem.cloneNode( true ), b@1605: inPage = jQuery.contains( elem.ownerDocument, elem ); b@1605: b@1605: // Fix IE cloning issues b@1605: if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && b@1605: !jQuery.isXMLDoc( elem ) ) { b@1605: b@1605: // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 b@1605: destElements = getAll( clone ); b@1605: srcElements = getAll( elem ); b@1605: b@1605: for ( i = 0, l = srcElements.length; i < l; i++ ) { b@1605: fixInput( srcElements[ i ], destElements[ i ] ); b@1605: } b@1605: } b@1605: b@1605: // Copy the events from the original to the clone b@1605: if ( dataAndEvents ) { b@1605: if ( deepDataAndEvents ) { b@1605: srcElements = srcElements || getAll( elem ); b@1605: destElements = destElements || getAll( clone ); b@1605: b@1605: for ( i = 0, l = srcElements.length; i < l; i++ ) { b@1605: cloneCopyEvent( srcElements[ i ], destElements[ i ] ); b@1605: } b@1605: } else { b@1605: cloneCopyEvent( elem, clone ); b@1605: } b@1605: } b@1605: b@1605: // Preserve script evaluation history b@1605: destElements = getAll( clone, "script" ); b@1605: if ( destElements.length > 0 ) { b@1605: setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); b@1605: } b@1605: b@1605: // Return the cloned set b@1605: return clone; b@1605: }, b@1605: b@1605: buildFragment: function( elems, context, scripts, selection ) { b@1605: var elem, tmp, tag, wrap, contains, j, b@1605: fragment = context.createDocumentFragment(), b@1605: nodes = [], b@1605: i = 0, b@1605: l = elems.length; b@1605: b@1605: for ( ; i < l; i++ ) { b@1605: elem = elems[ i ]; b@1605: b@1605: if ( elem || elem === 0 ) { b@1605: b@1605: // Add nodes directly b@1605: if ( jQuery.type( elem ) === "object" ) { b@1605: // Support: QtWebKit, PhantomJS b@1605: // push.apply(_, arraylike) throws on ancient WebKit b@1605: jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); b@1605: b@1605: // Convert non-html into a text node b@1605: } else if ( !rhtml.test( elem ) ) { b@1605: nodes.push( context.createTextNode( elem ) ); b@1605: b@1605: // Convert html into DOM nodes b@1605: } else { b@1605: tmp = tmp || fragment.appendChild( context.createElement("div") ); b@1605: b@1605: // Deserialize a standard representation b@1605: tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); b@1605: wrap = wrapMap[ tag ] || wrapMap._default; b@1605: tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[ 2 ]; b@1605: b@1605: // Descend through wrappers to the right content b@1605: j = wrap[ 0 ]; b@1605: while ( j-- ) { b@1605: tmp = tmp.lastChild; b@1605: } b@1605: b@1605: // Support: QtWebKit, PhantomJS b@1605: // push.apply(_, arraylike) throws on ancient WebKit b@1605: jQuery.merge( nodes, tmp.childNodes ); b@1605: b@1605: // Remember the top-level container b@1605: tmp = fragment.firstChild; b@1605: b@1605: // Ensure the created nodes are orphaned (#12392) b@1605: tmp.textContent = ""; b@1605: } b@1605: } b@1605: } b@1605: b@1605: // Remove wrapper from fragment b@1605: fragment.textContent = ""; b@1605: b@1605: i = 0; b@1605: while ( (elem = nodes[ i++ ]) ) { b@1605: b@1605: // #4087 - If origin and destination elements are the same, and this is b@1605: // that element, do not do anything b@1605: if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { b@1605: continue; b@1605: } b@1605: b@1605: contains = jQuery.contains( elem.ownerDocument, elem ); b@1605: b@1605: // Append to fragment b@1605: tmp = getAll( fragment.appendChild( elem ), "script" ); b@1605: b@1605: // Preserve script evaluation history b@1605: if ( contains ) { b@1605: setGlobalEval( tmp ); b@1605: } b@1605: b@1605: // Capture executables b@1605: if ( scripts ) { b@1605: j = 0; b@1605: while ( (elem = tmp[ j++ ]) ) { b@1605: if ( rscriptType.test( elem.type || "" ) ) { b@1605: scripts.push( elem ); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: return fragment; b@1605: }, b@1605: b@1605: cleanData: function( elems ) { b@1605: var data, elem, type, key, b@1605: special = jQuery.event.special, b@1605: i = 0; b@1605: b@1605: for ( ; (elem = elems[ i ]) !== undefined; i++ ) { b@1605: if ( jQuery.acceptData( elem ) ) { b@1605: key = elem[ data_priv.expando ]; b@1605: b@1605: if ( key && (data = data_priv.cache[ key ]) ) { b@1605: if ( data.events ) { b@1605: for ( type in data.events ) { b@1605: if ( special[ type ] ) { b@1605: jQuery.event.remove( elem, type ); b@1605: b@1605: // This is a shortcut to avoid jQuery.event.remove's overhead b@1605: } else { b@1605: jQuery.removeEvent( elem, type, data.handle ); b@1605: } b@1605: } b@1605: } b@1605: if ( data_priv.cache[ key ] ) { b@1605: // Discard any remaining `private` data b@1605: delete data_priv.cache[ key ]; b@1605: } b@1605: } b@1605: } b@1605: // Discard any remaining `user` data b@1605: delete data_user.cache[ elem[ data_user.expando ] ]; b@1605: } b@1605: } b@1605: }); b@1605: b@1605: jQuery.fn.extend({ b@1605: text: function( value ) { b@1605: return access( this, function( value ) { b@1605: return value === undefined ? b@1605: jQuery.text( this ) : b@1605: this.empty().each(function() { b@1605: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { b@1605: this.textContent = value; b@1605: } b@1605: }); b@1605: }, null, value, arguments.length ); b@1605: }, b@1605: b@1605: append: function() { b@1605: return this.domManip( arguments, function( elem ) { b@1605: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { b@1605: var target = manipulationTarget( this, elem ); b@1605: target.appendChild( elem ); b@1605: } b@1605: }); b@1605: }, b@1605: b@1605: prepend: function() { b@1605: return this.domManip( arguments, function( elem ) { b@1605: if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { b@1605: var target = manipulationTarget( this, elem ); b@1605: target.insertBefore( elem, target.firstChild ); b@1605: } b@1605: }); b@1605: }, b@1605: b@1605: before: function() { b@1605: return this.domManip( arguments, function( elem ) { b@1605: if ( this.parentNode ) { b@1605: this.parentNode.insertBefore( elem, this ); b@1605: } b@1605: }); b@1605: }, b@1605: b@1605: after: function() { b@1605: return this.domManip( arguments, function( elem ) { b@1605: if ( this.parentNode ) { b@1605: this.parentNode.insertBefore( elem, this.nextSibling ); b@1605: } b@1605: }); b@1605: }, b@1605: b@1605: remove: function( selector, keepData /* Internal Use Only */ ) { b@1605: var elem, b@1605: elems = selector ? jQuery.filter( selector, this ) : this, b@1605: i = 0; b@1605: b@1605: for ( ; (elem = elems[i]) != null; i++ ) { b@1605: if ( !keepData && elem.nodeType === 1 ) { b@1605: jQuery.cleanData( getAll( elem ) ); b@1605: } b@1605: b@1605: if ( elem.parentNode ) { b@1605: if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { b@1605: setGlobalEval( getAll( elem, "script" ) ); b@1605: } b@1605: elem.parentNode.removeChild( elem ); b@1605: } b@1605: } b@1605: b@1605: return this; b@1605: }, b@1605: b@1605: empty: function() { b@1605: var elem, b@1605: i = 0; b@1605: b@1605: for ( ; (elem = this[i]) != null; i++ ) { b@1605: if ( elem.nodeType === 1 ) { b@1605: b@1605: // Prevent memory leaks b@1605: jQuery.cleanData( getAll( elem, false ) ); b@1605: b@1605: // Remove any remaining nodes b@1605: elem.textContent = ""; b@1605: } b@1605: } b@1605: b@1605: return this; b@1605: }, b@1605: b@1605: clone: function( dataAndEvents, deepDataAndEvents ) { b@1605: dataAndEvents = dataAndEvents == null ? false : dataAndEvents; b@1605: deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; b@1605: b@1605: return this.map(function() { b@1605: return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); b@1605: }); b@1605: }, b@1605: b@1605: html: function( value ) { b@1605: return access( this, function( value ) { b@1605: var elem = this[ 0 ] || {}, b@1605: i = 0, b@1605: l = this.length; b@1605: b@1605: if ( value === undefined && elem.nodeType === 1 ) { b@1605: return elem.innerHTML; b@1605: } b@1605: b@1605: // See if we can take a shortcut and just use innerHTML b@1605: if ( typeof value === "string" && !rnoInnerhtml.test( value ) && b@1605: !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { b@1605: b@1605: value = value.replace( rxhtmlTag, "<$1>" ); b@1605: b@1605: try { b@1605: for ( ; i < l; i++ ) { b@1605: elem = this[ i ] || {}; b@1605: b@1605: // Remove element nodes and prevent memory leaks b@1605: if ( elem.nodeType === 1 ) { b@1605: jQuery.cleanData( getAll( elem, false ) ); b@1605: elem.innerHTML = value; b@1605: } b@1605: } b@1605: b@1605: elem = 0; b@1605: b@1605: // If using innerHTML throws an exception, use the fallback method b@1605: } catch( e ) {} b@1605: } b@1605: b@1605: if ( elem ) { b@1605: this.empty().append( value ); b@1605: } b@1605: }, null, value, arguments.length ); b@1605: }, b@1605: b@1605: replaceWith: function() { b@1605: var arg = arguments[ 0 ]; b@1605: b@1605: // Make the changes, replacing each context element with the new content b@1605: this.domManip( arguments, function( elem ) { b@1605: arg = this.parentNode; b@1605: b@1605: jQuery.cleanData( getAll( this ) ); b@1605: b@1605: if ( arg ) { b@1605: arg.replaceChild( elem, this ); b@1605: } b@1605: }); b@1605: b@1605: // Force removal if there was no new content (e.g., from empty arguments) b@1605: return arg && (arg.length || arg.nodeType) ? this : this.remove(); b@1605: }, b@1605: b@1605: detach: function( selector ) { b@1605: return this.remove( selector, true ); b@1605: }, b@1605: b@1605: domManip: function( args, callback ) { b@1605: b@1605: // Flatten any nested arrays b@1605: args = concat.apply( [], args ); b@1605: b@1605: var fragment, first, scripts, hasScripts, node, doc, b@1605: i = 0, b@1605: l = this.length, b@1605: set = this, b@1605: iNoClone = l - 1, b@1605: value = args[ 0 ], b@1605: isFunction = jQuery.isFunction( value ); b@1605: b@1605: // We can't cloneNode fragments that contain checked, in WebKit b@1605: if ( isFunction || b@1605: ( l > 1 && typeof value === "string" && b@1605: !support.checkClone && rchecked.test( value ) ) ) { b@1605: return this.each(function( index ) { b@1605: var self = set.eq( index ); b@1605: if ( isFunction ) { b@1605: args[ 0 ] = value.call( this, index, self.html() ); b@1605: } b@1605: self.domManip( args, callback ); b@1605: }); b@1605: } b@1605: b@1605: if ( l ) { b@1605: fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); b@1605: first = fragment.firstChild; b@1605: b@1605: if ( fragment.childNodes.length === 1 ) { b@1605: fragment = first; b@1605: } b@1605: b@1605: if ( first ) { b@1605: scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); b@1605: hasScripts = scripts.length; b@1605: b@1605: // Use the original fragment for the last item instead of the first because it can end up b@1605: // being emptied incorrectly in certain situations (#8070). b@1605: for ( ; i < l; i++ ) { b@1605: node = fragment; b@1605: b@1605: if ( i !== iNoClone ) { b@1605: node = jQuery.clone( node, true, true ); b@1605: b@1605: // Keep references to cloned scripts for later restoration b@1605: if ( hasScripts ) { b@1605: // Support: QtWebKit b@1605: // jQuery.merge because push.apply(_, arraylike) throws b@1605: jQuery.merge( scripts, getAll( node, "script" ) ); b@1605: } b@1605: } b@1605: b@1605: callback.call( this[ i ], node, i ); b@1605: } b@1605: b@1605: if ( hasScripts ) { b@1605: doc = scripts[ scripts.length - 1 ].ownerDocument; b@1605: b@1605: // Reenable scripts b@1605: jQuery.map( scripts, restoreScript ); b@1605: b@1605: // Evaluate executable scripts on first document insertion b@1605: for ( i = 0; i < hasScripts; i++ ) { b@1605: node = scripts[ i ]; b@1605: if ( rscriptType.test( node.type || "" ) && b@1605: !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) { b@1605: b@1605: if ( node.src ) { b@1605: // Optional AJAX dependency, but won't run scripts if not present b@1605: if ( jQuery._evalUrl ) { b@1605: jQuery._evalUrl( node.src ); b@1605: } b@1605: } else { b@1605: jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) ); b@1605: } b@1605: } b@1605: } b@1605: } b@1605: } b@1605: } b@1605: b@1605: return this; b@1605: } b@1605: }); b@1605: b@1605: jQuery.each({ b@1605: appendTo: "append", b@1605: prependTo: "prepend", b@1605: insertBefore: "before", b@1605: insertAfter: "after", b@1605: replaceAll: "replaceWith" b@1605: }, function( name, original ) { b@1605: jQuery.fn[ name ] = function( selector ) { b@1605: var elems, b@1605: ret = [], b@1605: insert = jQuery( selector ), b@1605: last = insert.length - 1, b@1605: i = 0; b@1605: b@1605: for ( ; i <= last; i++ ) { b@1605: elems = i === last ? this : this.clone( true ); b@1605: jQuery( insert[ i ] )[ original ]( elems ); b@1605: b@1605: // Support: QtWebKit b@1605: // .get() because push.apply(_, arraylike) throws b@1605: push.apply( ret, elems.get() ); b@1605: } b@1605: b@1605: return this.pushStack( ret ); b@1605: }; b@1605: }); b@1605: b@1605: b@1605: var iframe, b@1605: elemdisplay = {}; b@1605: b@1605: /** b@1605: * Retrieve the actual display of a element b@1605: * @param {String} name nodeName of the element b@1605: * @param {Object} doc Document object b@1605: */ b@1605: // Called only from within defaultDisplay b@1605: function actualDisplay( name, doc ) { b@1605: var style, b@1605: elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), b@1605: b@1605: // getDefaultComputedStyle might be reliably used only on attached element b@1605: display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? b@1605: b@1605: // Use of this method is a temporary fix (more like optimization) until something better comes along, b@1605: // since it was removed from specification and supported only in FF b@1605: style.display : jQuery.css( elem[ 0 ], "display" ); b@1605: b@1605: // We don't have any data stored on the element, b@1605: // so use "detach" method as fast way to get rid of the element b@1605: elem.detach(); b@1605: b@1605: return display; b@1605: } b@1605: b@1605: /** b@1605: * Try to determine the default display value of an element b@1605: * @param {String} nodeName b@1605: */ b@1605: function defaultDisplay( nodeName ) { b@1605: var doc = document, b@1605: display = elemdisplay[ nodeName ]; b@1605: b@1605: if ( !display ) { b@1605: display = actualDisplay( nodeName, doc ); b@1605: b@1605: // If the simple way fails, read from inside an iframe b@1605: if ( display === "none" || !display ) { b@1605: b@1605: // Use the already-created iframe if possible b@1605: iframe = (iframe || jQuery( "