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