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