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