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