| |
@@ -1,291 +1,202 @@
|
| |
/*!
|
| |
- * jQuery JavaScript Library v1.7.2
|
| |
- * http://jquery.com/
|
| |
- *
|
| |
- * Copyright 2011, John Resig
|
| |
- * Dual licensed under the MIT or GPL Version 2 licenses.
|
| |
- * http://jquery.org/license
|
| |
+ * jQuery JavaScript Library v3.3.1
|
| |
+ * https://jquery.com/
|
| |
*
|
| |
* Includes Sizzle.js
|
| |
- * http://sizzlejs.com/
|
| |
- * Copyright 2011, The Dojo Foundation
|
| |
- * Released under the MIT, BSD, and GPL Licenses.
|
| |
+ * https://sizzlejs.com/
|
| |
*
|
| |
- * Date: Wed Mar 21 12:46:34 2012 -0700
|
| |
+ * Copyright JS Foundation and other contributors
|
| |
+ * Released under the MIT license
|
| |
+ * https://jquery.org/license
|
| |
+ *
|
| |
+ * Date: 2018-01-20T17:24Z
|
| |
*/
|
| |
- (function( window, undefined ) {
|
| |
-
|
| |
- // Use the correct document accordingly with window argument (sandbox)
|
| |
- var document = window.document,
|
| |
- navigator = window.navigator,
|
| |
- location = window.location;
|
| |
- var jQuery = (function() {
|
| |
-
|
| |
- // Define a local copy of jQuery
|
| |
- var jQuery = function( selector, context ) {
|
| |
- // The jQuery object is actually just the init constructor 'enhanced'
|
| |
- return new jQuery.fn.init( selector, context, rootjQuery );
|
| |
- },
|
| |
-
|
| |
- // Map over jQuery in case of overwrite
|
| |
- _jQuery = window.jQuery,
|
| |
-
|
| |
- // Map over the $ in case of overwrite
|
| |
- _$ = window.$,
|
| |
-
|
| |
- // A central reference to the root jQuery(document)
|
| |
- rootjQuery,
|
| |
-
|
| |
- // A simple way to check for HTML strings or ID strings
|
| |
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
| |
- quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
|
| |
+ ( function( global, factory ) {
|
| |
+
|
| |
+ "use strict";
|
| |
+
|
| |
+ if ( typeof module === "object" && typeof module.exports === "object" ) {
|
| |
+
|
| |
+ // For CommonJS and CommonJS-like environments where a proper `window`
|
| |
+ // is present, execute the factory and get jQuery.
|
| |
+ // For environments that do not have a `window` with a `document`
|
| |
+ // (such as Node.js), expose a factory as module.exports.
|
| |
+ // This accentuates the need for the creation of a real `window`.
|
| |
+ // e.g. var jQuery = require("jquery")(window);
|
| |
+ // See ticket #14549 for more info.
|
| |
+ module.exports = global.document ?
|
| |
+ factory( global, true ) :
|
| |
+ function( w ) {
|
| |
+ if ( !w.document ) {
|
| |
+ throw new Error( "jQuery requires a window with a document" );
|
| |
+ }
|
| |
+ return factory( w );
|
| |
+ };
|
| |
+ } else {
|
| |
+ factory( global );
|
| |
+ }
|
| |
|
| |
- // Check if a string has a non-whitespace character in it
|
| |
- rnotwhite = /\S/,
|
| |
+ // Pass this if window is not defined yet
|
| |
+ } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
|
| |
|
| |
- // Used for trimming whitespace
|
| |
- trimLeft = /^\s+/,
|
| |
- trimRight = /\s+$/,
|
| |
+ // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
|
| |
+ // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
|
| |
+ // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
|
| |
+ // enough that all such attempts are guarded in a try block.
|
| |
+ "use strict";
|
| |
|
| |
- // Match a standalone tag
|
| |
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
| |
+ var arr = [];
|
| |
|
| |
- // JSON RegExp
|
| |
- rvalidchars = /^[\],:{}\s]*$/,
|
| |
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
|
| |
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
| |
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
| |
+ var document = window.document;
|
| |
|
| |
- // Useragent RegExp
|
| |
- rwebkit = /(webkit)[ \/]([\w.]+)/,
|
| |
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
|
| |
- rmsie = /(msie) ([\w.]+)/,
|
| |
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
|
| |
+ var getProto = Object.getPrototypeOf;
|
| |
|
| |
- // Matches dashed string for camelizing
|
| |
- rdashAlpha = /-([a-z]|[0-9])/ig,
|
| |
- rmsPrefix = /^-ms-/,
|
| |
+ var slice = arr.slice;
|
| |
|
| |
- // Used by jQuery.camelCase as callback to replace()
|
| |
- fcamelCase = function( all, letter ) {
|
| |
- return ( letter + "" ).toUpperCase();
|
| |
- },
|
| |
+ var concat = arr.concat;
|
| |
|
| |
- // Keep a UserAgent string for use with jQuery.browser
|
| |
- userAgent = navigator.userAgent,
|
| |
+ var push = arr.push;
|
| |
|
| |
- // For matching the engine and version of the browser
|
| |
- browserMatch,
|
| |
+ var indexOf = arr.indexOf;
|
| |
|
| |
- // The deferred used on DOM ready
|
| |
- readyList,
|
| |
+ var class2type = {};
|
| |
|
| |
- // The ready event handler
|
| |
- DOMContentLoaded,
|
| |
+ var toString = class2type.toString;
|
| |
|
| |
- // Save a reference to some core methods
|
| |
- toString = Object.prototype.toString,
|
| |
- hasOwn = Object.prototype.hasOwnProperty,
|
| |
- push = Array.prototype.push,
|
| |
- slice = Array.prototype.slice,
|
| |
- trim = String.prototype.trim,
|
| |
- indexOf = Array.prototype.indexOf,
|
| |
+ var hasOwn = class2type.hasOwnProperty;
|
| |
|
| |
- // [[Class]] -> type pairs
|
| |
- class2type = {};
|
| |
+ var fnToString = hasOwn.toString;
|
| |
|
| |
- jQuery.fn = jQuery.prototype = {
|
| |
- constructor: jQuery,
|
| |
- init: function( selector, context, rootjQuery ) {
|
| |
- var match, elem, ret, doc;
|
| |
+ var ObjectFunctionString = fnToString.call( Object );
|
| |
|
| |
- // Handle $(""), $(null), or $(undefined)
|
| |
- if ( !selector ) {
|
| |
- return this;
|
| |
- }
|
| |
+ var support = {};
|
| |
|
| |
- // Handle $(DOMElement)
|
| |
- if ( selector.nodeType ) {
|
| |
- this.context = this[0] = selector;
|
| |
- this.length = 1;
|
| |
- return this;
|
| |
- }
|
| |
+ var isFunction = function isFunction( obj ) {
|
| |
|
| |
- // The body element only exists once, optimize finding it
|
| |
- if ( selector === "body" && !context && document.body ) {
|
| |
- this.context = document;
|
| |
- this[0] = document.body;
|
| |
- this.selector = selector;
|
| |
- this.length = 1;
|
| |
- return this;
|
| |
- }
|
| |
+ // Support: Chrome <=57, Firefox <=52
|
| |
+ // In some browsers, typeof returns "function" for HTML <object> elements
|
| |
+ // (i.e., `typeof document.createElement( "object" ) === "function"`).
|
| |
+ // We don't want to classify *any* DOM node as a function.
|
| |
+ return typeof obj === "function" && typeof obj.nodeType !== "number";
|
| |
+ };
|
| |
|
| |
- // Handle HTML strings
|
| |
- if ( typeof selector === "string" ) {
|
| |
- // Are we dealing with HTML string or an ID?
|
| |
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
|
| |
- // Assume that strings that start and end with <> are HTML and skip the regex check
|
| |
- match = [ null, selector, null ];
|
| |
|
| |
- } else {
|
| |
- match = quickExpr.exec( selector );
|
| |
- }
|
| |
+ var isWindow = function isWindow( obj ) {
|
| |
+ return obj != null && obj === obj.window;
|
| |
+ };
|
| |
|
| |
- // Verify a match, and that no context was specified for #id
|
| |
- if ( match && (match[1] || !context) ) {
|
| |
|
| |
- // HANDLE: $(html) -> $(array)
|
| |
- if ( match[1] ) {
|
| |
- context = context instanceof jQuery ? context[0] : context;
|
| |
- doc = ( context ? context.ownerDocument || context : document );
|
| |
|
| |
- // If a single string is passed in and it's a single tag
|
| |
- // just do a createElement and skip the rest
|
| |
- ret = rsingleTag.exec( selector );
|
| |
|
| |
- if ( ret ) {
|
| |
- if ( jQuery.isPlainObject( context ) ) {
|
| |
- selector = [ document.createElement( ret[1] ) ];
|
| |
- jQuery.fn.attr.call( selector, context, true );
|
| |
+ var preservedScriptAttributes = {
|
| |
+ type: true,
|
| |
+ src: true,
|
| |
+ noModule: true
|
| |
+ };
|
| |
|
| |
- } else {
|
| |
- selector = [ doc.createElement( ret[1] ) ];
|
| |
- }
|
| |
+ function DOMEval( code, doc, node ) {
|
| |
+ doc = doc || document;
|
| |
|
| |
- } else {
|
| |
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
|
| |
- selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
|
| |
- }
|
| |
+ var i,
|
| |
+ script = doc.createElement( "script" );
|
| |
|
| |
- return jQuery.merge( this, selector );
|
| |
+ script.text = code;
|
| |
+ if ( node ) {
|
| |
+ for ( i in preservedScriptAttributes ) {
|
| |
+ if ( node[ i ] ) {
|
| |
+ script[ i ] = node[ i ];
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ doc.head.appendChild( script ).parentNode.removeChild( script );
|
| |
+ }
|
| |
|
| |
- // HANDLE: $("#id")
|
| |
- } else {
|
| |
- elem = document.getElementById( match[2] );
|
| |
-
|
| |
- // Check parentNode to catch when Blackberry 4.6 returns
|
| |
- // nodes that are no longer in the document #6963
|
| |
- if ( elem && elem.parentNode ) {
|
| |
- // Handle the case where IE and Opera return items
|
| |
- // by name instead of ID
|
| |
- if ( elem.id !== match[2] ) {
|
| |
- return rootjQuery.find( selector );
|
| |
- }
|
| |
|
| |
- // Otherwise, we inject the element directly into the jQuery object
|
| |
- this.length = 1;
|
| |
- this[0] = elem;
|
| |
- }
|
| |
+ function toType( obj ) {
|
| |
+ if ( obj == null ) {
|
| |
+ return obj + "";
|
| |
+ }
|
| |
|
| |
- this.context = document;
|
| |
- this.selector = selector;
|
| |
- return this;
|
| |
- }
|
| |
+ // Support: Android <=2.3 only (functionish RegExp)
|
| |
+ return typeof obj === "object" || typeof obj === "function" ?
|
| |
+ class2type[ toString.call( obj ) ] || "object" :
|
| |
+ typeof obj;
|
| |
+ }
|
| |
+ /* global Symbol */
|
| |
+ // Defining this global in .eslintrc.json would create a danger of using the global
|
| |
+ // unguarded in another place, it seems safer to define global only for this module
|
| |
|
| |
- // HANDLE: $(expr, $(...))
|
| |
- } else if ( !context || context.jquery ) {
|
| |
- return ( context || rootjQuery ).find( selector );
|
| |
|
| |
- // HANDLE: $(expr, context)
|
| |
- // (which is just equivalent to: $(context).find(expr)
|
| |
- } else {
|
| |
- return this.constructor( context ).find( selector );
|
| |
- }
|
| |
|
| |
- // HANDLE: $(function)
|
| |
- // Shortcut for document ready
|
| |
- } else if ( jQuery.isFunction( selector ) ) {
|
| |
- return rootjQuery.ready( selector );
|
| |
- }
|
| |
+ var
|
| |
+ version = "3.3.1",
|
| |
|
| |
- if ( selector.selector !== undefined ) {
|
| |
- this.selector = selector.selector;
|
| |
- this.context = selector.context;
|
| |
- }
|
| |
+ // Define a local copy of jQuery
|
| |
+ jQuery = function( selector, context ) {
|
| |
|
| |
- return jQuery.makeArray( selector, this );
|
| |
+ // The jQuery object is actually just the init constructor 'enhanced'
|
| |
+ // Need init if jQuery is called (just allow error to be thrown if not included)
|
| |
+ return new jQuery.fn.init( selector, context );
|
| |
},
|
| |
|
| |
- // Start with an empty selector
|
| |
- selector: "",
|
| |
+ // Support: Android <=4.0 only
|
| |
+ // Make sure we trim BOM and NBSP
|
| |
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
| |
+
|
| |
+ jQuery.fn = jQuery.prototype = {
|
| |
|
| |
// The current version of jQuery being used
|
| |
- jquery: "1.7.2",
|
| |
+ jquery: version,
|
| |
+
|
| |
+ constructor: jQuery,
|
| |
|
| |
// The default length of a jQuery object is 0
|
| |
length: 0,
|
| |
|
| |
- // The number of elements contained in the matched element set
|
| |
- size: function() {
|
| |
- return this.length;
|
| |
- },
|
| |
-
|
| |
toArray: function() {
|
| |
- return slice.call( this, 0 );
|
| |
+ return slice.call( this );
|
| |
},
|
| |
|
| |
// Get the Nth element in the matched element set OR
|
| |
// Get the whole matched element set as a clean array
|
| |
get: function( num ) {
|
| |
- return num == null ?
|
| |
|
| |
- // Return a 'clean' array
|
| |
- this.toArray() :
|
| |
+ // Return all the elements in a clean array
|
| |
+ if ( num == null ) {
|
| |
+ return slice.call( this );
|
| |
+ }
|
| |
|
| |
- // Return just the object
|
| |
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
|
| |
+ // Return just the one element from the set
|
| |
+ return num < 0 ? this[ num + this.length ] : this[ num ];
|
| |
},
|
| |
|
| |
// Take an array of elements and push it onto the stack
|
| |
// (returning the new matched element set)
|
| |
- pushStack: function( elems, name, selector ) {
|
| |
- // Build a new jQuery matched element set
|
| |
- var ret = this.constructor();
|
| |
+ pushStack: function( elems ) {
|
| |
|
| |
- if ( jQuery.isArray( elems ) ) {
|
| |
- push.apply( ret, elems );
|
| |
-
|
| |
- } else {
|
| |
- jQuery.merge( ret, elems );
|
| |
- }
|
| |
+ // Build a new jQuery matched element set
|
| |
+ var ret = jQuery.merge( this.constructor(), elems );
|
| |
|
| |
// Add the old object onto the stack (as a reference)
|
| |
ret.prevObject = this;
|
| |
|
| |
- ret.context = this.context;
|
| |
-
|
| |
- if ( name === "find" ) {
|
| |
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
|
| |
- } else if ( name ) {
|
| |
- ret.selector = this.selector + "." + name + "(" + selector + ")";
|
| |
- }
|
| |
-
|
| |
// Return the newly-formed element set
|
| |
return ret;
|
| |
},
|
| |
|
| |
// Execute a callback for every element in the matched set.
|
| |
- // (You can seed the arguments with an array of args, but this is
|
| |
- // only used internally.)
|
| |
- each: function( callback, args ) {
|
| |
- return jQuery.each( this, callback, args );
|
| |
+ each: function( callback ) {
|
| |
+ return jQuery.each( this, callback );
|
| |
},
|
| |
|
| |
- ready: function( fn ) {
|
| |
- // Attach the listeners
|
| |
- jQuery.bindReady();
|
| |
-
|
| |
- // Add the callback
|
| |
- readyList.add( fn );
|
| |
-
|
| |
- return this;
|
| |
+ map: function( callback ) {
|
| |
+ return this.pushStack( jQuery.map( this, function( elem, i ) {
|
| |
+ return callback.call( elem, i, elem );
|
| |
+ } ) );
|
| |
},
|
| |
|
| |
- eq: function( i ) {
|
| |
- i = +i;
|
| |
- return i === -1 ?
|
| |
- this.slice( i ) :
|
| |
- this.slice( i, i + 1 );
|
| |
+ slice: function() {
|
| |
+ return this.pushStack( slice.apply( this, arguments ) );
|
| |
},
|
| |
|
| |
first: function() {
|
| |
@@ -296,34 +207,26 @@
|
| |
return this.eq( -1 );
|
| |
},
|
| |
|
| |
- slice: function() {
|
| |
- return this.pushStack( slice.apply( this, arguments ),
|
| |
- "slice", slice.call(arguments).join(",") );
|
| |
- },
|
| |
-
|
| |
- map: function( callback ) {
|
| |
- return this.pushStack( jQuery.map(this, function( elem, i ) {
|
| |
- return callback.call( elem, i, elem );
|
| |
- }));
|
| |
+ eq: function( i ) {
|
| |
+ var len = this.length,
|
| |
+ j = +i + ( i < 0 ? len : 0 );
|
| |
+ return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
|
| |
},
|
| |
|
| |
end: function() {
|
| |
- return this.prevObject || this.constructor(null);
|
| |
+ return this.prevObject || this.constructor();
|
| |
},
|
| |
|
| |
// For internal use only.
|
| |
// Behaves like an Array's method, not like a jQuery method.
|
| |
push: push,
|
| |
- sort: [].sort,
|
| |
- splice: [].splice
|
| |
+ sort: arr.sort,
|
| |
+ splice: arr.splice
|
| |
};
|
| |
|
| |
- // Give the init function the jQuery prototype for later instantiation
|
| |
- jQuery.fn.init.prototype = jQuery.fn;
|
| |
-
|
| |
jQuery.extend = jQuery.fn.extend = function() {
|
| |
var options, name, src, copy, copyIsArray, clone,
|
| |
- target = arguments[0] || {},
|
| |
+ target = arguments[ 0 ] || {},
|
| |
i = 1,
|
| |
length = arguments.length,
|
| |
deep = false;
|
| |
@@ -331,25 +234,28 @@
|
| |
// Handle a deep copy situation
|
| |
if ( typeof target === "boolean" ) {
|
| |
deep = target;
|
| |
- target = arguments[1] || {};
|
| |
- // skip the boolean and the target
|
| |
- i = 2;
|
| |
+
|
| |
+ // Skip the boolean and the target
|
| |
+ target = arguments[ i ] || {};
|
| |
+ i++;
|
| |
}
|
| |
|
| |
// Handle case when target is a string or something (possible in deep copy)
|
| |
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
| |
+ if ( typeof target !== "object" && !isFunction( target ) ) {
|
| |
target = {};
|
| |
}
|
| |
|
| |
- // extend jQuery itself if only one argument is passed
|
| |
- if ( length === i ) {
|
| |
+ // Extend jQuery itself if only one argument is passed
|
| |
+ if ( i === length ) {
|
| |
target = this;
|
| |
- --i;
|
| |
+ i--;
|
| |
}
|
| |
|
| |
for ( ; i < length; i++ ) {
|
| |
+
|
| |
// Only deal with non-null/undefined values
|
| |
- if ( (options = arguments[ i ]) != null ) {
|
| |
+ if ( ( options = arguments[ i ] ) != null ) {
|
| |
+
|
| |
// Extend the base object
|
| |
for ( name in options ) {
|
| |
src = target[ name ];
|
| |
@@ -361,13 +267,15 @@
|
| |
}
|
| |
|
| |
// Recurse if we're merging plain objects or arrays
|
| |
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
| |
+ if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
|
| |
+ ( copyIsArray = Array.isArray( copy ) ) ) ) {
|
| |
+
|
| |
if ( copyIsArray ) {
|
| |
copyIsArray = false;
|
| |
- clone = src && jQuery.isArray(src) ? src : [];
|
| |
+ clone = src && Array.isArray( src ) ? src : [];
|
| |
|
| |
} else {
|
| |
- clone = src && jQuery.isPlainObject(src) ? src : {};
|
| |
+ clone = src && jQuery.isPlainObject( src ) ? src : {};
|
| |
}
|
| |
|
| |
// Never move original objects, clone them
|
| |
@@ -385,357 +293,117 @@
|
| |
return target;
|
| |
};
|
| |
|
| |
- jQuery.extend({
|
| |
- noConflict: function( deep ) {
|
| |
- if ( window.$ === jQuery ) {
|
| |
- window.$ = _$;
|
| |
- }
|
| |
-
|
| |
- if ( deep && window.jQuery === jQuery ) {
|
| |
- window.jQuery = _jQuery;
|
| |
- }
|
| |
-
|
| |
- return jQuery;
|
| |
- },
|
| |
-
|
| |
- // Is the DOM ready to be used? Set to true once it occurs.
|
| |
- isReady: false,
|
| |
-
|
| |
- // A counter to track how many items to wait for before
|
| |
- // the ready event fires. See #6781
|
| |
- readyWait: 1,
|
| |
-
|
| |
- // Hold (or release) the ready event
|
| |
- holdReady: function( hold ) {
|
| |
- if ( hold ) {
|
| |
- jQuery.readyWait++;
|
| |
- } else {
|
| |
- jQuery.ready( true );
|
| |
- }
|
| |
- },
|
| |
-
|
| |
- // Handle when the DOM is ready
|
| |
- ready: function( wait ) {
|
| |
- // Either a released hold or an DOMready/load event and not yet ready
|
| |
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
|
| |
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
| |
- if ( !document.body ) {
|
| |
- return setTimeout( jQuery.ready, 1 );
|
| |
- }
|
| |
-
|
| |
- // Remember that the DOM is ready
|
| |
- jQuery.isReady = true;
|
| |
-
|
| |
- // If a normal DOM Ready event fired, decrement, and wait if need be
|
| |
- if ( wait !== true && --jQuery.readyWait > 0 ) {
|
| |
- return;
|
| |
- }
|
| |
-
|
| |
- // If there are functions bound, to execute
|
| |
- readyList.fireWith( document, [ jQuery ] );
|
| |
+ jQuery.extend( {
|
| |
|
| |
- // Trigger any bound ready events
|
| |
- if ( jQuery.fn.trigger ) {
|
| |
- jQuery( document ).trigger( "ready" ).off( "ready" );
|
| |
- }
|
| |
- }
|
| |
- },
|
| |
-
|
| |
- bindReady: function() {
|
| |
- if ( readyList ) {
|
| |
- return;
|
| |
- }
|
| |
-
|
| |
- readyList = jQuery.Callbacks( "once memory" );
|
| |
-
|
| |
- // Catch cases where $(document).ready() is called after the
|
| |
- // browser event has already occurred.
|
| |
- if ( document.readyState === "complete" ) {
|
| |
- // Handle it asynchronously to allow scripts the opportunity to delay ready
|
| |
- return setTimeout( jQuery.ready, 1 );
|
| |
- }
|
| |
-
|
| |
- // Mozilla, Opera and webkit nightlies currently support this event
|
| |
- if ( document.addEventListener ) {
|
| |
- // Use the handy event callback
|
| |
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
| |
-
|
| |
- // A fallback to window.onload, that will always work
|
| |
- window.addEventListener( "load", jQuery.ready, false );
|
| |
-
|
| |
- // If IE event model is used
|
| |
- } else if ( document.attachEvent ) {
|
| |
- // ensure firing before onload,
|
| |
- // maybe late but safe also for iframes
|
| |
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
|
| |
-
|
| |
- // A fallback to window.onload, that will always work
|
| |
- window.attachEvent( "onload", jQuery.ready );
|
| |
-
|
| |
- // If IE and not a frame
|
| |
- // continually check to see if the document is ready
|
| |
- var toplevel = false;
|
| |
-
|
| |
- try {
|
| |
- toplevel = window.frameElement == null;
|
| |
- } catch(e) {}
|
| |
-
|
| |
- if ( document.documentElement.doScroll && toplevel ) {
|
| |
- doScrollCheck();
|
| |
- }
|
| |
- }
|
| |
- },
|
| |
-
|
| |
- // See test/unit/core.js for details concerning isFunction.
|
| |
- // Since version 1.3, DOM methods and functions like alert
|
| |
- // aren't supported. They return false on IE (#2968).
|
| |
- isFunction: function( obj ) {
|
| |
- return jQuery.type(obj) === "function";
|
| |
- },
|
| |
-
|
| |
- isArray: Array.isArray || function( obj ) {
|
| |
- return jQuery.type(obj) === "array";
|
| |
- },
|
| |
+ // Unique for each copy of jQuery on the page
|
| |
+ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
|
| |
|
| |
- isWindow: function( obj ) {
|
| |
- return obj != null && obj == obj.window;
|
| |
- },
|
| |
+ // Assume jQuery is ready without the ready module
|
| |
+ isReady: true,
|
| |
|
| |
- isNumeric: function( obj ) {
|
| |
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
|
| |
+ error: function( msg ) {
|
| |
+ throw new Error( msg );
|
| |
},
|
| |
|
| |
- type: function( obj ) {
|
| |
- return obj == null ?
|
| |
- String( obj ) :
|
| |
- class2type[ toString.call(obj) ] || "object";
|
| |
- },
|
| |
+ noop: function() {},
|
| |
|
| |
isPlainObject: function( obj ) {
|
| |
- // Must be an Object.
|
| |
- // Because of IE, we also have to check the presence of the constructor property.
|
| |
- // Make sure that DOM nodes and window objects don't pass through, as well
|
| |
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
| |
- return false;
|
| |
- }
|
| |
+ var proto, Ctor;
|
| |
|
| |
- try {
|
| |
- // Not own constructor property must be Object
|
| |
- if ( obj.constructor &&
|
| |
- !hasOwn.call(obj, "constructor") &&
|
| |
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
|
| |
- return false;
|
| |
- }
|
| |
- } catch ( e ) {
|
| |
- // IE8,9 Will throw exceptions on certain host objects #9897
|
| |
+ // Detect obvious negatives
|
| |
+ // Use toString instead of jQuery.type to catch host objects
|
| |
+ if ( !obj || toString.call( obj ) !== "[object Object]" ) {
|
| |
return false;
|
| |
}
|
| |
|
| |
- // Own properties are enumerated firstly, so to speed up,
|
| |
- // if last one is own, then all properties are own.
|
| |
-
|
| |
- var key;
|
| |
- for ( key in obj ) {}
|
| |
+ proto = getProto( obj );
|
| |
|
| |
- return key === undefined || hasOwn.call( obj, key );
|
| |
- },
|
| |
-
|
| |
- isEmptyObject: function( obj ) {
|
| |
- for ( var name in obj ) {
|
| |
- return false;
|
| |
+ // Objects with no prototype (e.g., `Object.create( null )`) are plain
|
| |
+ if ( !proto ) {
|
| |
+ return true;
|
| |
}
|
| |
- return true;
|
| |
- },
|
| |
|
| |
- error: function( msg ) {
|
| |
- throw new Error( msg );
|
| |
+ // Objects with prototype are plain iff they were constructed by a global Object function
|
| |
+ Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
|
| |
+ return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
|
| |
},
|
| |
|
| |
- parseJSON: function( data ) {
|
| |
- if ( typeof data !== "string" || !data ) {
|
| |
- return null;
|
| |
- }
|
| |
-
|
| |
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
|
| |
- data = jQuery.trim( data );
|
| |
-
|
| |
- // Attempt to parse using the native JSON parser first
|
| |
- if ( window.JSON && window.JSON.parse ) {
|
| |
- return window.JSON.parse( data );
|
| |
- }
|
| |
-
|
| |
- // Make sure the incoming data is actual JSON
|
| |
- // Logic borrowed from http://json.org/json2.js
|
| |
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
|
| |
- .replace( rvalidtokens, "]" )
|
| |
- .replace( rvalidbraces, "")) ) {
|
| |
-
|
| |
- return ( new Function( "return " + data ) )();
|
| |
+ isEmptyObject: function( obj ) {
|
| |
|
| |
- }
|
| |
- jQuery.error( "Invalid JSON: " + data );
|
| |
- },
|
| |
+ /* eslint-disable no-unused-vars */
|
| |
+ // See https://github.com/eslint/eslint/issues/6125
|
| |
+ var name;
|
| |
|
| |
- // Cross-browser xml parsing
|
| |
- parseXML: function( data ) {
|
| |
- if ( typeof data !== "string" || !data ) {
|
| |
- return null;
|
| |
- }
|
| |
- var xml, tmp;
|
| |
- try {
|
| |
- if ( window.DOMParser ) { // Standard
|
| |
- tmp = new DOMParser();
|
| |
- xml = tmp.parseFromString( data , "text/xml" );
|
| |
- } else { // IE
|
| |
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
|
| |
- xml.async = "false";
|
| |
- xml.loadXML( data );
|
| |
- }
|
| |
- } catch( e ) {
|
| |
- xml = undefined;
|
| |
- }
|
| |
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
|
| |
- jQuery.error( "Invalid XML: " + data );
|
| |
+ for ( name in obj ) {
|
| |
+ return false;
|
| |
}
|
| |
- return xml;
|
| |
+ return true;
|
| |
},
|
| |
|
| |
- noop: function() {},
|
| |
-
|
| |
// Evaluates a script in a global context
|
| |
- // Workarounds based on findings by Jim Driscoll
|
| |
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
| |
- globalEval: function( data ) {
|
| |
- if ( data && rnotwhite.test( data ) ) {
|
| |
- // We use execScript on Internet Explorer
|
| |
- // We use an anonymous function so that context is window
|
| |
- // rather than jQuery in Firefox
|
| |
- ( window.execScript || function( data ) {
|
| |
- window[ "eval" ].call( window, data );
|
| |
- } )( data );
|
| |
- }
|
| |
- },
|
| |
-
|
| |
- // Convert dashed to camelCase; used by the css and data modules
|
| |
- // Microsoft forgot to hump their vendor prefix (#9572)
|
| |
- camelCase: function( string ) {
|
| |
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
| |
- },
|
| |
-
|
| |
- nodeName: function( elem, name ) {
|
| |
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
|
| |
+ globalEval: function( code ) {
|
| |
+ DOMEval( code );
|
| |
},
|
| |
|
| |
- // args is for internal usage only
|
| |
- each: function( object, callback, args ) {
|
| |
- var name, i = 0,
|
| |
- length = object.length,
|
| |
- isObj = length === undefined || jQuery.isFunction( object );
|
| |
+ each: function( obj, callback ) {
|
| |
+ var length, i = 0;
|
| |
|
| |
- if ( args ) {
|
| |
- if ( isObj ) {
|
| |
- for ( name in object ) {
|
| |
- if ( callback.apply( object[ name ], args ) === false ) {
|
| |
- break;
|
| |
- }
|
| |
- }
|
| |
- } else {
|
| |
- for ( ; i < length; ) {
|
| |
- if ( callback.apply( object[ i++ ], args ) === false ) {
|
| |
- break;
|
| |
- }
|
| |
+ if ( isArrayLike( obj ) ) {
|
| |
+ length = obj.length;
|
| |
+ for ( ; i < length; i++ ) {
|
| |
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
| |
+ break;
|
| |
}
|
| |
}
|
| |
-
|
| |
- // A special, fast, case for the most common use of each
|
| |
} else {
|
| |
- if ( isObj ) {
|
| |
- for ( name in object ) {
|
| |
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
|
| |
- break;
|
| |
- }
|
| |
- }
|
| |
- } else {
|
| |
- for ( ; i < length; ) {
|
| |
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
|
| |
- break;
|
| |
- }
|
| |
+ for ( i in obj ) {
|
| |
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
| |
+ break;
|
| |
}
|
| |
}
|
| |
}
|
| |
|
| |
- return object;
|
| |
+ return obj;
|
| |
},
|
| |
|
| |
- // Use native String.trim function wherever possible
|
| |
- trim: trim ?
|
| |
- function( text ) {
|
| |
- return text == null ?
|
| |
- "" :
|
| |
- trim.call( text );
|
| |
- } :
|
| |
-
|
| |
- // Otherwise use our own trimming functionality
|
| |
- function( text ) {
|
| |
- return text == null ?
|
| |
- "" :
|
| |
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
|
| |
- },
|
| |
+ // Support: Android <=4.0 only
|
| |
+ trim: function( text ) {
|
| |
+ return text == null ?
|
| |
+ "" :
|
| |
+ ( text + "" ).replace( rtrim, "" );
|
| |
+ },
|
| |
|
| |
// results is for internal usage only
|
| |
- makeArray: function( array, results ) {
|
| |
+ makeArray: function( arr, results ) {
|
| |
var ret = results || [];
|
| |
|
| |
- if ( array != null ) {
|
| |
- // The window, strings (and functions) also have 'length'
|
| |
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
|
| |
- var type = jQuery.type( array );
|
| |
-
|
| |
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
|
| |
- push.call( ret, array );
|
| |
+ if ( arr != null ) {
|
| |
+ if ( isArrayLike( Object( arr ) ) ) {
|
| |
+ jQuery.merge( ret,
|
| |
+ typeof arr === "string" ?
|
| |
+ [ arr ] : arr
|
| |
+ );
|
| |
} else {
|
| |
- jQuery.merge( ret, array );
|
| |
+ push.call( ret, arr );
|
| |
}
|
| |
}
|
| |
|
| |
return ret;
|
| |
},
|
| |
|
| |
- inArray: function( elem, array, i ) {
|
| |
- var len;
|
| |
-
|
| |
- if ( array ) {
|
| |
- if ( indexOf ) {
|
| |
- return indexOf.call( array, elem, i );
|
| |
- }
|
| |
-
|
| |
- len = array.length;
|
| |
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
|
| |
-
|
| |
- for ( ; i < len; i++ ) {
|
| |
- // Skip accessing in sparse arrays
|
| |
- if ( i in array && array[ i ] === elem ) {
|
| |
- return i;
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
-
|
| |
- return -1;
|
| |
+ inArray: function( elem, arr, i ) {
|
| |
+ return arr == null ? -1 : indexOf.call( arr, elem, i );
|
| |
},
|
| |
|
| |
+ // Support: Android <=4.0 only, PhantomJS 1 only
|
| |
+ // push.apply(_, arraylike) throws on ancient WebKit
|
| |
merge: function( first, second ) {
|
| |
- var i = first.length,
|
| |
- j = 0;
|
| |
-
|
| |
- if ( typeof second.length === "number" ) {
|
| |
- for ( var l = second.length; j < l; j++ ) {
|
| |
- first[ i++ ] = second[ j ];
|
| |
- }
|
| |
+ var len = +second.length,
|
| |
+ j = 0,
|
| |
+ i = first.length;
|
| |
|
| |
- } else {
|
| |
- while ( second[j] !== undefined ) {
|
| |
- first[ i++ ] = second[ j++ ];
|
| |
- }
|
| |
+ for ( ; j < len; j++ ) {
|
| |
+ first[ i++ ] = second[ j ];
|
| |
}
|
| |
|
| |
first.length = i;
|
| |
@@ -743,6219 +411,6235 @@
|
| |
return first;
|
| |
},
|
| |
|
| |
- grep: function( elems, callback, inv ) {
|
| |
- var ret = [], retVal;
|
| |
- inv = !!inv;
|
| |
+ grep: function( elems, callback, invert ) {
|
| |
+ var callbackInverse,
|
| |
+ matches = [],
|
| |
+ i = 0,
|
| |
+ length = elems.length,
|
| |
+ callbackExpect = !invert;
|
| |
|
| |
// Go through the array, only saving the items
|
| |
// that pass the validator function
|
| |
- for ( var i = 0, length = elems.length; i < length; i++ ) {
|
| |
- retVal = !!callback( elems[ i ], i );
|
| |
- if ( inv !== retVal ) {
|
| |
- ret.push( elems[ i ] );
|
| |
+ for ( ; i < length; i++ ) {
|
| |
+ callbackInverse = !callback( elems[ i ], i );
|
| |
+ if ( callbackInverse !== callbackExpect ) {
|
| |
+ matches.push( elems[ i ] );
|
| |
}
|
| |
}
|
| |
|
| |
- return ret;
|
| |
+ return matches;
|
| |
},
|
| |
|
| |
// arg is for internal usage only
|
| |
map: function( elems, callback, arg ) {
|
| |
- var value, key, ret = [],
|
| |
+ var length, value,
|
| |
i = 0,
|
| |
- length = elems.length,
|
| |
- // jquery objects are treated as arrays
|
| |
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
|
| |
+ ret = [];
|
| |
|
| |
- // Go through the array, translating each of the items to their
|
| |
- if ( isArray ) {
|
| |
+ // Go through the array, translating each of the items to their new values
|
| |
+ if ( isArrayLike( elems ) ) {
|
| |
+ length = elems.length;
|
| |
for ( ; i < length; i++ ) {
|
| |
value = callback( elems[ i ], i, arg );
|
| |
|
| |
if ( value != null ) {
|
| |
- ret[ ret.length ] = value;
|
| |
+ ret.push( value );
|
| |
}
|
| |
}
|
| |
|
| |
// Go through every key on the object,
|
| |
} else {
|
| |
- for ( key in elems ) {
|
| |
- value = callback( elems[ key ], key, arg );
|
| |
+ for ( i in elems ) {
|
| |
+ value = callback( elems[ i ], i, arg );
|
| |
|
| |
if ( value != null ) {
|
| |
- ret[ ret.length ] = value;
|
| |
+ ret.push( value );
|
| |
}
|
| |
}
|
| |
}
|
| |
|
| |
// Flatten any nested arrays
|
| |
- return ret.concat.apply( [], ret );
|
| |
+ return concat.apply( [], ret );
|
| |
},
|
| |
|
| |
// A global GUID counter for objects
|
| |
guid: 1,
|
| |
|
| |
- // Bind a function to a context, optionally partially applying any
|
| |
- // arguments.
|
| |
- proxy: function( fn, context ) {
|
| |
- if ( typeof context === "string" ) {
|
| |
- var tmp = fn[ context ];
|
| |
- context = fn;
|
| |
- fn = tmp;
|
| |
- }
|
| |
-
|
| |
- // Quick check to determine if target is callable, in the spec
|
| |
- // this throws a TypeError, but we will just return undefined.
|
| |
- if ( !jQuery.isFunction( fn ) ) {
|
| |
- return undefined;
|
| |
- }
|
| |
-
|
| |
- // Simulated bind
|
| |
- var args = slice.call( arguments, 2 ),
|
| |
- proxy = function() {
|
| |
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
|
| |
- };
|
| |
-
|
| |
- // Set the guid of unique handler to the same of original handler, so it can be removed
|
| |
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
|
| |
+ // jQuery.support is not used in Core but other projects attach their
|
| |
+ // properties to it so it needs to exist.
|
| |
+ support: support
|
| |
+ } );
|
| |
|
| |
- return proxy;
|
| |
- },
|
| |
+ if ( typeof Symbol === "function" ) {
|
| |
+ jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
|
| |
+ }
|
| |
|
| |
- // Mutifunctional method to get and set values to a collection
|
| |
- // The value/s can optionally be executed if it's a function
|
| |
- access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
|
| |
- var exec,
|
| |
- bulk = key == null,
|
| |
- i = 0,
|
| |
- length = elems.length;
|
| |
+ // Populate the class2type map
|
| |
+ jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
|
| |
+ function( i, name ) {
|
| |
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
| |
+ } );
|
| |
|
| |
- // Sets many values
|
| |
- if ( key && typeof key === "object" ) {
|
| |
- for ( i in key ) {
|
| |
- jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
|
| |
- }
|
| |
- chainable = 1;
|
| |
+ function isArrayLike( obj ) {
|
| |
|
| |
- // Sets one value
|
| |
- } else if ( value !== undefined ) {
|
| |
- // Optionally, function values get executed if exec is true
|
| |
- exec = pass === undefined && jQuery.isFunction( value );
|
| |
+ // Support: real iOS 8.2 only (not reproducible in simulator)
|
| |
+ // `in` check used to prevent JIT error (gh-2145)
|
| |
+ // hasOwn isn't used here due to false negatives
|
| |
+ // regarding Nodelist length in IE
|
| |
+ var length = !!obj && "length" in obj && obj.length,
|
| |
+ type = toType( obj );
|
| |
|
| |
- if ( bulk ) {
|
| |
- // Bulk operations only iterate when executing function values
|
| |
- if ( exec ) {
|
| |
- exec = fn;
|
| |
- fn = function( elem, key, value ) {
|
| |
- return exec.call( jQuery( elem ), value );
|
| |
- };
|
| |
+ if ( isFunction( obj ) || isWindow( obj ) ) {
|
| |
+ return false;
|
| |
+ }
|
| |
|
| |
- // Otherwise they run against the entire set
|
| |
- } else {
|
| |
- fn.call( elems, value );
|
| |
- fn = null;
|
| |
- }
|
| |
- }
|
| |
+ return type === "array" || length === 0 ||
|
| |
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj;
|
| |
+ }
|
| |
+ var Sizzle =
|
| |
+ /*!
|
| |
+ * Sizzle CSS Selector Engine v2.3.3
|
| |
+ * https://sizzlejs.com/
|
| |
+ *
|
| |
+ * Copyright jQuery Foundation and other contributors
|
| |
+ * Released under the MIT license
|
| |
+ * http://jquery.org/license
|
| |
+ *
|
| |
+ * Date: 2016-08-08
|
| |
+ */
|
| |
+ (function( window ) {
|
| |
+
|
| |
+ var i,
|
| |
+ support,
|
| |
+ Expr,
|
| |
+ getText,
|
| |
+ isXML,
|
| |
+ tokenize,
|
| |
+ compile,
|
| |
+ select,
|
| |
+ outermostContext,
|
| |
+ sortInput,
|
| |
+ hasDuplicate,
|
| |
+
|
| |
+ // Local document vars
|
| |
+ setDocument,
|
| |
+ document,
|
| |
+ docElem,
|
| |
+ documentIsHTML,
|
| |
+ rbuggyQSA,
|
| |
+ rbuggyMatches,
|
| |
+ matches,
|
| |
+ contains,
|
| |
+
|
| |
+ // Instance-specific data
|
| |
+ expando = "sizzle" + 1 * new Date(),
|
| |
+ preferredDoc = window.document,
|
| |
+ dirruns = 0,
|
| |
+ done = 0,
|
| |
+ classCache = createCache(),
|
| |
+ tokenCache = createCache(),
|
| |
+ compilerCache = createCache(),
|
| |
+ sortOrder = function( a, b ) {
|
| |
+ if ( a === b ) {
|
| |
+ hasDuplicate = true;
|
| |
+ }
|
| |
+ return 0;
|
| |
+ },
|
| |
|
| |
- if ( fn ) {
|
| |
- for (; i < length; i++ ) {
|
| |
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
|
| |
- }
|
| |
+ // Instance methods
|
| |
+ hasOwn = ({}).hasOwnProperty,
|
| |
+ arr = [],
|
| |
+ pop = arr.pop,
|
| |
+ push_native = arr.push,
|
| |
+ push = arr.push,
|
| |
+ slice = arr.slice,
|
| |
+ // Use a stripped-down indexOf as it's faster than native
|
| |
+ // https://jsperf.com/thor-indexof-vs-for/5
|
| |
+ indexOf = function( list, elem ) {
|
| |
+ var i = 0,
|
| |
+ len = list.length;
|
| |
+ for ( ; i < len; i++ ) {
|
| |
+ if ( list[i] === elem ) {
|
| |
+ return i;
|
| |
}
|
| |
-
|
| |
- chainable = 1;
|
| |
}
|
| |
+ return -1;
|
| |
+ },
|
| |
|
| |
- return chainable ?
|
| |
- elems :
|
| |
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
|
| |
|
| |
- // Gets
|
| |
- bulk ?
|
| |
- fn.call( elems ) :
|
| |
- length ? fn( elems[0], key ) : emptyGet;
|
| |
- },
|
| |
+ // Regular expressions
|
| |
|
| |
- now: function() {
|
| |
- return ( new Date() ).getTime();
|
| |
- },
|
| |
+ // http://www.w3.org/TR/css3-selectors/#whitespace
|
| |
+ whitespace = "[\\x20\\t\\r\\n\\f]",
|
| |
|
| |
- // Use of jQuery.browser is frowned upon.
|
| |
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
|
| |
- uaMatch: function( ua ) {
|
| |
- ua = ua.toLowerCase();
|
| |
+ // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
|
| |
+ identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
|
| |
|
| |
- var match = rwebkit.exec( ua ) ||
|
| |
- ropera.exec( ua ) ||
|
| |
- rmsie.exec( ua ) ||
|
| |
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
|
| |
- [];
|
| |
+ // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
|
| |
+ attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
|
| |
+ // Operator (capture 2)
|
| |
+ "*([*^$|!~]?=)" + whitespace +
|
| |
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
|
| |
+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
|
| |
+ "*\\]",
|
| |
|
| |
- return { browser: match[1] || "", version: match[2] || "0" };
|
| |
- },
|
| |
+ pseudos = ":(" + identifier + ")(?:\\((" +
|
| |
+ // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
|
| |
+ // 1. quoted (capture 3; capture 4 or capture 5)
|
| |
+ "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
|
| |
+ // 2. simple (capture 6)
|
| |
+ "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
|
| |
+ // 3. anything else (capture 2)
|
| |
+ ".*" +
|
| |
+ ")\\)|)",
|
| |
|
| |
- sub: function() {
|
| |
- function jQuerySub( selector, context ) {
|
| |
- return new jQuerySub.fn.init( selector, context );
|
| |
- }
|
| |
- jQuery.extend( true, jQuerySub, this );
|
| |
- jQuerySub.superclass = this;
|
| |
- jQuerySub.fn = jQuerySub.prototype = this();
|
| |
- jQuerySub.fn.constructor = jQuerySub;
|
| |
- jQuerySub.sub = this.sub;
|
| |
- jQuerySub.fn.init = function init( selector, context ) {
|
| |
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
|
| |
- context = jQuerySub( context );
|
| |
- }
|
| |
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
|
| |
+ rwhitespace = new RegExp( whitespace + "+", "g" ),
|
| |
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
|
| |
|
| |
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
|
| |
- };
|
| |
- jQuerySub.fn.init.prototype = jQuerySub.fn;
|
| |
- var rootjQuerySub = jQuerySub(document);
|
| |
- return jQuerySub;
|
| |
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
|
| |
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
|
| |
+
|
| |
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
|
| |
+
|
| |
+ rpseudo = new RegExp( pseudos ),
|
| |
+ ridentifier = new RegExp( "^" + identifier + "$" ),
|
| |
+
|
| |
+ matchExpr = {
|
| |
+ "ID": new RegExp( "^#(" + identifier + ")" ),
|
| |
+ "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
|
| |
+ "TAG": new RegExp( "^(" + identifier + "|[*])" ),
|
| |
+ "ATTR": new RegExp( "^" + attributes ),
|
| |
+ "PSEUDO": new RegExp( "^" + pseudos ),
|
| |
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
|
| |
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
|
| |
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
|
| |
+ "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
|
| |
+ // For use in libraries implementing .is()
|
| |
+ // We use this for POS matching in `select`
|
| |
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
|
| |
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
|
| |
},
|
| |
|
| |
- browser: {}
|
| |
- });
|
| |
+ rinputs = /^(?:input|select|textarea|button)$/i,
|
| |
+ rheader = /^h\d$/i,
|
| |
|
| |
- // Populate the class2type map
|
| |
- jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
|
| |
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
| |
- });
|
| |
+ rnative = /^[^{]+\{\s*\[native \w/,
|
| |
|
| |
- browserMatch = jQuery.uaMatch( userAgent );
|
| |
- if ( browserMatch.browser ) {
|
| |
- jQuery.browser[ browserMatch.browser ] = true;
|
| |
- jQuery.browser.version = browserMatch.version;
|
| |
- }
|
| |
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
|
| |
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
|
| |
|
| |
- // Deprecated, use jQuery.browser.webkit instead
|
| |
- if ( jQuery.browser.webkit ) {
|
| |
- jQuery.browser.safari = true;
|
| |
- }
|
| |
+ rsibling = /[+~]/,
|
| |
|
| |
- // IE doesn't match non-breaking spaces with \s
|
| |
- if ( rnotwhite.test( "\xA0" ) ) {
|
| |
- trimLeft = /^[\s\xA0]+/;
|
| |
- trimRight = /[\s\xA0]+$/;
|
| |
- }
|
| |
+ // CSS escapes
|
| |
+ // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
|
| |
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
|
| |
+ funescape = function( _, escaped, escapedWhitespace ) {
|
| |
+ var high = "0x" + escaped - 0x10000;
|
| |
+ // NaN means non-codepoint
|
| |
+ // Support: Firefox<24
|
| |
+ // Workaround erroneous numeric interpretation of +"0x"
|
| |
+ return high !== high || escapedWhitespace ?
|
| |
+ escaped :
|
| |
+ high < 0 ?
|
| |
+ // BMP codepoint
|
| |
+ String.fromCharCode( high + 0x10000 ) :
|
| |
+ // Supplemental Plane codepoint (surrogate pair)
|
| |
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
|
| |
+ },
|
| |
|
| |
- // All jQuery objects should point back to these
|
| |
- rootjQuery = jQuery(document);
|
| |
+ // CSS string/identifier serialization
|
| |
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
|
| |
+ rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
|
| |
+ fcssescape = function( ch, asCodePoint ) {
|
| |
+ if ( asCodePoint ) {
|
| |
|
| |
- // Cleanup functions for the document ready method
|
| |
- if ( document.addEventListener ) {
|
| |
- DOMContentLoaded = function() {
|
| |
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
|
| |
- jQuery.ready();
|
| |
- };
|
| |
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
|
| |
+ if ( ch === "\0" ) {
|
| |
+ return "\uFFFD";
|
| |
+ }
|
| |
|
| |
- } else if ( document.attachEvent ) {
|
| |
- DOMContentLoaded = function() {
|
| |
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
| |
- if ( document.readyState === "complete" ) {
|
| |
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
|
| |
- jQuery.ready();
|
| |
+ // Control characters and (dependent upon position) numbers get escaped as code points
|
| |
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
|
| |
}
|
| |
- };
|
| |
- }
|
| |
|
| |
- // The DOM ready check for Internet Explorer
|
| |
- function doScrollCheck() {
|
| |
- if ( jQuery.isReady ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Other potentially-special ASCII characters get backslash-escaped
|
| |
+ return "\\" + ch;
|
| |
+ },
|
| |
+
|
| |
+ // Used for iframes
|
| |
+ // See setDocument()
|
| |
+ // Removing the function wrapper causes a "Permission Denied"
|
| |
+ // error in IE
|
| |
+ unloadHandler = function() {
|
| |
+ setDocument();
|
| |
+ },
|
| |
+
|
| |
+ disabledAncestor = addCombinator(
|
| |
+ function( elem ) {
|
| |
+ return elem.disabled === true && ("form" in elem || "label" in elem);
|
| |
+ },
|
| |
+ { dir: "parentNode", next: "legend" }
|
| |
+ );
|
| |
|
| |
- try {
|
| |
- // If IE is used, use the trick by Diego Perini
|
| |
- // http://javascript.nwbox.com/IEContentLoaded/
|
| |
- document.documentElement.doScroll("left");
|
| |
- } catch(e) {
|
| |
- setTimeout( doScrollCheck, 1 );
|
| |
- return;
|
| |
- }
|
| |
+ // Optimize for push.apply( _, NodeList )
|
| |
+ try {
|
| |
+ push.apply(
|
| |
+ (arr = slice.call( preferredDoc.childNodes )),
|
| |
+ preferredDoc.childNodes
|
| |
+ );
|
| |
+ // Support: Android<4.0
|
| |
+ // Detect silently failing push.apply
|
| |
+ arr[ preferredDoc.childNodes.length ].nodeType;
|
| |
+ } catch ( e ) {
|
| |
+ push = { apply: arr.length ?
|
| |
+
|
| |
+ // Leverage slice if possible
|
| |
+ function( target, els ) {
|
| |
+ push_native.apply( target, slice.call(els) );
|
| |
+ } :
|
| |
|
| |
- // and execute any waiting functions
|
| |
- jQuery.ready();
|
| |
+ // Support: IE<9
|
| |
+ // Otherwise append directly
|
| |
+ function( target, els ) {
|
| |
+ var j = target.length,
|
| |
+ i = 0;
|
| |
+ // Can't trust NodeList.length
|
| |
+ while ( (target[j++] = els[i++]) ) {}
|
| |
+ target.length = j - 1;
|
| |
+ }
|
| |
+ };
|
| |
}
|
| |
|
| |
- return jQuery;
|
| |
+ function Sizzle( selector, context, results, seed ) {
|
| |
+ var m, i, elem, nid, match, groups, newSelector,
|
| |
+ newContext = context && context.ownerDocument,
|
| |
|
| |
- })();
|
| |
+ // nodeType defaults to 9, since context defaults to document
|
| |
+ nodeType = context ? context.nodeType : 9;
|
| |
|
| |
+ results = results || [];
|
| |
|
| |
- // String to Object flags format cache
|
| |
- var flagsCache = {};
|
| |
+ // Return early from calls with invalid selector or context
|
| |
+ if ( typeof selector !== "string" || !selector ||
|
| |
+ nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
|
| |
|
| |
- // Convert String-formatted flags into Object-formatted ones and store in cache
|
| |
- function createFlags( flags ) {
|
| |
- var object = flagsCache[ flags ] = {},
|
| |
- i, length;
|
| |
- flags = flags.split( /\s+/ );
|
| |
- for ( i = 0, length = flags.length; i < length; i++ ) {
|
| |
- object[ flags[i] ] = true;
|
| |
+ return results;
|
| |
}
|
| |
- return object;
|
| |
- }
|
| |
|
| |
- /*
|
| |
- * Create a callback list using the following parameters:
|
| |
- *
|
| |
- * flags: an optional list of space-separated flags that will change how
|
| |
- * the callback list behaves
|
| |
- *
|
| |
- * By default a callback list will act like an event callback list and can be
|
| |
- * "fired" multiple times.
|
| |
- *
|
| |
- * Possible flags:
|
| |
- *
|
| |
- * once: will ensure the callback list can only be fired once (like a Deferred)
|
| |
- *
|
| |
- * memory: will keep track of previous values and will call any callback added
|
| |
- * after the list has been fired right away with the latest "memorized"
|
| |
- * values (like a Deferred)
|
| |
- *
|
| |
- * unique: will ensure a callback can only be added once (no duplicate in the list)
|
| |
- *
|
| |
- * stopOnFalse: interrupt callings when a callback returns false
|
| |
- *
|
| |
- */
|
| |
- jQuery.Callbacks = function( flags ) {
|
| |
+ // Try to shortcut find operations (as opposed to filters) in HTML documents
|
| |
+ if ( !seed ) {
|
| |
|
| |
- // Convert flags from String-formatted to Object-formatted
|
| |
- // (we check in cache first)
|
| |
- flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
|
| |
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
|
| |
+ setDocument( context );
|
| |
+ }
|
| |
+ context = context || document;
|
| |
|
| |
- var // Actual callback list
|
| |
- list = [],
|
| |
- // Stack of fire calls for repeatable lists
|
| |
- stack = [],
|
| |
- // Last fire value (for non-forgettable lists)
|
| |
- memory,
|
| |
- // Flag to know if list was already fired
|
| |
- fired,
|
| |
- // Flag to know if list is currently firing
|
| |
- firing,
|
| |
- // First callback to fire (used internally by add and fireWith)
|
| |
- firingStart,
|
| |
- // End of the loop when firing
|
| |
- firingLength,
|
| |
- // Index of currently firing callback (modified by remove if needed)
|
| |
- firingIndex,
|
| |
- // Add one or several callbacks to the list
|
| |
- add = function( args ) {
|
| |
- var i,
|
| |
- length,
|
| |
- elem,
|
| |
- type,
|
| |
- actual;
|
| |
- for ( i = 0, length = args.length; i < length; i++ ) {
|
| |
- elem = args[ i ];
|
| |
- type = jQuery.type( elem );
|
| |
- if ( type === "array" ) {
|
| |
- // Inspect recursively
|
| |
- add( elem );
|
| |
- } else if ( type === "function" ) {
|
| |
- // Add if not in unique mode and callback is not in
|
| |
- if ( !flags.unique || !self.has( elem ) ) {
|
| |
- list.push( elem );
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- },
|
| |
- // Fire callbacks
|
| |
- fire = function( context, args ) {
|
| |
- args = args || [];
|
| |
- memory = !flags.memory || [ context, args ];
|
| |
- fired = true;
|
| |
- firing = true;
|
| |
- firingIndex = firingStart || 0;
|
| |
- firingStart = 0;
|
| |
- firingLength = list.length;
|
| |
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
|
| |
- if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
|
| |
- memory = true; // Mark as halted
|
| |
- break;
|
| |
- }
|
| |
- }
|
| |
- firing = false;
|
| |
- if ( list ) {
|
| |
- if ( !flags.once ) {
|
| |
- if ( stack && stack.length ) {
|
| |
- memory = stack.shift();
|
| |
- self.fireWith( memory[ 0 ], memory[ 1 ] );
|
| |
- }
|
| |
- } else if ( memory === true ) {
|
| |
- self.disable();
|
| |
- } else {
|
| |
- list = [];
|
| |
- }
|
| |
- }
|
| |
- },
|
| |
- // Actual Callbacks object
|
| |
- self = {
|
| |
- // Add a callback or a collection of callbacks to the list
|
| |
- add: function() {
|
| |
- if ( list ) {
|
| |
- var length = list.length;
|
| |
- add( arguments );
|
| |
- // Do we need to add the callbacks to the
|
| |
- // current firing batch?
|
| |
- if ( firing ) {
|
| |
- firingLength = list.length;
|
| |
- // With memory, if we're not firing then
|
| |
- // we should call right away, unless previous
|
| |
- // firing was halted (stopOnFalse)
|
| |
- } else if ( memory && memory !== true ) {
|
| |
- firingStart = length;
|
| |
- fire( memory[ 0 ], memory[ 1 ] );
|
| |
- }
|
| |
- }
|
| |
- return this;
|
| |
- },
|
| |
- // Remove a callback from the list
|
| |
- remove: function() {
|
| |
- if ( list ) {
|
| |
- var args = arguments,
|
| |
- argIndex = 0,
|
| |
- argLength = args.length;
|
| |
- for ( ; argIndex < argLength ; argIndex++ ) {
|
| |
- for ( var i = 0; i < list.length; i++ ) {
|
| |
- if ( args[ argIndex ] === list[ i ] ) {
|
| |
- // Handle firingIndex and firingLength
|
| |
- if ( firing ) {
|
| |
- if ( i <= firingLength ) {
|
| |
- firingLength--;
|
| |
- if ( i <= firingIndex ) {
|
| |
- firingIndex--;
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- // Remove the element
|
| |
- list.splice( i--, 1 );
|
| |
- // If we have some unicity property then
|
| |
- // we only need to do this once
|
| |
- if ( flags.unique ) {
|
| |
- break;
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- return this;
|
| |
- },
|
| |
- // Control if a given callback is in the list
|
| |
- has: function( fn ) {
|
| |
- if ( list ) {
|
| |
- var i = 0,
|
| |
- length = list.length;
|
| |
- for ( ; i < length; i++ ) {
|
| |
- if ( fn === list[ i ] ) {
|
| |
- return true;
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- return false;
|
| |
- },
|
| |
- // Remove all callbacks from the list
|
| |
- empty: function() {
|
| |
- list = [];
|
| |
- return this;
|
| |
- },
|
| |
- // Have the list do nothing anymore
|
| |
- disable: function() {
|
| |
- list = stack = memory = undefined;
|
| |
- return this;
|
| |
- },
|
| |
- // Is it disabled?
|
| |
- disabled: function() {
|
| |
- return !list;
|
| |
- },
|
| |
- // Lock the list in its current state
|
| |
- lock: function() {
|
| |
- stack = undefined;
|
| |
- if ( !memory || memory === true ) {
|
| |
- self.disable();
|
| |
- }
|
| |
- return this;
|
| |
- },
|
| |
- // Is it locked?
|
| |
- locked: function() {
|
| |
- return !stack;
|
| |
- },
|
| |
- // Call all callbacks with the given context and arguments
|
| |
- fireWith: function( context, args ) {
|
| |
- if ( stack ) {
|
| |
- if ( firing ) {
|
| |
- if ( !flags.once ) {
|
| |
- stack.push( [ context, args ] );
|
| |
- }
|
| |
- } else if ( !( flags.once && memory ) ) {
|
| |
- fire( context, args );
|
| |
- }
|
| |
- }
|
| |
- return this;
|
| |
- },
|
| |
- // Call all the callbacks with the given arguments
|
| |
- fire: function() {
|
| |
- self.fireWith( this, arguments );
|
| |
- return this;
|
| |
- },
|
| |
- // To know if the callbacks have already been called at least once
|
| |
- fired: function() {
|
| |
- return !!fired;
|
| |
- }
|
| |
- };
|
| |
+ if ( documentIsHTML ) {
|
| |
|
| |
- return self;
|
| |
- };
|
| |
+ // If the selector is sufficiently simple, try using a "get*By*" DOM method
|
| |
+ // (excepting DocumentFragment context, where the methods don't exist)
|
| |
+ if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
|
| |
|
| |
+ // ID selector
|
| |
+ if ( (m = match[1]) ) {
|
| |
|
| |
+ // Document context
|
| |
+ if ( nodeType === 9 ) {
|
| |
+ if ( (elem = context.getElementById( m )) ) {
|
| |
|
| |
+ // Support: IE, Opera, Webkit
|
| |
+ // TODO: identify versions
|
| |
+ // getElementById can match elements by name instead of ID
|
| |
+ if ( elem.id === m ) {
|
| |
+ results.push( elem );
|
| |
+ return results;
|
| |
+ }
|
| |
+ } else {
|
| |
+ return results;
|
| |
+ }
|
| |
|
| |
- var // Static reference to slice
|
| |
- sliceDeferred = [].slice;
|
| |
+ // Element context
|
| |
+ } else {
|
| |
|
| |
- jQuery.extend({
|
| |
+ // Support: IE, Opera, Webkit
|
| |
+ // TODO: identify versions
|
| |
+ // getElementById can match elements by name instead of ID
|
| |
+ if ( newContext && (elem = newContext.getElementById( m )) &&
|
| |
+ contains( context, elem ) &&
|
| |
+ elem.id === m ) {
|
| |
|
| |
- Deferred: function( func ) {
|
| |
- var doneList = jQuery.Callbacks( "once memory" ),
|
| |
- failList = jQuery.Callbacks( "once memory" ),
|
| |
- progressList = jQuery.Callbacks( "memory" ),
|
| |
- state = "pending",
|
| |
- lists = {
|
| |
- resolve: doneList,
|
| |
- reject: failList,
|
| |
- notify: progressList
|
| |
- },
|
| |
- promise = {
|
| |
- done: doneList.add,
|
| |
- fail: failList.add,
|
| |
- progress: progressList.add,
|
| |
+ results.push( elem );
|
| |
+ return results;
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- state: function() {
|
| |
- return state;
|
| |
- },
|
| |
+ // Type selector
|
| |
+ } else if ( match[2] ) {
|
| |
+ push.apply( results, context.getElementsByTagName( selector ) );
|
| |
+ return results;
|
| |
|
| |
- // Deprecated
|
| |
- isResolved: doneList.fired,
|
| |
- isRejected: failList.fired,
|
| |
+ // Class selector
|
| |
+ } else if ( (m = match[3]) && support.getElementsByClassName &&
|
| |
+ context.getElementsByClassName ) {
|
| |
|
| |
- then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
|
| |
- deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
|
| |
- return this;
|
| |
- },
|
| |
- always: function() {
|
| |
- deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
|
| |
- return this;
|
| |
- },
|
| |
- pipe: function( fnDone, fnFail, fnProgress ) {
|
| |
- return jQuery.Deferred(function( newDefer ) {
|
| |
- jQuery.each( {
|
| |
- done: [ fnDone, "resolve" ],
|
| |
- fail: [ fnFail, "reject" ],
|
| |
- progress: [ fnProgress, "notify" ]
|
| |
- }, function( handler, data ) {
|
| |
- var fn = data[ 0 ],
|
| |
- action = data[ 1 ],
|
| |
- returned;
|
| |
- if ( jQuery.isFunction( fn ) ) {
|
| |
- deferred[ handler ](function() {
|
| |
- returned = fn.apply( this, arguments );
|
| |
- if ( returned && jQuery.isFunction( returned.promise ) ) {
|
| |
- returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
|
| |
- } else {
|
| |
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
|
| |
- }
|
| |
- });
|
| |
- } else {
|
| |
- deferred[ handler ]( newDefer[ action ] );
|
| |
- }
|
| |
- });
|
| |
- }).promise();
|
| |
- },
|
| |
- // Get a promise for this deferred
|
| |
- // If obj is provided, the promise aspect is added to the object
|
| |
- promise: function( obj ) {
|
| |
- if ( obj == null ) {
|
| |
- obj = promise;
|
| |
- } else {
|
| |
- for ( var key in promise ) {
|
| |
- obj[ key ] = promise[ key ];
|
| |
- }
|
| |
- }
|
| |
- return obj;
|
| |
+ push.apply( results, context.getElementsByClassName( m ) );
|
| |
+ return results;
|
| |
}
|
| |
- },
|
| |
- deferred = promise.promise({}),
|
| |
- key;
|
| |
+ }
|
| |
|
| |
- for ( key in lists ) {
|
| |
- deferred[ key ] = lists[ key ].fire;
|
| |
- deferred[ key + "With" ] = lists[ key ].fireWith;
|
| |
- }
|
| |
+ // Take advantage of querySelectorAll
|
| |
+ if ( support.qsa &&
|
| |
+ !compilerCache[ selector + " " ] &&
|
| |
+ (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
|
| |
|
| |
- // Handle state
|
| |
- deferred.done( function() {
|
| |
- state = "resolved";
|
| |
- }, failList.disable, progressList.lock ).fail( function() {
|
| |
- state = "rejected";
|
| |
- }, doneList.disable, progressList.lock );
|
| |
+ if ( nodeType !== 1 ) {
|
| |
+ newContext = context;
|
| |
+ newSelector = selector;
|
| |
|
| |
- // Call given func if any
|
| |
- if ( func ) {
|
| |
- func.call( deferred, deferred );
|
| |
- }
|
| |
+ // qSA looks outside Element context, which is not what we want
|
| |
+ // Thanks to Andrew Dupont for this workaround technique
|
| |
+ // Support: IE <=8
|
| |
+ // Exclude object elements
|
| |
+ } else if ( context.nodeName.toLowerCase() !== "object" ) {
|
| |
|
| |
- // All done!
|
| |
- return deferred;
|
| |
- },
|
| |
+ // Capture the context ID, setting it first if necessary
|
| |
+ if ( (nid = context.getAttribute( "id" )) ) {
|
| |
+ nid = nid.replace( rcssescape, fcssescape );
|
| |
+ } else {
|
| |
+ context.setAttribute( "id", (nid = expando) );
|
| |
+ }
|
| |
|
| |
- // Deferred helper
|
| |
- when: function( firstParam ) {
|
| |
- var args = sliceDeferred.call( arguments, 0 ),
|
| |
- i = 0,
|
| |
- length = args.length,
|
| |
- pValues = new Array( length ),
|
| |
- count = length,
|
| |
- pCount = length,
|
| |
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
|
| |
- firstParam :
|
| |
- jQuery.Deferred(),
|
| |
- promise = deferred.promise();
|
| |
- function resolveFunc( i ) {
|
| |
- return function( value ) {
|
| |
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
|
| |
- if ( !( --count ) ) {
|
| |
- deferred.resolveWith( deferred, args );
|
| |
+ // Prefix every selector in the list
|
| |
+ groups = tokenize( selector );
|
| |
+ i = groups.length;
|
| |
+ while ( i-- ) {
|
| |
+ groups[i] = "#" + nid + " " + toSelector( groups[i] );
|
| |
+ }
|
| |
+ newSelector = groups.join( "," );
|
| |
+
|
| |
+ // Expand context for sibling selectors
|
| |
+ newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
|
| |
+ context;
|
| |
}
|
| |
- };
|
| |
- }
|
| |
- function progressFunc( i ) {
|
| |
- return function( value ) {
|
| |
- pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
|
| |
- deferred.notifyWith( promise, pValues );
|
| |
- };
|
| |
- }
|
| |
- if ( length > 1 ) {
|
| |
- for ( ; i < length; i++ ) {
|
| |
- if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
|
| |
- args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
|
| |
- } else {
|
| |
- --count;
|
| |
+
|
| |
+ if ( newSelector ) {
|
| |
+ try {
|
| |
+ push.apply( results,
|
| |
+ newContext.querySelectorAll( newSelector )
|
| |
+ );
|
| |
+ return results;
|
| |
+ } catch ( qsaError ) {
|
| |
+ } finally {
|
| |
+ if ( nid === expando ) {
|
| |
+ context.removeAttribute( "id" );
|
| |
+ }
|
| |
+ }
|
| |
}
|
| |
}
|
| |
- if ( !count ) {
|
| |
- deferred.resolveWith( deferred, args );
|
| |
- }
|
| |
- } else if ( deferred !== firstParam ) {
|
| |
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
|
| |
}
|
| |
- return promise;
|
| |
}
|
| |
- });
|
| |
|
| |
+ // All others
|
| |
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
|
| |
+ }
|
| |
|
| |
+ /**
|
| |
+ * Create key-value caches of limited size
|
| |
+ * @returns {function(string, object)} Returns the Object data after storing it on itself with
|
| |
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
|
| |
+ * deleting the oldest entry
|
| |
+ */
|
| |
+ function createCache() {
|
| |
+ var keys = [];
|
| |
|
| |
+ function cache( key, value ) {
|
| |
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
|
| |
+ if ( keys.push( key + " " ) > Expr.cacheLength ) {
|
| |
+ // Only keep the most recent entries
|
| |
+ delete cache[ keys.shift() ];
|
| |
+ }
|
| |
+ return (cache[ key + " " ] = value);
|
| |
+ }
|
| |
+ return cache;
|
| |
+ }
|
| |
|
| |
- jQuery.support = (function() {
|
| |
-
|
| |
- var support,
|
| |
- all,
|
| |
- a,
|
| |
- select,
|
| |
- opt,
|
| |
- input,
|
| |
- fragment,
|
| |
- tds,
|
| |
- events,
|
| |
- eventName,
|
| |
- i,
|
| |
- isSupported,
|
| |
- div = document.createElement( "div" ),
|
| |
- documentElement = document.documentElement;
|
| |
-
|
| |
- // Preliminary tests
|
| |
- div.setAttribute("className", "t");
|
| |
- div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
|
| |
-
|
| |
- all = div.getElementsByTagName( "*" );
|
| |
- a = div.getElementsByTagName( "a" )[ 0 ];
|
| |
-
|
| |
- // Can't get basic test support
|
| |
- if ( !all || !all.length || !a ) {
|
| |
- return {};
|
| |
- }
|
| |
-
|
| |
- // First batch of supports tests
|
| |
- select = document.createElement( "select" );
|
| |
- opt = select.appendChild( document.createElement("option") );
|
| |
- input = div.getElementsByTagName( "input" )[ 0 ];
|
| |
-
|
| |
- support = {
|
| |
- // IE strips leading whitespace when .innerHTML is used
|
| |
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
|
| |
-
|
| |
- // Make sure that tbody elements aren't automatically inserted
|
| |
- // IE will insert them into empty tables
|
| |
- tbody: !div.getElementsByTagName("tbody").length,
|
| |
-
|
| |
- // Make sure that link elements get serialized correctly by innerHTML
|
| |
- // This requires a wrapper element in IE
|
| |
- htmlSerialize: !!div.getElementsByTagName("link").length,
|
| |
-
|
| |
- // Get the style information from getAttribute
|
| |
- // (IE uses .cssText instead)
|
| |
- style: /top/.test( a.getAttribute("style") ),
|
| |
-
|
| |
- // Make sure that URLs aren't manipulated
|
| |
- // (IE normalizes it by default)
|
| |
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
|
| |
-
|
| |
- // Make sure that element opacity exists
|
| |
- // (IE uses filter instead)
|
| |
- // Use a regex to work around a WebKit issue. See #5145
|
| |
- opacity: /^0.55/.test( a.style.opacity ),
|
| |
-
|
| |
- // Verify style float existence
|
| |
- // (IE uses styleFloat instead of cssFloat)
|
| |
- cssFloat: !!a.style.cssFloat,
|
| |
-
|
| |
- // Make sure that if no value is specified for a checkbox
|
| |
- // that it defaults to "on".
|
| |
- // (WebKit defaults to "" instead)
|
| |
- checkOn: ( input.value === "on" ),
|
| |
-
|
| |
- // Make sure that a selected-by-default option has a working selected property.
|
| |
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
| |
- optSelected: opt.selected,
|
| |
-
|
| |
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
| |
- getSetAttribute: div.className !== "t",
|
| |
-
|
| |
- // Tests for enctype support on a form(#6743)
|
| |
- enctype: !!document.createElement("form").enctype,
|
| |
-
|
| |
- // Makes sure cloning an html5 element does not cause problems
|
| |
- // Where outerHTML is undefined, this still works
|
| |
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
|
| |
-
|
| |
- // Will be defined later
|
| |
- submitBubbles: true,
|
| |
- changeBubbles: true,
|
| |
- focusinBubbles: false,
|
| |
- deleteExpando: true,
|
| |
- noCloneEvent: true,
|
| |
- inlineBlockNeedsLayout: false,
|
| |
- shrinkWrapBlocks: false,
|
| |
- reliableMarginRight: true,
|
| |
- pixelMargin: true
|
| |
- };
|
| |
+ /**
|
| |
+ * Mark a function for special use by Sizzle
|
| |
+ * @param {Function} fn The function to mark
|
| |
+ */
|
| |
+ function markFunction( fn ) {
|
| |
+ fn[ expando ] = true;
|
| |
+ return fn;
|
| |
+ }
|
| |
|
| |
- // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
|
| |
- jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
|
| |
+ /**
|
| |
+ * Support testing using an element
|
| |
+ * @param {Function} fn Passed the created element and returns a boolean result
|
| |
+ */
|
| |
+ function assert( fn ) {
|
| |
+ var el = document.createElement("fieldset");
|
| |
|
| |
- // Make sure checked status is properly cloned
|
| |
- input.checked = true;
|
| |
- support.noCloneChecked = input.cloneNode( true ).checked;
|
| |
+ try {
|
| |
+ return !!fn( el );
|
| |
+ } catch (e) {
|
| |
+ return false;
|
| |
+ } finally {
|
| |
+ // Remove from its parent by default
|
| |
+ if ( el.parentNode ) {
|
| |
+ el.parentNode.removeChild( el );
|
| |
+ }
|
| |
+ // release memory in IE
|
| |
+ el = null;
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- // Make sure that the options inside disabled selects aren't marked as disabled
|
| |
- // (WebKit marks them as disabled)
|
| |
- select.disabled = true;
|
| |
- support.optDisabled = !opt.disabled;
|
| |
+ /**
|
| |
+ * Adds the same handler for all of the specified attrs
|
| |
+ * @param {String} attrs Pipe-separated list of attributes
|
| |
+ * @param {Function} handler The method that will be applied
|
| |
+ */
|
| |
+ function addHandle( attrs, handler ) {
|
| |
+ var arr = attrs.split("|"),
|
| |
+ i = arr.length;
|
| |
|
| |
- // Test to see if it's possible to delete an expando from an element
|
| |
- // Fails in Internet Explorer
|
| |
- try {
|
| |
- delete div.test;
|
| |
- } catch( e ) {
|
| |
- support.deleteExpando = false;
|
| |
+ while ( i-- ) {
|
| |
+ Expr.attrHandle[ arr[i] ] = handler;
|
| |
}
|
| |
+ }
|
| |
|
| |
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
|
| |
- div.attachEvent( "onclick", function() {
|
| |
- // Cloning a node shouldn't copy over any
|
| |
- // bound event handlers (IE does this)
|
| |
- support.noCloneEvent = false;
|
| |
- });
|
| |
- div.cloneNode( true ).fireEvent( "onclick" );
|
| |
+ /**
|
| |
+ * Checks document order of two siblings
|
| |
+ * @param {Element} a
|
| |
+ * @param {Element} b
|
| |
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
|
| |
+ */
|
| |
+ function siblingCheck( a, b ) {
|
| |
+ var cur = b && a,
|
| |
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
|
| |
+ a.sourceIndex - b.sourceIndex;
|
| |
+
|
| |
+ // Use IE sourceIndex if available on both nodes
|
| |
+ if ( diff ) {
|
| |
+ return diff;
|
| |
}
|
| |
|
| |
- // Check if a radio maintains its value
|
| |
- // after being appended to the DOM
|
| |
- input = document.createElement("input");
|
| |
- input.value = "t";
|
| |
- input.setAttribute("type", "radio");
|
| |
- support.radioValue = input.value === "t";
|
| |
+ // Check if b follows a
|
| |
+ if ( cur ) {
|
| |
+ while ( (cur = cur.nextSibling) ) {
|
| |
+ if ( cur === b ) {
|
| |
+ return -1;
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- input.setAttribute("checked", "checked");
|
| |
-
|
| |
- // #11217 - WebKit loses check when the name is after the checked attribute
|
| |
- input.setAttribute( "name", "t" );
|
| |
+ return a ? 1 : -1;
|
| |
+ }
|
| |
|
| |
- div.appendChild( input );
|
| |
- fragment = document.createDocumentFragment();
|
| |
- fragment.appendChild( div.lastChild );
|
| |
-
|
| |
- // WebKit doesn't clone checked state correctly in fragments
|
| |
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
| |
-
|
| |
- // Check if a disconnected checkbox will retain its checked
|
| |
- // value of true after appended to the DOM (IE6/7)
|
| |
- support.appendChecked = input.checked;
|
| |
-
|
| |
- fragment.removeChild( input );
|
| |
- fragment.appendChild( div );
|
| |
-
|
| |
- // Technique from Juriy Zaytsev
|
| |
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
|
| |
- // We only care about the case where non-standard event systems
|
| |
- // are used, namely in IE. Short-circuiting here helps us to
|
| |
- // avoid an eval call (in setAttribute) which can cause CSP
|
| |
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
|
| |
- if ( div.attachEvent ) {
|
| |
- for ( i in {
|
| |
- submit: 1,
|
| |
- change: 1,
|
| |
- focusin: 1
|
| |
- }) {
|
| |
- eventName = "on" + i;
|
| |
- isSupported = ( eventName in div );
|
| |
- if ( !isSupported ) {
|
| |
- div.setAttribute( eventName, "return;" );
|
| |
- isSupported = ( typeof div[ eventName ] === "function" );
|
| |
- }
|
| |
- support[ i + "Bubbles" ] = isSupported;
|
| |
- }
|
| |
- }
|
| |
-
|
| |
- fragment.removeChild( div );
|
| |
-
|
| |
- // Null elements to avoid leaks in IE
|
| |
- fragment = select = opt = div = input = null;
|
| |
-
|
| |
- // Run tests that need a body at doc ready
|
| |
- jQuery(function() {
|
| |
- var container, outer, inner, table, td, offsetSupport,
|
| |
- marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
|
| |
- paddingMarginBorderVisibility, paddingMarginBorder,
|
| |
- body = document.getElementsByTagName("body")[0];
|
| |
-
|
| |
- if ( !body ) {
|
| |
- // Return for frameset docs that don't have a body
|
| |
- return;
|
| |
- }
|
| |
+ /**
|
| |
+ * Returns a function to use in pseudos for input types
|
| |
+ * @param {String} type
|
| |
+ */
|
| |
+ function createInputPseudo( type ) {
|
| |
+ return function( elem ) {
|
| |
+ var name = elem.nodeName.toLowerCase();
|
| |
+ return name === "input" && elem.type === type;
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- conMarginTop = 1;
|
| |
- paddingMarginBorder = "padding:0;margin:0;border:";
|
| |
- positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
|
| |
- paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
|
| |
- style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
|
| |
- html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
|
| |
- "<table " + style + "' cellpadding='0' cellspacing='0'>" +
|
| |
- "<tr><td></td></tr></table>";
|
| |
-
|
| |
- container = document.createElement("div");
|
| |
- container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
|
| |
- body.insertBefore( container, body.firstChild );
|
| |
-
|
| |
- // Construct the test element
|
| |
- div = document.createElement("div");
|
| |
- container.appendChild( div );
|
| |
-
|
| |
- // Check if table cells still have offsetWidth/Height when they are set
|
| |
- // to display:none and there are still other visible table cells in a
|
| |
- // table row; if so, offsetWidth/Height are not reliable for use when
|
| |
- // determining if an element has been hidden directly using
|
| |
- // display:none (it is still safe to use offsets if a parent element is
|
| |
- // hidden; don safety goggles and see bug #4512 for more information).
|
| |
- // (only IE 8 fails this test)
|
| |
- div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
|
| |
- tds = div.getElementsByTagName( "td" );
|
| |
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
|
| |
-
|
| |
- tds[ 0 ].style.display = "";
|
| |
- tds[ 1 ].style.display = "none";
|
| |
-
|
| |
- // Check if empty table cells still have offsetWidth/Height
|
| |
- // (IE <= 8 fail this test)
|
| |
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
| |
-
|
| |
- // Check if div with explicit width and no margin-right incorrectly
|
| |
- // gets computed margin-right based on width of container. For more
|
| |
- // info see bug #3333
|
| |
- // Fails in WebKit before Feb 2011 nightlies
|
| |
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
| |
- if ( window.getComputedStyle ) {
|
| |
- div.innerHTML = "";
|
| |
- marginDiv = document.createElement( "div" );
|
| |
- marginDiv.style.width = "0";
|
| |
- marginDiv.style.marginRight = "0";
|
| |
- div.style.width = "2px";
|
| |
- div.appendChild( marginDiv );
|
| |
- support.reliableMarginRight =
|
| |
- ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
|
| |
- }
|
| |
-
|
| |
- if ( typeof div.style.zoom !== "undefined" ) {
|
| |
- // Check if natively block-level elements act like inline-block
|
| |
- // elements when setting their display to 'inline' and giving
|
| |
- // them layout
|
| |
- // (IE < 8 does this)
|
| |
- div.innerHTML = "";
|
| |
- div.style.width = div.style.padding = "1px";
|
| |
- div.style.border = 0;
|
| |
- div.style.overflow = "hidden";
|
| |
- div.style.display = "inline";
|
| |
- div.style.zoom = 1;
|
| |
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
|
| |
-
|
| |
- // Check if elements with layout shrink-wrap their children
|
| |
- // (IE 6 does this)
|
| |
- div.style.display = "block";
|
| |
- div.style.overflow = "visible";
|
| |
- div.innerHTML = "<div style='width:5px;'></div>";
|
| |
- support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
|
| |
- }
|
| |
-
|
| |
- div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
|
| |
- div.innerHTML = html;
|
| |
-
|
| |
- outer = div.firstChild;
|
| |
- inner = outer.firstChild;
|
| |
- td = outer.nextSibling.firstChild.firstChild;
|
| |
-
|
| |
- offsetSupport = {
|
| |
- doesNotAddBorder: ( inner.offsetTop !== 5 ),
|
| |
- doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
|
| |
- };
|
| |
+ /**
|
| |
+ * Returns a function to use in pseudos for buttons
|
| |
+ * @param {String} type
|
| |
+ */
|
| |
+ function createButtonPseudo( type ) {
|
| |
+ return function( elem ) {
|
| |
+ var name = elem.nodeName.toLowerCase();
|
| |
+ return (name === "input" || name === "button") && elem.type === type;
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- inner.style.position = "fixed";
|
| |
- inner.style.top = "20px";
|
| |
+ /**
|
| |
+ * Returns a function to use in pseudos for :enabled/:disabled
|
| |
+ * @param {Boolean} disabled true for :disabled; false for :enabled
|
| |
+ */
|
| |
+ function createDisabledPseudo( disabled ) {
|
| |
+
|
| |
+ // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
|
| |
+ return function( elem ) {
|
| |
+
|
| |
+ // Only certain elements can match :enabled or :disabled
|
| |
+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
|
| |
+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
|
| |
+ if ( "form" in elem ) {
|
| |
+
|
| |
+ // Check for inherited disabledness on relevant non-disabled elements:
|
| |
+ // * listed form-associated elements in a disabled fieldset
|
| |
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed
|
| |
+ // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
|
| |
+ // * option elements in a disabled optgroup
|
| |
+ // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
|
| |
+ // All such elements have a "form" property.
|
| |
+ if ( elem.parentNode && elem.disabled === false ) {
|
| |
+
|
| |
+ // Option elements defer to a parent optgroup if present
|
| |
+ if ( "label" in elem ) {
|
| |
+ if ( "label" in elem.parentNode ) {
|
| |
+ return elem.parentNode.disabled === disabled;
|
| |
+ } else {
|
| |
+ return elem.disabled === disabled;
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- // safari subtracts parent border width here which is 5px
|
| |
- offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
|
| |
- inner.style.position = inner.style.top = "";
|
| |
+ // Support: IE 6 - 11
|
| |
+ // Use the isDisabled shortcut property to check for disabled fieldset ancestors
|
| |
+ return elem.isDisabled === disabled ||
|
| |
|
| |
- outer.style.overflow = "hidden";
|
| |
- outer.style.position = "relative";
|
| |
+ // Where there is no isDisabled, check manually
|
| |
+ /* jshint -W018 */
|
| |
+ elem.isDisabled !== !disabled &&
|
| |
+ disabledAncestor( elem ) === disabled;
|
| |
+ }
|
| |
|
| |
- offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
|
| |
- offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
|
| |
+ return elem.disabled === disabled;
|
| |
|
| |
- if ( window.getComputedStyle ) {
|
| |
- div.style.marginTop = "1%";
|
| |
- support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
|
| |
+ // Try to winnow out elements that can't be disabled before trusting the disabled property.
|
| |
+ // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
|
| |
+ // even exist on them, let alone have a boolean value.
|
| |
+ } else if ( "label" in elem ) {
|
| |
+ return elem.disabled === disabled;
|
| |
}
|
| |
|
| |
- if ( typeof container.style.zoom !== "undefined" ) {
|
| |
- container.style.zoom = 1;
|
| |
- }
|
| |
+ // Remaining elements are neither :enabled nor :disabled
|
| |
+ return false;
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- body.removeChild( container );
|
| |
- marginDiv = div = container = null;
|
| |
+ /**
|
| |
+ * Returns a function to use in pseudos for positionals
|
| |
+ * @param {Function} fn
|
| |
+ */
|
| |
+ function createPositionalPseudo( fn ) {
|
| |
+ return markFunction(function( argument ) {
|
| |
+ argument = +argument;
|
| |
+ return markFunction(function( seed, matches ) {
|
| |
+ var j,
|
| |
+ matchIndexes = fn( [], seed.length, argument ),
|
| |
+ i = matchIndexes.length;
|
| |
|
| |
- jQuery.extend( support, offsetSupport );
|
| |
+ // Match elements found at the specified indexes
|
| |
+ while ( i-- ) {
|
| |
+ if ( seed[ (j = matchIndexes[i]) ] ) {
|
| |
+ seed[j] = !(matches[j] = seed[j]);
|
| |
+ }
|
| |
+ }
|
| |
+ });
|
| |
});
|
| |
+ }
|
| |
|
| |
- return support;
|
| |
- })();
|
| |
-
|
| |
-
|
| |
+ /**
|
| |
+ * Checks a node for validity as a Sizzle context
|
| |
+ * @param {Element|Object=} context
|
| |
+ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
|
| |
+ */
|
| |
+ function testContext( context ) {
|
| |
+ return context && typeof context.getElementsByTagName !== "undefined" && context;
|
| |
+ }
|
| |
|
| |
+ // Expose support vars for convenience
|
| |
+ support = Sizzle.support = {};
|
| |
|
| |
- var rbrace = /^(?:\{.*\}|\[.*\])$/,
|
| |
- rmultiDash = /([A-Z])/g;
|
| |
+ /**
|
| |
+ * Detects XML nodes
|
| |
+ * @param {Element|Object} elem An element or a document
|
| |
+ * @returns {Boolean} True iff elem is a non-HTML XML node
|
| |
+ */
|
| |
+ isXML = Sizzle.isXML = function( elem ) {
|
| |
+ // documentElement is verified for cases where it doesn't yet exist
|
| |
+ // (such as loading iframes in IE - #4833)
|
| |
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
|
| |
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
|
| |
+ };
|
| |
|
| |
- jQuery.extend({
|
| |
- cache: {},
|
| |
+ /**
|
| |
+ * Sets document-related variables once based on the current document
|
| |
+ * @param {Element|Object} [doc] An element or document object to use to set the document
|
| |
+ * @returns {Object} Returns the current document
|
| |
+ */
|
| |
+ setDocument = Sizzle.setDocument = function( node ) {
|
| |
+ var hasCompare, subWindow,
|
| |
+ doc = node ? node.ownerDocument || node : preferredDoc;
|
| |
|
| |
- // Please use with caution
|
| |
- uuid: 0,
|
| |
+ // Return early if doc is invalid or already selected
|
| |
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
|
| |
+ return document;
|
| |
+ }
|
| |
|
| |
- // Unique for each copy of jQuery on the page
|
| |
- // Non-digits removed to match rinlinejQuery
|
| |
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
|
| |
+ // Update global variables
|
| |
+ document = doc;
|
| |
+ docElem = document.documentElement;
|
| |
+ documentIsHTML = !isXML( document );
|
| |
|
| |
- // The following elements throw uncatchable exceptions if you
|
| |
- // attempt to add expando properties to them.
|
| |
- noData: {
|
| |
- "embed": true,
|
| |
- // Ban all objects except for Flash (which handle expandos)
|
| |
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
| |
- "applet": true
|
| |
- },
|
| |
+ // Support: IE 9-11, Edge
|
| |
+ // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
|
| |
+ if ( preferredDoc !== document &&
|
| |
+ (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
|
| |
|
| |
- hasData: function( elem ) {
|
| |
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
|
| |
- return !!elem && !isEmptyDataObject( elem );
|
| |
- },
|
| |
+ // Support: IE 11, Edge
|
| |
+ if ( subWindow.addEventListener ) {
|
| |
+ subWindow.addEventListener( "unload", unloadHandler, false );
|
| |
|
| |
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
|
| |
- if ( !jQuery.acceptData( elem ) ) {
|
| |
- return;
|
| |
+ // Support: IE 9 - 10 only
|
| |
+ } else if ( subWindow.attachEvent ) {
|
| |
+ subWindow.attachEvent( "onunload", unloadHandler );
|
| |
}
|
| |
+ }
|
| |
|
| |
- var privateCache, thisCache, ret,
|
| |
- internalKey = jQuery.expando,
|
| |
- getByName = typeof name === "string",
|
| |
+ /* Attributes
|
| |
+ ---------------------------------------------------------------------- */
|
| |
|
| |
- // We have to handle DOM nodes and JS objects differently because IE6-7
|
| |
- // can't GC object references properly across the DOM-JS boundary
|
| |
- isNode = elem.nodeType,
|
| |
+ // Support: IE<8
|
| |
+ // Verify that getAttribute really returns attributes and not properties
|
| |
+ // (excepting IE8 booleans)
|
| |
+ support.attributes = assert(function( el ) {
|
| |
+ el.className = "i";
|
| |
+ return !el.getAttribute("className");
|
| |
+ });
|
| |
|
| |
- // Only DOM nodes need the global jQuery cache; JS object data is
|
| |
- // attached directly to the object so GC can occur automatically
|
| |
- cache = isNode ? jQuery.cache : elem,
|
| |
+ /* getElement(s)By*
|
| |
+ ---------------------------------------------------------------------- */
|
| |
|
| |
- // Only defining an ID for JS objects if its cache already exists allows
|
| |
- // the code to shortcut on the same path as a DOM node with no cache
|
| |
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
|
| |
- isEvents = name === "events";
|
| |
+ // Check if getElementsByTagName("*") returns only elements
|
| |
+ support.getElementsByTagName = assert(function( el ) {
|
| |
+ el.appendChild( document.createComment("") );
|
| |
+ return !el.getElementsByTagName("*").length;
|
| |
+ });
|
| |
|
| |
- // Avoid doing any more work than we need to when trying to get data on an
|
| |
- // object that has no data at all
|
| |
- if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Support: IE<9
|
| |
+ support.getElementsByClassName = rnative.test( document.getElementsByClassName );
|
| |
|
| |
- if ( !id ) {
|
| |
- // Only DOM nodes need a new unique ID for each element since their data
|
| |
- // ends up in the global cache
|
| |
- if ( isNode ) {
|
| |
- elem[ internalKey ] = id = ++jQuery.uuid;
|
| |
- } else {
|
| |
- id = internalKey;
|
| |
+ // Support: IE<10
|
| |
+ // Check if getElementById returns elements by name
|
| |
+ // The broken getElementById methods don't pick up programmatically-set names,
|
| |
+ // so use a roundabout getElementsByName test
|
| |
+ support.getById = assert(function( el ) {
|
| |
+ docElem.appendChild( el ).id = expando;
|
| |
+ return !document.getElementsByName || !document.getElementsByName( expando ).length;
|
| |
+ });
|
| |
+
|
| |
+ // ID filter and find
|
| |
+ if ( support.getById ) {
|
| |
+ Expr.filter["ID"] = function( id ) {
|
| |
+ var attrId = id.replace( runescape, funescape );
|
| |
+ return function( elem ) {
|
| |
+ return elem.getAttribute("id") === attrId;
|
| |
+ };
|
| |
+ };
|
| |
+ Expr.find["ID"] = function( id, context ) {
|
| |
+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
|
| |
+ var elem = context.getElementById( id );
|
| |
+ return elem ? [ elem ] : [];
|
| |
}
|
| |
- }
|
| |
+ };
|
| |
+ } else {
|
| |
+ Expr.filter["ID"] = function( id ) {
|
| |
+ var attrId = id.replace( runescape, funescape );
|
| |
+ return function( elem ) {
|
| |
+ var node = typeof elem.getAttributeNode !== "undefined" &&
|
| |
+ elem.getAttributeNode("id");
|
| |
+ return node && node.value === attrId;
|
| |
+ };
|
| |
+ };
|
| |
+
|
| |
+ // Support: IE 6 - 7 only
|
| |
+ // getElementById is not reliable as a find shortcut
|
| |
+ Expr.find["ID"] = function( id, context ) {
|
| |
+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
|
| |
+ var node, i, elems,
|
| |
+ elem = context.getElementById( id );
|
| |
+
|
| |
+ if ( elem ) {
|
| |
|
| |
- if ( !cache[ id ] ) {
|
| |
- cache[ id ] = {};
|
| |
+ // Verify the id attribute
|
| |
+ node = elem.getAttributeNode("id");
|
| |
+ if ( node && node.value === id ) {
|
| |
+ return [ elem ];
|
| |
+ }
|
| |
+
|
| |
+ // Fall back on getElementsByName
|
| |
+ elems = context.getElementsByName( id );
|
| |
+ i = 0;
|
| |
+ while ( (elem = elems[i++]) ) {
|
| |
+ node = elem.getAttributeNode("id");
|
| |
+ if ( node && node.value === id ) {
|
| |
+ return [ elem ];
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- // Avoids exposing jQuery metadata on plain JS objects when the object
|
| |
- // is serialized using JSON.stringify
|
| |
- if ( !isNode ) {
|
| |
- cache[ id ].toJSON = jQuery.noop;
|
| |
+ return [];
|
| |
}
|
| |
- }
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
|
| |
- // shallow copied over onto the existing cache
|
| |
- if ( typeof name === "object" || typeof name === "function" ) {
|
| |
- if ( pvt ) {
|
| |
- cache[ id ] = jQuery.extend( cache[ id ], name );
|
| |
- } else {
|
| |
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
|
| |
+ // Tag
|
| |
+ Expr.find["TAG"] = support.getElementsByTagName ?
|
| |
+ function( tag, context ) {
|
| |
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
|
| |
+ return context.getElementsByTagName( tag );
|
| |
+
|
| |
+ // DocumentFragment nodes don't have gEBTN
|
| |
+ } else if ( support.qsa ) {
|
| |
+ return context.querySelectorAll( tag );
|
| |
}
|
| |
- }
|
| |
+ } :
|
| |
+
|
| |
+ function( tag, context ) {
|
| |
+ var elem,
|
| |
+ tmp = [],
|
| |
+ i = 0,
|
| |
+ // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
|
| |
+ results = context.getElementsByTagName( tag );
|
| |
|
| |
- privateCache = thisCache = cache[ id ];
|
| |
+ // Filter out possible comments
|
| |
+ if ( tag === "*" ) {
|
| |
+ while ( (elem = results[i++]) ) {
|
| |
+ if ( elem.nodeType === 1 ) {
|
| |
+ tmp.push( elem );
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- // jQuery data() is stored in a separate object inside the object's internal data
|
| |
- // cache in order to avoid key collisions between internal data and user-defined
|
| |
- // data.
|
| |
- if ( !pvt ) {
|
| |
- if ( !thisCache.data ) {
|
| |
- thisCache.data = {};
|
| |
+ return tmp;
|
| |
}
|
| |
+ return results;
|
| |
+ };
|
| |
|
| |
- thisCache = thisCache.data;
|
| |
+ // Class
|
| |
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
|
| |
+ if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
|
| |
+ return context.getElementsByClassName( className );
|
| |
}
|
| |
+ };
|
| |
|
| |
- if ( data !== undefined ) {
|
| |
- thisCache[ jQuery.camelCase( name ) ] = data;
|
| |
- }
|
| |
+ /* QSA/matchesSelector
|
| |
+ ---------------------------------------------------------------------- */
|
| |
|
| |
- // Users should not attempt to inspect the internal events object using jQuery.data,
|
| |
- // it is undocumented and subject to change. But does anyone listen? No.
|
| |
- if ( isEvents && !thisCache[ name ] ) {
|
| |
- return privateCache.events;
|
| |
- }
|
| |
+ // QSA and matchesSelector support
|
| |
|
| |
- // Check for both converted-to-camel and non-converted data property names
|
| |
- // If a data property was specified
|
| |
- if ( getByName ) {
|
| |
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
| |
+ rbuggyMatches = [];
|
| |
|
| |
- // First Try to find as-is property data
|
| |
- ret = thisCache[ name ];
|
| |
+ // qSa(:focus) reports false when true (Chrome 21)
|
| |
+ // We allow this because of a bug in IE8/9 that throws an error
|
| |
+ // whenever `document.activeElement` is accessed on an iframe
|
| |
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error
|
| |
+ // See https://bugs.jquery.com/ticket/13378
|
| |
+ rbuggyQSA = [];
|
| |
|
| |
- // Test for null|undefined property data
|
| |
- if ( ret == null ) {
|
| |
+ if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
|
| |
+ // Build QSA regex
|
| |
+ // Regex strategy adopted from Diego Perini
|
| |
+ assert(function( el ) {
|
| |
+ // Select is set to empty string on purpose
|
| |
+ // This is to test IE's treatment of not explicitly
|
| |
+ // setting a boolean content attribute,
|
| |
+ // since its presence should be enough
|
| |
+ // https://bugs.jquery.com/ticket/12359
|
| |
+ docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
|
| |
+ "<select id='" + expando + "-\r\\' msallowcapture=''>" +
|
| |
+ "<option selected=''></option></select>";
|
| |
|
| |
- // Try to find the camelCased property
|
| |
- ret = thisCache[ jQuery.camelCase( name ) ];
|
| |
+ // Support: IE8, Opera 11-12.16
|
| |
+ // Nothing should be selected when empty strings follow ^= or $= or *=
|
| |
+ // The test attribute must be unknown in Opera but "safe" for WinRT
|
| |
+ // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
|
| |
+ if ( el.querySelectorAll("[msallowcapture^='']").length ) {
|
| |
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
|
| |
}
|
| |
- } else {
|
| |
- ret = thisCache;
|
| |
- }
|
| |
|
| |
- return ret;
|
| |
- },
|
| |
+ // Support: IE8
|
| |
+ // Boolean attributes and "value" are not treated correctly
|
| |
+ if ( !el.querySelectorAll("[selected]").length ) {
|
| |
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
|
| |
+ }
|
| |
|
| |
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
|
| |
- if ( !jQuery.acceptData( elem ) ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
|
| |
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
|
| |
+ rbuggyQSA.push("~=");
|
| |
+ }
|
| |
|
| |
- var thisCache, i, l,
|
| |
+ // Webkit/Opera - :checked should return selected option elements
|
| |
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
| |
+ // IE8 throws error here and will not see later tests
|
| |
+ if ( !el.querySelectorAll(":checked").length ) {
|
| |
+ rbuggyQSA.push(":checked");
|
| |
+ }
|
| |
|
| |
- // Reference to internal data cache key
|
| |
- internalKey = jQuery.expando,
|
| |
+ // Support: Safari 8+, iOS 8+
|
| |
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
|
| |
+ // In-page `selector#id sibling-combinator selector` fails
|
| |
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
|
| |
+ rbuggyQSA.push(".#.+[+~]");
|
| |
+ }
|
| |
+ });
|
| |
|
| |
- isNode = elem.nodeType,
|
| |
+ assert(function( el ) {
|
| |
+ el.innerHTML = "<a href='' disabled='disabled'></a>" +
|
| |
+ "<select disabled='disabled'><option/></select>";
|
| |
|
| |
- // See jQuery.data for more information
|
| |
- cache = isNode ? jQuery.cache : elem,
|
| |
+ // Support: Windows 8 Native Apps
|
| |
+ // The type and name attributes are restricted during .innerHTML assignment
|
| |
+ var input = document.createElement("input");
|
| |
+ input.setAttribute( "type", "hidden" );
|
| |
+ el.appendChild( input ).setAttribute( "name", "D" );
|
| |
|
| |
- // See jQuery.data for more information
|
| |
- id = isNode ? elem[ internalKey ] : internalKey;
|
| |
+ // Support: IE8
|
| |
+ // Enforce case-sensitivity of name attribute
|
| |
+ if ( el.querySelectorAll("[name=d]").length ) {
|
| |
+ rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
|
| |
+ }
|
| |
|
| |
- // If there is already no cache entry for this object, there is no
|
| |
- // purpose in continuing
|
| |
- if ( !cache[ id ] ) {
|
| |
- return;
|
| |
- }
|
| |
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
|
| |
+ // IE8 throws error here and will not see later tests
|
| |
+ if ( el.querySelectorAll(":enabled").length !== 2 ) {
|
| |
+ rbuggyQSA.push( ":enabled", ":disabled" );
|
| |
+ }
|
| |
|
| |
- if ( name ) {
|
| |
+ // Support: IE9-11+
|
| |
+ // IE's :disabled selector does not pick up the children of disabled fieldsets
|
| |
+ docElem.appendChild( el ).disabled = true;
|
| |
+ if ( el.querySelectorAll(":disabled").length !== 2 ) {
|
| |
+ rbuggyQSA.push( ":enabled", ":disabled" );
|
| |
+ }
|
| |
|
| |
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
|
| |
+ // Opera 10-11 does not throw on post-comma invalid pseudos
|
| |
+ el.querySelectorAll("*,:x");
|
| |
+ rbuggyQSA.push(",.*:");
|
| |
+ });
|
| |
+ }
|
| |
|
| |
- if ( thisCache ) {
|
| |
+ if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
|
| |
+ docElem.webkitMatchesSelector ||
|
| |
+ docElem.mozMatchesSelector ||
|
| |
+ docElem.oMatchesSelector ||
|
| |
+ docElem.msMatchesSelector) )) ) {
|
| |
|
| |
- // Support array or space separated string names for data keys
|
| |
- if ( !jQuery.isArray( name ) ) {
|
| |
+ assert(function( el ) {
|
| |
+ // Check to see if it's possible to do matchesSelector
|
| |
+ // on a disconnected node (IE 9)
|
| |
+ support.disconnectedMatch = matches.call( el, "*" );
|
| |
|
| |
- // try the string as a key before any manipulation
|
| |
- if ( name in thisCache ) {
|
| |
- name = [ name ];
|
| |
- } else {
|
| |
+ // This should fail with an exception
|
| |
+ // Gecko does not error, returns false instead
|
| |
+ matches.call( el, "[s!='']:x" );
|
| |
+ rbuggyMatches.push( "!=", pseudos );
|
| |
+ });
|
| |
+ }
|
| |
|
| |
- // split the camel cased version by spaces unless a key with the spaces exists
|
| |
- name = jQuery.camelCase( name );
|
| |
- if ( name in thisCache ) {
|
| |
- name = [ name ];
|
| |
- } else {
|
| |
- name = name.split( " " );
|
| |
- }
|
| |
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
|
| |
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
|
| |
+
|
| |
+ /* Contains
|
| |
+ ---------------------------------------------------------------------- */
|
| |
+ hasCompare = rnative.test( docElem.compareDocumentPosition );
|
| |
+
|
| |
+ // Element contains another
|
| |
+ // Purposefully self-exclusive
|
| |
+ // As in, an element does not contain itself
|
| |
+ contains = hasCompare || rnative.test( docElem.contains ) ?
|
| |
+ function( a, b ) {
|
| |
+ var adown = a.nodeType === 9 ? a.documentElement : a,
|
| |
+ bup = b && b.parentNode;
|
| |
+ return a === bup || !!( bup && bup.nodeType === 1 && (
|
| |
+ adown.contains ?
|
| |
+ adown.contains( bup ) :
|
| |
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
|
| |
+ ));
|
| |
+ } :
|
| |
+ function( a, b ) {
|
| |
+ if ( b ) {
|
| |
+ while ( (b = b.parentNode) ) {
|
| |
+ if ( b === a ) {
|
| |
+ return true;
|
| |
}
|
| |
}
|
| |
-
|
| |
- for ( i = 0, l = name.length; i < l; i++ ) {
|
| |
- delete thisCache[ name[i] ];
|
| |
- }
|
| |
-
|
| |
- // If there is no data left in the cache, we want to continue
|
| |
- // and let the cache object itself get destroyed
|
| |
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
|
| |
- return;
|
| |
- }
|
| |
}
|
| |
- }
|
| |
+ return false;
|
| |
+ };
|
| |
|
| |
- // See jQuery.data for more information
|
| |
- if ( !pvt ) {
|
| |
- delete cache[ id ].data;
|
| |
+ /* Sorting
|
| |
+ ---------------------------------------------------------------------- */
|
| |
|
| |
- // Don't destroy the parent cache unless the internal data object
|
| |
- // had been the only thing left in it
|
| |
- if ( !isEmptyDataObject(cache[ id ]) ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Document order sorting
|
| |
+ sortOrder = hasCompare ?
|
| |
+ function( a, b ) {
|
| |
+
|
| |
+ // Flag for duplicate removal
|
| |
+ if ( a === b ) {
|
| |
+ hasDuplicate = true;
|
| |
+ return 0;
|
| |
}
|
| |
|
| |
- // Browsers that fail expando deletion also refuse to delete expandos on
|
| |
- // the window, but it will allow it on all other JS objects; other browsers
|
| |
- // don't care
|
| |
- // Ensure that `cache` is not a window object #10080
|
| |
- if ( jQuery.support.deleteExpando || !cache.setInterval ) {
|
| |
- delete cache[ id ];
|
| |
- } else {
|
| |
- cache[ id ] = null;
|
| |
- }
|
| |
-
|
| |
- // We destroyed the cache and need to eliminate the expando on the node to avoid
|
| |
- // false lookups in the cache for entries that no longer exist
|
| |
- if ( isNode ) {
|
| |
- // IE does not allow us to delete expando properties from nodes,
|
| |
- // nor does it have a removeAttribute function on Document nodes;
|
| |
- // we must handle all of these cases
|
| |
- if ( jQuery.support.deleteExpando ) {
|
| |
- delete elem[ internalKey ];
|
| |
- } else if ( elem.removeAttribute ) {
|
| |
- elem.removeAttribute( internalKey );
|
| |
- } else {
|
| |
- elem[ internalKey ] = null;
|
| |
- }
|
| |
+ // Sort on method existence if only one input has compareDocumentPosition
|
| |
+ var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
|
| |
+ if ( compare ) {
|
| |
+ return compare;
|
| |
}
|
| |
- },
|
| |
|
| |
- // For internal use only.
|
| |
- _data: function( elem, name, data ) {
|
| |
- return jQuery.data( elem, name, data, true );
|
| |
- },
|
| |
+ // Calculate position if both inputs belong to the same document
|
| |
+ compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
|
| |
+ a.compareDocumentPosition( b ) :
|
| |
|
| |
- // A method for determining if a DOM node can handle the data expando
|
| |
- acceptData: function( elem ) {
|
| |
- if ( elem.nodeName ) {
|
| |
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
|
| |
+ // Otherwise we know they are disconnected
|
| |
+ 1;
|
| |
|
| |
- if ( match ) {
|
| |
- return !(match === true || elem.getAttribute("classid") !== match);
|
| |
+ // Disconnected nodes
|
| |
+ if ( compare & 1 ||
|
| |
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
|
| |
+
|
| |
+ // Choose the first element that is related to our preferred document
|
| |
+ if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
|
| |
+ return -1;
|
| |
}
|
| |
+ if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
|
| |
+ return 1;
|
| |
+ }
|
| |
+
|
| |
+ // Maintain original order
|
| |
+ return sortInput ?
|
| |
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
|
| |
+ 0;
|
| |
}
|
| |
|
| |
- return true;
|
| |
- }
|
| |
- });
|
| |
+ return compare & 4 ? -1 : 1;
|
| |
+ } :
|
| |
+ function( a, b ) {
|
| |
+ // Exit early if the nodes are identical
|
| |
+ if ( a === b ) {
|
| |
+ hasDuplicate = true;
|
| |
+ return 0;
|
| |
+ }
|
| |
|
| |
- jQuery.fn.extend({
|
| |
- data: function( key, value ) {
|
| |
- var parts, part, attr, name, l,
|
| |
- elem = this[0],
|
| |
+ var cur,
|
| |
i = 0,
|
| |
- data = null;
|
| |
+ aup = a.parentNode,
|
| |
+ bup = b.parentNode,
|
| |
+ ap = [ a ],
|
| |
+ bp = [ b ];
|
| |
+
|
| |
+ // Parentless nodes are either documents or disconnected
|
| |
+ if ( !aup || !bup ) {
|
| |
+ return a === document ? -1 :
|
| |
+ b === document ? 1 :
|
| |
+ aup ? -1 :
|
| |
+ bup ? 1 :
|
| |
+ sortInput ?
|
| |
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
|
| |
+ 0;
|
| |
|
| |
- // Gets all values
|
| |
- if ( key === undefined ) {
|
| |
- if ( this.length ) {
|
| |
- data = jQuery.data( elem );
|
| |
+ // If the nodes are siblings, we can do a quick check
|
| |
+ } else if ( aup === bup ) {
|
| |
+ return siblingCheck( a, b );
|
| |
+ }
|
| |
|
| |
- if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
|
| |
- attr = elem.attributes;
|
| |
- for ( l = attr.length; i < l; i++ ) {
|
| |
- name = attr[i].name;
|
| |
+ // Otherwise we need full lists of their ancestors for comparison
|
| |
+ cur = a;
|
| |
+ while ( (cur = cur.parentNode) ) {
|
| |
+ ap.unshift( cur );
|
| |
+ }
|
| |
+ cur = b;
|
| |
+ while ( (cur = cur.parentNode) ) {
|
| |
+ bp.unshift( cur );
|
| |
+ }
|
| |
|
| |
- if ( name.indexOf( "data-" ) === 0 ) {
|
| |
- name = jQuery.camelCase( name.substring(5) );
|
| |
+ // Walk down the tree looking for a discrepancy
|
| |
+ while ( ap[i] === bp[i] ) {
|
| |
+ i++;
|
| |
+ }
|
| |
|
| |
- dataAttr( elem, name, data[ name ] );
|
| |
- }
|
| |
- }
|
| |
- jQuery._data( elem, "parsedAttrs", true );
|
| |
- }
|
| |
- }
|
| |
+ return i ?
|
| |
+ // Do a sibling check if the nodes have a common ancestor
|
| |
+ siblingCheck( ap[i], bp[i] ) :
|
| |
|
| |
- return data;
|
| |
- }
|
| |
+ // Otherwise nodes in our document sort first
|
| |
+ ap[i] === preferredDoc ? -1 :
|
| |
+ bp[i] === preferredDoc ? 1 :
|
| |
+ 0;
|
| |
+ };
|
| |
|
| |
- // Sets multiple values
|
| |
- if ( typeof key === "object" ) {
|
| |
- return this.each(function() {
|
| |
- jQuery.data( this, key );
|
| |
- });
|
| |
- }
|
| |
+ return document;
|
| |
+ };
|
| |
+
|
| |
+ Sizzle.matches = function( expr, elements ) {
|
| |
+ return Sizzle( expr, null, null, elements );
|
| |
+ };
|
| |
|
| |
- parts = key.split( ".", 2 );
|
| |
- parts[1] = parts[1] ? "." + parts[1] : "";
|
| |
- part = parts[1] + "!";
|
| |
+ Sizzle.matchesSelector = function( elem, expr ) {
|
| |
+ // Set document vars if needed
|
| |
+ if ( ( elem.ownerDocument || elem ) !== document ) {
|
| |
+ setDocument( elem );
|
| |
+ }
|
| |
|
| |
- return jQuery.access( this, function( value ) {
|
| |
+ // Make sure that attribute selectors are quoted
|
| |
+ expr = expr.replace( rattributeQuotes, "='$1']" );
|
| |
|
| |
- if ( value === undefined ) {
|
| |
- data = this.triggerHandler( "getData" + part, [ parts[0] ] );
|
| |
+ if ( support.matchesSelector && documentIsHTML &&
|
| |
+ !compilerCache[ expr + " " ] &&
|
| |
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
|
| |
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
|
| |
|
| |
- // Try to fetch any internally stored data first
|
| |
- if ( data === undefined && elem ) {
|
| |
- data = jQuery.data( elem, key );
|
| |
- data = dataAttr( elem, key, data );
|
| |
- }
|
| |
+ try {
|
| |
+ var ret = matches.call( elem, expr );
|
| |
|
| |
- return data === undefined && parts[1] ?
|
| |
- this.data( parts[0] ) :
|
| |
- data;
|
| |
+ // IE 9's matchesSelector returns false on disconnected nodes
|
| |
+ if ( ret || support.disconnectedMatch ||
|
| |
+ // As well, disconnected nodes are said to be in a document
|
| |
+ // fragment in IE 9
|
| |
+ elem.document && elem.document.nodeType !== 11 ) {
|
| |
+ return ret;
|
| |
}
|
| |
+ } catch (e) {}
|
| |
+ }
|
| |
|
| |
- parts[1] = value;
|
| |
- this.each(function() {
|
| |
- var self = jQuery( this );
|
| |
+ return Sizzle( expr, document, null, [ elem ] ).length > 0;
|
| |
+ };
|
| |
|
| |
- self.triggerHandler( "setData" + part, parts );
|
| |
- jQuery.data( this, key, value );
|
| |
- self.triggerHandler( "changeData" + part, parts );
|
| |
- });
|
| |
- }, null, value, arguments.length > 1, null, false );
|
| |
- },
|
| |
+ Sizzle.contains = function( context, elem ) {
|
| |
+ // Set document vars if needed
|
| |
+ if ( ( context.ownerDocument || context ) !== document ) {
|
| |
+ setDocument( context );
|
| |
+ }
|
| |
+ return contains( context, elem );
|
| |
+ };
|
| |
|
| |
- removeData: function( key ) {
|
| |
- return this.each(function() {
|
| |
- jQuery.removeData( this, key );
|
| |
- });
|
| |
+ Sizzle.attr = function( elem, name ) {
|
| |
+ // Set document vars if needed
|
| |
+ if ( ( elem.ownerDocument || elem ) !== document ) {
|
| |
+ setDocument( elem );
|
| |
}
|
| |
- });
|
| |
|
| |
- function dataAttr( elem, key, data ) {
|
| |
- // If nothing was found internally, try to fetch any
|
| |
- // data from the HTML5 data-* attribute
|
| |
- if ( data === undefined && elem.nodeType === 1 ) {
|
| |
+ var fn = Expr.attrHandle[ name.toLowerCase() ],
|
| |
+ // Don't get fooled by Object.prototype properties (jQuery #13807)
|
| |
+ val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
|
| |
+ fn( elem, name, !documentIsHTML ) :
|
| |
+ undefined;
|
| |
|
| |
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
| |
+ return val !== undefined ?
|
| |
+ val :
|
| |
+ support.attributes || !documentIsHTML ?
|
| |
+ elem.getAttribute( name ) :
|
| |
+ (val = elem.getAttributeNode(name)) && val.specified ?
|
| |
+ val.value :
|
| |
+ null;
|
| |
+ };
|
| |
|
| |
- data = elem.getAttribute( name );
|
| |
+ Sizzle.escape = function( sel ) {
|
| |
+ return (sel + "").replace( rcssescape, fcssescape );
|
| |
+ };
|
| |
|
| |
- if ( typeof data === "string" ) {
|
| |
- try {
|
| |
- data = data === "true" ? true :
|
| |
- data === "false" ? false :
|
| |
- data === "null" ? null :
|
| |
- jQuery.isNumeric( data ) ? +data :
|
| |
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
| |
- data;
|
| |
- } catch( e ) {}
|
| |
+ Sizzle.error = function( msg ) {
|
| |
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
|
| |
+ };
|
| |
|
| |
- // Make sure we set the data so it isn't changed later
|
| |
- jQuery.data( elem, key, data );
|
| |
+ /**
|
| |
+ * Document sorting and removing duplicates
|
| |
+ * @param {ArrayLike} results
|
| |
+ */
|
| |
+ Sizzle.uniqueSort = function( results ) {
|
| |
+ var elem,
|
| |
+ duplicates = [],
|
| |
+ j = 0,
|
| |
+ i = 0;
|
| |
|
| |
- } else {
|
| |
- data = undefined;
|
| |
+ // Unless we *know* we can detect duplicates, assume their presence
|
| |
+ hasDuplicate = !support.detectDuplicates;
|
| |
+ sortInput = !support.sortStable && results.slice( 0 );
|
| |
+ results.sort( sortOrder );
|
| |
+
|
| |
+ if ( hasDuplicate ) {
|
| |
+ while ( (elem = results[i++]) ) {
|
| |
+ if ( elem === results[ i ] ) {
|
| |
+ j = duplicates.push( i );
|
| |
+ }
|
| |
+ }
|
| |
+ while ( j-- ) {
|
| |
+ results.splice( duplicates[ j ], 1 );
|
| |
}
|
| |
}
|
| |
|
| |
- return data;
|
| |
- }
|
| |
+ // Clear input after sorting to release objects
|
| |
+ // See https://github.com/jquery/sizzle/pull/225
|
| |
+ sortInput = null;
|
| |
|
| |
- // checks a cache object for emptiness
|
| |
- function isEmptyDataObject( obj ) {
|
| |
- for ( var name in obj ) {
|
| |
+ return results;
|
| |
+ };
|
| |
|
| |
- // if the public data object is empty, the private is still empty
|
| |
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
|
| |
- continue;
|
| |
+ /**
|
| |
+ * Utility function for retrieving the text value of an array of DOM nodes
|
| |
+ * @param {Array|Element} elem
|
| |
+ */
|
| |
+ getText = Sizzle.getText = function( elem ) {
|
| |
+ var node,
|
| |
+ ret = "",
|
| |
+ i = 0,
|
| |
+ nodeType = elem.nodeType;
|
| |
+
|
| |
+ if ( !nodeType ) {
|
| |
+ // If no nodeType, this is expected to be an array
|
| |
+ while ( (node = elem[i++]) ) {
|
| |
+ // Do not traverse comment nodes
|
| |
+ ret += getText( node );
|
| |
}
|
| |
- if ( name !== "toJSON" ) {
|
| |
- return false;
|
| |
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
|
| |
+ // Use textContent for elements
|
| |
+ // innerText usage removed for consistency of new lines (jQuery #11153)
|
| |
+ if ( typeof elem.textContent === "string" ) {
|
| |
+ return elem.textContent;
|
| |
+ } else {
|
| |
+ // Traverse its children
|
| |
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
|
| |
+ ret += getText( elem );
|
| |
+ }
|
| |
}
|
| |
+ } else if ( nodeType === 3 || nodeType === 4 ) {
|
| |
+ return elem.nodeValue;
|
| |
}
|
| |
+ // Do not include comment or processing instruction nodes
|
| |
|
| |
- return true;
|
| |
- }
|
| |
+ return ret;
|
| |
+ };
|
| |
|
| |
+ Expr = Sizzle.selectors = {
|
| |
|
| |
+ // Can be adjusted by the user
|
| |
+ cacheLength: 50,
|
| |
|
| |
+ createPseudo: markFunction,
|
| |
|
| |
- function handleQueueMarkDefer( elem, type, src ) {
|
| |
- var deferDataKey = type + "defer",
|
| |
- queueDataKey = type + "queue",
|
| |
- markDataKey = type + "mark",
|
| |
- defer = jQuery._data( elem, deferDataKey );
|
| |
- if ( defer &&
|
| |
- ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
|
| |
- ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
|
| |
- // Give room for hard-coded callbacks to fire first
|
| |
- // and eventually mark/queue something else on the element
|
| |
- setTimeout( function() {
|
| |
- if ( !jQuery._data( elem, queueDataKey ) &&
|
| |
- !jQuery._data( elem, markDataKey ) ) {
|
| |
- jQuery.removeData( elem, deferDataKey, true );
|
| |
- defer.fire();
|
| |
- }
|
| |
- }, 0 );
|
| |
- }
|
| |
- }
|
| |
+ match: matchExpr,
|
| |
|
| |
- jQuery.extend({
|
| |
+ attrHandle: {},
|
| |
|
| |
- _mark: function( elem, type ) {
|
| |
- if ( elem ) {
|
| |
- type = ( type || "fx" ) + "mark";
|
| |
- jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
|
| |
- }
|
| |
+ find: {},
|
| |
+
|
| |
+ relative: {
|
| |
+ ">": { dir: "parentNode", first: true },
|
| |
+ " ": { dir: "parentNode" },
|
| |
+ "+": { dir: "previousSibling", first: true },
|
| |
+ "~": { dir: "previousSibling" }
|
| |
},
|
| |
|
| |
- _unmark: function( force, elem, type ) {
|
| |
- if ( force !== true ) {
|
| |
- type = elem;
|
| |
- elem = force;
|
| |
- force = false;
|
| |
- }
|
| |
- if ( elem ) {
|
| |
- type = type || "fx";
|
| |
- var key = type + "mark",
|
| |
- count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
|
| |
- if ( count ) {
|
| |
- jQuery._data( elem, key, count );
|
| |
- } else {
|
| |
- jQuery.removeData( elem, key, true );
|
| |
- handleQueueMarkDefer( elem, type, "mark" );
|
| |
+ preFilter: {
|
| |
+ "ATTR": function( match ) {
|
| |
+ match[1] = match[1].replace( runescape, funescape );
|
| |
+
|
| |
+ // Move the given value to match[3] whether quoted or unquoted
|
| |
+ match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
|
| |
+
|
| |
+ if ( match[2] === "~=" ) {
|
| |
+ match[3] = " " + match[3] + " ";
|
| |
}
|
| |
- }
|
| |
- },
|
| |
|
| |
- queue: function( elem, type, data ) {
|
| |
- var q;
|
| |
- if ( elem ) {
|
| |
- type = ( type || "fx" ) + "queue";
|
| |
- q = jQuery._data( elem, type );
|
| |
+ return match.slice( 0, 4 );
|
| |
+ },
|
| |
|
| |
- // Speed up dequeue by getting out quickly if this is just a lookup
|
| |
- if ( data ) {
|
| |
- if ( !q || jQuery.isArray(data) ) {
|
| |
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
|
| |
- } else {
|
| |
- q.push( data );
|
| |
+ "CHILD": function( match ) {
|
| |
+ /* matches from matchExpr["CHILD"]
|
| |
+ 1 type (only|nth|...)
|
| |
+ 2 what (child|of-type)
|
| |
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
|
| |
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
|
| |
+ 5 sign of xn-component
|
| |
+ 6 x of xn-component
|
| |
+ 7 sign of y-component
|
| |
+ 8 y of y-component
|
| |
+ */
|
| |
+ match[1] = match[1].toLowerCase();
|
| |
+
|
| |
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
|
| |
+ // nth-* requires argument
|
| |
+ if ( !match[3] ) {
|
| |
+ Sizzle.error( match[0] );
|
| |
}
|
| |
+
|
| |
+ // numeric x and y parameters for Expr.filter.CHILD
|
| |
+ // remember that false/true cast respectively to 0/1
|
| |
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
|
| |
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
|
| |
+
|
| |
+ // other types prohibit arguments
|
| |
+ } else if ( match[3] ) {
|
| |
+ Sizzle.error( match[0] );
|
| |
}
|
| |
- return q || [];
|
| |
- }
|
| |
- },
|
| |
|
| |
- dequeue: function( elem, type ) {
|
| |
- type = type || "fx";
|
| |
+ return match;
|
| |
+ },
|
| |
|
| |
- var queue = jQuery.queue( elem, type ),
|
| |
- fn = queue.shift(),
|
| |
- hooks = {};
|
| |
+ "PSEUDO": function( match ) {
|
| |
+ var excess,
|
| |
+ unquoted = !match[6] && match[2];
|
| |
|
| |
- // If the fx queue is dequeued, always remove the progress sentinel
|
| |
- if ( fn === "inprogress" ) {
|
| |
- fn = queue.shift();
|
| |
- }
|
| |
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
|
| |
+ return null;
|
| |
+ }
|
| |
|
| |
- if ( fn ) {
|
| |
- // Add a progress sentinel to prevent the fx queue from being
|
| |
- // automatically dequeued
|
| |
- if ( type === "fx" ) {
|
| |
- queue.unshift( "inprogress" );
|
| |
+ // Accept quoted arguments as-is
|
| |
+ if ( match[3] ) {
|
| |
+ match[2] = match[4] || match[5] || "";
|
| |
+
|
| |
+ // Strip excess characters from unquoted arguments
|
| |
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
|
| |
+ // Get excess from tokenize (recursively)
|
| |
+ (excess = tokenize( unquoted, true )) &&
|
| |
+ // advance to the next closing parenthesis
|
| |
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
|
| |
+
|
| |
+ // excess is a negative index
|
| |
+ match[0] = match[0].slice( 0, excess );
|
| |
+ match[2] = unquoted.slice( 0, excess );
|
| |
}
|
| |
|
| |
- jQuery._data( elem, type + ".run", hooks );
|
| |
- fn.call( elem, function() {
|
| |
- jQuery.dequeue( elem, type );
|
| |
- }, hooks );
|
| |
+ // Return only captures needed by the pseudo filter method (type and argument)
|
| |
+ return match.slice( 0, 3 );
|
| |
}
|
| |
+ },
|
| |
|
| |
- if ( !queue.length ) {
|
| |
- jQuery.removeData( elem, type + "queue " + type + ".run", true );
|
| |
- handleQueueMarkDefer( elem, type, "queue" );
|
| |
- }
|
| |
- }
|
| |
- });
|
| |
+ filter: {
|
| |
|
| |
- jQuery.fn.extend({
|
| |
- queue: function( type, data ) {
|
| |
- var setter = 2;
|
| |
+ "TAG": function( nodeNameSelector ) {
|
| |
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
|
| |
+ return nodeNameSelector === "*" ?
|
| |
+ function() { return true; } :
|
| |
+ function( elem ) {
|
| |
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
|
| |
+ };
|
| |
+ },
|
| |
|
| |
- if ( typeof type !== "string" ) {
|
| |
- data = type;
|
| |
- type = "fx";
|
| |
- setter--;
|
| |
- }
|
| |
+ "CLASS": function( className ) {
|
| |
+ var pattern = classCache[ className + " " ];
|
| |
|
| |
- if ( arguments.length < setter ) {
|
| |
- return jQuery.queue( this[0], type );
|
| |
- }
|
| |
+ return pattern ||
|
| |
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
| |
+ classCache( className, function( elem ) {
|
| |
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
|
| |
+ });
|
| |
+ },
|
| |
|
| |
- return data === undefined ?
|
| |
- this :
|
| |
- this.each(function() {
|
| |
- var queue = jQuery.queue( this, type, data );
|
| |
+ "ATTR": function( name, operator, check ) {
|
| |
+ return function( elem ) {
|
| |
+ var result = Sizzle.attr( elem, name );
|
| |
|
| |
- if ( type === "fx" && queue[0] !== "inprogress" ) {
|
| |
- jQuery.dequeue( this, type );
|
| |
+ if ( result == null ) {
|
| |
+ return operator === "!=";
|
| |
}
|
| |
- });
|
| |
- },
|
| |
- dequeue: function( type ) {
|
| |
- return this.each(function() {
|
| |
- jQuery.dequeue( this, type );
|
| |
- });
|
| |
- },
|
| |
- // Based off of the plugin by Clint Helfers, with permission.
|
| |
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
|
| |
- delay: function( time, type ) {
|
| |
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
|
| |
- type = type || "fx";
|
| |
+ if ( !operator ) {
|
| |
+ return true;
|
| |
+ }
|
| |
+
|
| |
+ result += "";
|
| |
|
| |
- return this.queue( type, function( next, hooks ) {
|
| |
- var timeout = setTimeout( next, time );
|
| |
- hooks.stop = function() {
|
| |
- clearTimeout( timeout );
|
| |
+ return operator === "=" ? result === check :
|
| |
+ operator === "!=" ? result !== check :
|
| |
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
|
| |
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
|
| |
+ operator === "$=" ? check && result.slice( -check.length ) === check :
|
| |
+ operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
|
| |
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
|
| |
+ false;
|
| |
};
|
| |
- });
|
| |
- },
|
| |
- clearQueue: function( type ) {
|
| |
- return this.queue( type || "fx", [] );
|
| |
- },
|
| |
- // Get a promise resolved when queues of a certain type
|
| |
- // are emptied (fx is the type by default)
|
| |
- promise: function( type, object ) {
|
| |
- if ( typeof type !== "string" ) {
|
| |
- object = type;
|
| |
- type = undefined;
|
| |
- }
|
| |
- type = type || "fx";
|
| |
- var defer = jQuery.Deferred(),
|
| |
- elements = this,
|
| |
- i = elements.length,
|
| |
- count = 1,
|
| |
- deferDataKey = type + "defer",
|
| |
- queueDataKey = type + "queue",
|
| |
- markDataKey = type + "mark",
|
| |
- tmp;
|
| |
- function resolve() {
|
| |
- if ( !( --count ) ) {
|
| |
- defer.resolveWith( elements, [ elements ] );
|
| |
- }
|
| |
- }
|
| |
- while( i-- ) {
|
| |
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
|
| |
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
|
| |
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
|
| |
- jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
|
| |
- count++;
|
| |
- tmp.add( resolve );
|
| |
- }
|
| |
- }
|
| |
- resolve();
|
| |
- return defer.promise( object );
|
| |
- }
|
| |
- });
|
| |
+ },
|
| |
|
| |
+ "CHILD": function( type, what, argument, first, last ) {
|
| |
+ var simple = type.slice( 0, 3 ) !== "nth",
|
| |
+ forward = type.slice( -4 ) !== "last",
|
| |
+ ofType = what === "of-type";
|
| |
+
|
| |
+ return first === 1 && last === 0 ?
|
| |
+
|
| |
+ // Shortcut for :nth-*(n)
|
| |
+ function( elem ) {
|
| |
+ return !!elem.parentNode;
|
| |
+ } :
|
| |
+
|
| |
+ function( elem, context, xml ) {
|
| |
+ var cache, uniqueCache, outerCache, node, nodeIndex, start,
|
| |
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
|
| |
+ parent = elem.parentNode,
|
| |
+ name = ofType && elem.nodeName.toLowerCase(),
|
| |
+ useCache = !xml && !ofType,
|
| |
+ diff = false;
|
| |
+
|
| |
+ if ( parent ) {
|
| |
+
|
| |
+ // :(first|last|only)-(child|of-type)
|
| |
+ if ( simple ) {
|
| |
+ while ( dir ) {
|
| |
+ node = elem;
|
| |
+ while ( (node = node[ dir ]) ) {
|
| |
+ if ( ofType ?
|
| |
+ node.nodeName.toLowerCase() === name :
|
| |
+ node.nodeType === 1 ) {
|
| |
+
|
| |
+ return false;
|
| |
+ }
|
| |
+ }
|
| |
+ // Reverse direction for :only-* (if we haven't yet done so)
|
| |
+ start = dir = type === "only" && !start && "nextSibling";
|
| |
+ }
|
| |
+ return true;
|
| |
+ }
|
| |
|
| |
+ start = [ forward ? parent.firstChild : parent.lastChild ];
|
| |
|
| |
+ // non-xml :nth-child(...) stores cache data on `parent`
|
| |
+ if ( forward && useCache ) {
|
| |
|
| |
- var rclass = /[\n\t\r]/g,
|
| |
- rspace = /\s+/,
|
| |
- rreturn = /\r/g,
|
| |
- rtype = /^(?:button|input)$/i,
|
| |
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
|
| |
- rclickable = /^a(?:rea)?$/i,
|
| |
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
|
| |
- getSetAttribute = jQuery.support.getSetAttribute,
|
| |
- nodeHook, boolHook, fixSpecified;
|
| |
+ // Seek `elem` from a previously-cached index
|
| |
|
| |
- jQuery.fn.extend({
|
| |
- attr: function( name, value ) {
|
| |
- return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
|
| |
- },
|
| |
+ // ...in a gzip-friendly way
|
| |
+ node = parent;
|
| |
+ outerCache = node[ expando ] || (node[ expando ] = {});
|
| |
|
| |
- removeAttr: function( name ) {
|
| |
- return this.each(function() {
|
| |
- jQuery.removeAttr( this, name );
|
| |
- });
|
| |
- },
|
| |
+ // Support: IE <9 only
|
| |
+ // Defend against cloned attroperties (jQuery gh-1709)
|
| |
+ uniqueCache = outerCache[ node.uniqueID ] ||
|
| |
+ (outerCache[ node.uniqueID ] = {});
|
| |
|
| |
- prop: function( name, value ) {
|
| |
- return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
|
| |
- },
|
| |
+ cache = uniqueCache[ type ] || [];
|
| |
+ nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
|
| |
+ diff = nodeIndex && cache[ 2 ];
|
| |
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
|
| |
|
| |
- removeProp: function( name ) {
|
| |
- name = jQuery.propFix[ name ] || name;
|
| |
- return this.each(function() {
|
| |
- // try/catch handles cases where IE balks (such as removing a property on window)
|
| |
- try {
|
| |
- this[ name ] = undefined;
|
| |
- delete this[ name ];
|
| |
- } catch( e ) {}
|
| |
- });
|
| |
- },
|
| |
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
|
| |
|
| |
- addClass: function( value ) {
|
| |
- var classNames, i, l, elem,
|
| |
- setClass, c, cl;
|
| |
+ // Fallback to seeking `elem` from the start
|
| |
+ (diff = nodeIndex = 0) || start.pop()) ) {
|
| |
|
| |
- if ( jQuery.isFunction( value ) ) {
|
| |
- return this.each(function( j ) {
|
| |
- jQuery( this ).addClass( value.call(this, j, this.className) );
|
| |
- });
|
| |
- }
|
| |
+ // When found, cache indexes on `parent` and break
|
| |
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
|
| |
+ uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
|
| |
+ break;
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
+ } else {
|
| |
+ // Use previously-cached element index if available
|
| |
+ if ( useCache ) {
|
| |
+ // ...in a gzip-friendly way
|
| |
+ node = elem;
|
| |
+ outerCache = node[ expando ] || (node[ expando ] = {});
|
| |
+
|
| |
+ // Support: IE <9 only
|
| |
+ // Defend against cloned attroperties (jQuery gh-1709)
|
| |
+ uniqueCache = outerCache[ node.uniqueID ] ||
|
| |
+ (outerCache[ node.uniqueID ] = {});
|
| |
+
|
| |
+ cache = uniqueCache[ type ] || [];
|
| |
+ nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
|
| |
+ diff = nodeIndex;
|
| |
+ }
|
| |
|
| |
- if ( value && typeof value === "string" ) {
|
| |
- classNames = value.split( rspace );
|
| |
+ // xml :nth-child(...)
|
| |
+ // or :nth-last-child(...) or :nth(-last)?-of-type(...)
|
| |
+ if ( diff === false ) {
|
| |
+ // Use the same loop as above to seek `elem` from the start
|
| |
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
|
| |
+ (diff = nodeIndex = 0) || start.pop()) ) {
|
| |
|
| |
- for ( i = 0, l = this.length; i < l; i++ ) {
|
| |
- elem = this[ i ];
|
| |
+ if ( ( ofType ?
|
| |
+ node.nodeName.toLowerCase() === name :
|
| |
+ node.nodeType === 1 ) &&
|
| |
+ ++diff ) {
|
| |
|
| |
- if ( elem.nodeType === 1 ) {
|
| |
- if ( !elem.className && classNames.length === 1 ) {
|
| |
- elem.className = value;
|
| |
+ // Cache the index of each encountered element
|
| |
+ if ( useCache ) {
|
| |
+ outerCache = node[ expando ] || (node[ expando ] = {});
|
| |
|
| |
- } else {
|
| |
- setClass = " " + elem.className + " ";
|
| |
+ // Support: IE <9 only
|
| |
+ // Defend against cloned attroperties (jQuery gh-1709)
|
| |
+ uniqueCache = outerCache[ node.uniqueID ] ||
|
| |
+ (outerCache[ node.uniqueID ] = {});
|
| |
+
|
| |
+ uniqueCache[ type ] = [ dirruns, diff ];
|
| |
+ }
|
| |
|
| |
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
|
| |
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
|
| |
- setClass += classNames[ c ] + " ";
|
| |
+ if ( node === elem ) {
|
| |
+ break;
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
}
|
| |
}
|
| |
- elem.className = jQuery.trim( setClass );
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
|
| |
- return this;
|
| |
- },
|
| |
+ // Incorporate the offset, then check against cycle size
|
| |
+ diff -= last;
|
| |
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
|
| |
+ }
|
| |
+ };
|
| |
+ },
|
| |
|
| |
- removeClass: function( value ) {
|
| |
- var classNames, i, l, elem, className, c, cl;
|
| |
+ "PSEUDO": function( pseudo, argument ) {
|
| |
+ // pseudo-class names are case-insensitive
|
| |
+ // http://www.w3.org/TR/selectors/#pseudo-classes
|
| |
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
|
| |
+ // Remember that setFilters inherits from pseudos
|
| |
+ var args,
|
| |
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
|
| |
+ Sizzle.error( "unsupported pseudo: " + pseudo );
|
| |
+
|
| |
+ // The user may use createPseudo to indicate that
|
| |
+ // arguments are needed to create the filter function
|
| |
+ // just as Sizzle does
|
| |
+ if ( fn[ expando ] ) {
|
| |
+ return fn( argument );
|
| |
+ }
|
| |
+
|
| |
+ // But maintain support for old signatures
|
| |
+ if ( fn.length > 1 ) {
|
| |
+ args = [ pseudo, pseudo, "", argument ];
|
| |
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
|
| |
+ markFunction(function( seed, matches ) {
|
| |
+ var idx,
|
| |
+ matched = fn( seed, argument ),
|
| |
+ i = matched.length;
|
| |
+ while ( i-- ) {
|
| |
+ idx = indexOf( seed, matched[i] );
|
| |
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
|
| |
+ }
|
| |
+ }) :
|
| |
+ function( elem ) {
|
| |
+ return fn( elem, 0, args );
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- if ( jQuery.isFunction( value ) ) {
|
| |
- return this.each(function( j ) {
|
| |
- jQuery( this ).removeClass( value.call(this, j, this.className) );
|
| |
- });
|
| |
+ return fn;
|
| |
}
|
| |
+ },
|
| |
|
| |
- if ( (value && typeof value === "string") || value === undefined ) {
|
| |
- classNames = ( value || "" ).split( rspace );
|
| |
+ pseudos: {
|
| |
+ // Potentially complex pseudos
|
| |
+ "not": markFunction(function( selector ) {
|
| |
+ // Trim the selector passed to compile
|
| |
+ // to avoid treating leading and trailing
|
| |
+ // spaces as combinators
|
| |
+ var input = [],
|
| |
+ results = [],
|
| |
+ matcher = compile( selector.replace( rtrim, "$1" ) );
|
| |
|
| |
- for ( i = 0, l = this.length; i < l; i++ ) {
|
| |
- elem = this[ i ];
|
| |
+ return matcher[ expando ] ?
|
| |
+ markFunction(function( seed, matches, context, xml ) {
|
| |
+ var elem,
|
| |
+ unmatched = matcher( seed, null, xml, [] ),
|
| |
+ i = seed.length;
|
| |
|
| |
- if ( elem.nodeType === 1 && elem.className ) {
|
| |
- if ( value ) {
|
| |
- className = (" " + elem.className + " ").replace( rclass, " " );
|
| |
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
|
| |
- className = className.replace(" " + classNames[ c ] + " ", " ");
|
| |
+ // Match elements unmatched by `matcher`
|
| |
+ while ( i-- ) {
|
| |
+ if ( (elem = unmatched[i]) ) {
|
| |
+ seed[i] = !(matches[i] = elem);
|
| |
}
|
| |
- elem.className = jQuery.trim( className );
|
| |
-
|
| |
- } else {
|
| |
- elem.className = "";
|
| |
}
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
+ }) :
|
| |
+ function( elem, context, xml ) {
|
| |
+ input[0] = elem;
|
| |
+ matcher( input, null, xml, results );
|
| |
+ // Don't keep the element (issue #299)
|
| |
+ input[0] = null;
|
| |
+ return !results.pop();
|
| |
+ };
|
| |
+ }),
|
| |
|
| |
- return this;
|
| |
- },
|
| |
+ "has": markFunction(function( selector ) {
|
| |
+ return function( elem ) {
|
| |
+ return Sizzle( selector, elem ).length > 0;
|
| |
+ };
|
| |
+ }),
|
| |
|
| |
- toggleClass: function( value, stateVal ) {
|
| |
- var type = typeof value,
|
| |
- isBool = typeof stateVal === "boolean";
|
| |
+ "contains": markFunction(function( text ) {
|
| |
+ text = text.replace( runescape, funescape );
|
| |
+ return function( elem ) {
|
| |
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
|
| |
+ };
|
| |
+ }),
|
| |
+
|
| |
+ // "Whether an element is represented by a :lang() selector
|
| |
+ // is based solely on the element's language value
|
| |
+ // being equal to the identifier C,
|
| |
+ // or beginning with the identifier C immediately followed by "-".
|
| |
+ // The matching of C against the element's language value is performed case-insensitively.
|
| |
+ // The identifier C does not have to be a valid language name."
|
| |
+ // http://www.w3.org/TR/selectors/#lang-pseudo
|
| |
+ "lang": markFunction( function( lang ) {
|
| |
+ // lang value must be a valid identifier
|
| |
+ if ( !ridentifier.test(lang || "") ) {
|
| |
+ Sizzle.error( "unsupported lang: " + lang );
|
| |
+ }
|
| |
+ lang = lang.replace( runescape, funescape ).toLowerCase();
|
| |
+ return function( elem ) {
|
| |
+ var elemLang;
|
| |
+ do {
|
| |
+ if ( (elemLang = documentIsHTML ?
|
| |
+ elem.lang :
|
| |
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
|
| |
+
|
| |
+ elemLang = elemLang.toLowerCase();
|
| |
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
|
| |
+ }
|
| |
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
|
| |
+ return false;
|
| |
+ };
|
| |
+ }),
|
| |
|
| |
- if ( jQuery.isFunction( value ) ) {
|
| |
- return this.each(function( i ) {
|
| |
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
| |
- });
|
| |
- }
|
| |
+ // Miscellaneous
|
| |
+ "target": function( elem ) {
|
| |
+ var hash = window.location && window.location.hash;
|
| |
+ return hash && hash.slice( 1 ) === elem.id;
|
| |
+ },
|
| |
|
| |
- return this.each(function() {
|
| |
- if ( type === "string" ) {
|
| |
- // toggle individual class names
|
| |
- var className,
|
| |
- i = 0,
|
| |
- self = jQuery( this ),
|
| |
- state = stateVal,
|
| |
- classNames = value.split( rspace );
|
| |
+ "root": function( elem ) {
|
| |
+ return elem === docElem;
|
| |
+ },
|
| |
|
| |
- while ( (className = classNames[ i++ ]) ) {
|
| |
- // check each className given, space seperated list
|
| |
- state = isBool ? state : !self.hasClass( className );
|
| |
- self[ state ? "addClass" : "removeClass" ]( className );
|
| |
- }
|
| |
+ "focus": function( elem ) {
|
| |
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
| |
+ },
|
| |
|
| |
- } else if ( type === "undefined" || type === "boolean" ) {
|
| |
- if ( this.className ) {
|
| |
- // store className if set
|
| |
- jQuery._data( this, "__className__", this.className );
|
| |
- }
|
| |
+ // Boolean properties
|
| |
+ "enabled": createDisabledPseudo( false ),
|
| |
+ "disabled": createDisabledPseudo( true ),
|
| |
+
|
| |
+ "checked": function( elem ) {
|
| |
+ // In CSS3, :checked should return both checked and selected elements
|
| |
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
| |
+ var nodeName = elem.nodeName.toLowerCase();
|
| |
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
|
| |
+ },
|
| |
|
| |
- // toggle whole className
|
| |
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
|
| |
+ "selected": function( elem ) {
|
| |
+ // Accessing this property makes selected-by-default
|
| |
+ // options in Safari work properly
|
| |
+ if ( elem.parentNode ) {
|
| |
+ elem.parentNode.selectedIndex;
|
| |
}
|
| |
- });
|
| |
- },
|
| |
|
| |
- hasClass: function( selector ) {
|
| |
- var className = " " + selector + " ",
|
| |
- i = 0,
|
| |
- l = this.length;
|
| |
- for ( ; i < l; i++ ) {
|
| |
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
|
| |
- return true;
|
| |
+ return elem.selected === true;
|
| |
+ },
|
| |
+
|
| |
+ // Contents
|
| |
+ "empty": function( elem ) {
|
| |
+ // http://www.w3.org/TR/selectors/#empty-pseudo
|
| |
+ // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
|
| |
+ // but not by others (comment: 8; processing instruction: 7; etc.)
|
| |
+ // nodeType < 6 works because attributes (2) do not appear as children
|
| |
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
|
| |
+ if ( elem.nodeType < 6 ) {
|
| |
+ return false;
|
| |
+ }
|
| |
}
|
| |
- }
|
| |
+ return true;
|
| |
+ },
|
| |
|
| |
- return false;
|
| |
- },
|
| |
+ "parent": function( elem ) {
|
| |
+ return !Expr.pseudos["empty"]( elem );
|
| |
+ },
|
| |
|
| |
- val: function( value ) {
|
| |
- var hooks, ret, isFunction,
|
| |
- elem = this[0];
|
| |
+ // Element/input types
|
| |
+ "header": function( elem ) {
|
| |
+ return rheader.test( elem.nodeName );
|
| |
+ },
|
| |
|
| |
- if ( !arguments.length ) {
|
| |
- if ( elem ) {
|
| |
- hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
| |
+ "input": function( elem ) {
|
| |
+ return rinputs.test( elem.nodeName );
|
| |
+ },
|
| |
|
| |
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
| |
- return ret;
|
| |
- }
|
| |
+ "button": function( elem ) {
|
| |
+ var name = elem.nodeName.toLowerCase();
|
| |
+ return name === "input" && elem.type === "button" || name === "button";
|
| |
+ },
|
| |
|
| |
- ret = elem.value;
|
| |
+ "text": function( elem ) {
|
| |
+ var attr;
|
| |
+ return elem.nodeName.toLowerCase() === "input" &&
|
| |
+ elem.type === "text" &&
|
| |
|
| |
- return typeof ret === "string" ?
|
| |
- // handle most common string cases
|
| |
- ret.replace(rreturn, "") :
|
| |
- // handle cases where value is null/undef or number
|
| |
- ret == null ? "" : ret;
|
| |
- }
|
| |
+ // Support: IE<8
|
| |
+ // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
|
| |
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
|
| |
+ },
|
| |
|
| |
- return;
|
| |
- }
|
| |
+ // Position-in-collection
|
| |
+ "first": createPositionalPseudo(function() {
|
| |
+ return [ 0 ];
|
| |
+ }),
|
| |
|
| |
- isFunction = jQuery.isFunction( value );
|
| |
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
|
| |
+ return [ length - 1 ];
|
| |
+ }),
|
| |
|
| |
- return this.each(function( i ) {
|
| |
- var self = jQuery(this), val;
|
| |
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
| |
+ return [ argument < 0 ? argument + length : argument ];
|
| |
+ }),
|
| |
|
| |
- if ( this.nodeType !== 1 ) {
|
| |
- return;
|
| |
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
|
| |
+ var i = 0;
|
| |
+ for ( ; i < length; i += 2 ) {
|
| |
+ matchIndexes.push( i );
|
| |
}
|
| |
+ return matchIndexes;
|
| |
+ }),
|
| |
|
| |
- if ( isFunction ) {
|
| |
- val = value.call( this, i, self.val() );
|
| |
- } else {
|
| |
- val = value;
|
| |
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
|
| |
+ var i = 1;
|
| |
+ for ( ; i < length; i += 2 ) {
|
| |
+ matchIndexes.push( i );
|
| |
}
|
| |
+ return matchIndexes;
|
| |
+ }),
|
| |
|
| |
- // Treat null/undefined as ""; convert numbers to string
|
| |
- if ( val == null ) {
|
| |
- val = "";
|
| |
- } else if ( typeof val === "number" ) {
|
| |
- val += "";
|
| |
- } else if ( jQuery.isArray( val ) ) {
|
| |
- val = jQuery.map(val, function ( value ) {
|
| |
- return value == null ? "" : value + "";
|
| |
- });
|
| |
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
| |
+ var i = argument < 0 ? argument + length : argument;
|
| |
+ for ( ; --i >= 0; ) {
|
| |
+ matchIndexes.push( i );
|
| |
}
|
| |
+ return matchIndexes;
|
| |
+ }),
|
| |
|
| |
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
| |
-
|
| |
- // If set returns undefined, fall back to normal setting
|
| |
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
| |
- this.value = val;
|
| |
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
| |
+ var i = argument < 0 ? argument + length : argument;
|
| |
+ for ( ; ++i < length; ) {
|
| |
+ matchIndexes.push( i );
|
| |
}
|
| |
- });
|
| |
+ return matchIndexes;
|
| |
+ })
|
| |
}
|
| |
- });
|
| |
+ };
|
| |
|
| |
- jQuery.extend({
|
| |
- valHooks: {
|
| |
- option: {
|
| |
- get: function( elem ) {
|
| |
- // attributes.value is undefined in Blackberry 4.7 but
|
| |
- // uses .value. See #6932
|
| |
- var val = elem.attributes.value;
|
| |
- return !val || val.specified ? elem.value : elem.text;
|
| |
- }
|
| |
- },
|
| |
- select: {
|
| |
- get: function( elem ) {
|
| |
- var value, i, max, option,
|
| |
- index = elem.selectedIndex,
|
| |
- values = [],
|
| |
- options = elem.options,
|
| |
- one = elem.type === "select-one";
|
| |
+ Expr.pseudos["nth"] = Expr.pseudos["eq"];
|
| |
|
| |
- // Nothing was selected
|
| |
- if ( index < 0 ) {
|
| |
- return null;
|
| |
- }
|
| |
+ // Add button/input type pseudos
|
| |
+ for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
|
| |
+ Expr.pseudos[ i ] = createInputPseudo( i );
|
| |
+ }
|
| |
+ for ( i in { submit: true, reset: true } ) {
|
| |
+ Expr.pseudos[ i ] = createButtonPseudo( i );
|
| |
+ }
|
| |
|
| |
- // Loop through all the selected options
|
| |
- i = one ? index : 0;
|
| |
- max = one ? index + 1 : options.length;
|
| |
- for ( ; i < max; i++ ) {
|
| |
- option = options[ i ];
|
| |
+ // Easy API for creating new setFilters
|
| |
+ function setFilters() {}
|
| |
+ setFilters.prototype = Expr.filters = Expr.pseudos;
|
| |
+ Expr.setFilters = new setFilters();
|
| |
|
| |
- // Don't return options that are disabled or in a disabled optgroup
|
| |
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
|
| |
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
|
| |
+ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
|
| |
+ var matched, match, tokens, type,
|
| |
+ soFar, groups, preFilters,
|
| |
+ cached = tokenCache[ selector + " " ];
|
| |
|
| |
- // Get the specific value for the option
|
| |
- value = jQuery( option ).val();
|
| |
+ if ( cached ) {
|
| |
+ return parseOnly ? 0 : cached.slice( 0 );
|
| |
+ }
|
| |
|
| |
- // We don't need an array for one selects
|
| |
- if ( one ) {
|
| |
- return value;
|
| |
- }
|
| |
+ soFar = selector;
|
| |
+ groups = [];
|
| |
+ preFilters = Expr.preFilter;
|
| |
|
| |
- // Multi-Selects return an array
|
| |
- values.push( value );
|
| |
- }
|
| |
- }
|
| |
+ while ( soFar ) {
|
| |
|
| |
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
|
| |
- if ( one && !values.length && options.length ) {
|
| |
- return jQuery( options[ index ] ).val();
|
| |
- }
|
| |
+ // Comma and first run
|
| |
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
|
| |
+ if ( match ) {
|
| |
+ // Don't consume trailing commas as valid
|
| |
+ soFar = soFar.slice( match[0].length ) || soFar;
|
| |
+ }
|
| |
+ groups.push( (tokens = []) );
|
| |
+ }
|
| |
|
| |
- return values;
|
| |
- },
|
| |
+ matched = false;
|
| |
|
| |
- set: function( elem, value ) {
|
| |
- var values = jQuery.makeArray( value );
|
| |
+ // Combinators
|
| |
+ if ( (match = rcombinators.exec( soFar )) ) {
|
| |
+ matched = match.shift();
|
| |
+ tokens.push({
|
| |
+ value: matched,
|
| |
+ // Cast descendant combinators to space
|
| |
+ type: match[0].replace( rtrim, " " )
|
| |
+ });
|
| |
+ soFar = soFar.slice( matched.length );
|
| |
+ }
|
| |
|
| |
- jQuery(elem).find("option").each(function() {
|
| |
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
| |
+ // Filters
|
| |
+ for ( type in Expr.filter ) {
|
| |
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
| |
+ (match = preFilters[ type ]( match ))) ) {
|
| |
+ matched = match.shift();
|
| |
+ tokens.push({
|
| |
+ value: matched,
|
| |
+ type: type,
|
| |
+ matches: match
|
| |
});
|
| |
-
|
| |
- if ( !values.length ) {
|
| |
- elem.selectedIndex = -1;
|
| |
- }
|
| |
- return values;
|
| |
+ soFar = soFar.slice( matched.length );
|
| |
}
|
| |
}
|
| |
- },
|
| |
|
| |
- attrFn: {
|
| |
- val: true,
|
| |
- css: true,
|
| |
- html: true,
|
| |
- text: true,
|
| |
- data: true,
|
| |
- width: true,
|
| |
- height: true,
|
| |
- offset: true
|
| |
- },
|
| |
+ if ( !matched ) {
|
| |
+ break;
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- attr: function( elem, name, value, pass ) {
|
| |
- var ret, hooks, notxml,
|
| |
- nType = elem.nodeType;
|
| |
+ // Return the length of the invalid excess
|
| |
+ // if we're just parsing
|
| |
+ // Otherwise, throw an error or return tokens
|
| |
+ return parseOnly ?
|
| |
+ soFar.length :
|
| |
+ soFar ?
|
| |
+ Sizzle.error( selector ) :
|
| |
+ // Cache the tokens
|
| |
+ tokenCache( selector, groups ).slice( 0 );
|
| |
+ };
|
| |
|
| |
- // don't get/set attributes on text, comment and attribute nodes
|
| |
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
| |
- return;
|
| |
- }
|
| |
+ function toSelector( tokens ) {
|
| |
+ var i = 0,
|
| |
+ len = tokens.length,
|
| |
+ selector = "";
|
| |
+ for ( ; i < len; i++ ) {
|
| |
+ selector += tokens[i].value;
|
| |
+ }
|
| |
+ return selector;
|
| |
+ }
|
| |
|
| |
- if ( pass && name in jQuery.attrFn ) {
|
| |
- return jQuery( elem )[ name ]( value );
|
| |
- }
|
| |
+ function addCombinator( matcher, combinator, base ) {
|
| |
+ var dir = combinator.dir,
|
| |
+ skip = combinator.next,
|
| |
+ key = skip || dir,
|
| |
+ checkNonElements = base && key === "parentNode",
|
| |
+ doneName = done++;
|
| |
|
| |
- // Fallback to prop when attributes are not supported
|
| |
- if ( typeof elem.getAttribute === "undefined" ) {
|
| |
- return jQuery.prop( elem, name, value );
|
| |
- }
|
| |
+ return combinator.first ?
|
| |
+ // Check against closest ancestor/preceding element
|
| |
+ function( elem, context, xml ) {
|
| |
+ while ( (elem = elem[ dir ]) ) {
|
| |
+ if ( elem.nodeType === 1 || checkNonElements ) {
|
| |
+ return matcher( elem, context, xml );
|
| |
+ }
|
| |
+ }
|
| |
+ return false;
|
| |
+ } :
|
| |
|
| |
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
| |
+ // Check against all ancestor/preceding elements
|
| |
+ function( elem, context, xml ) {
|
| |
+ var oldCache, uniqueCache, outerCache,
|
| |
+ newCache = [ dirruns, doneName ];
|
| |
|
| |
- // All attributes are lowercase
|
| |
- // Grab necessary hook if one is defined
|
| |
- if ( notxml ) {
|
| |
- name = name.toLowerCase();
|
| |
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
|
| |
- }
|
| |
+ // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
|
| |
+ if ( xml ) {
|
| |
+ while ( (elem = elem[ dir ]) ) {
|
| |
+ if ( elem.nodeType === 1 || checkNonElements ) {
|
| |
+ if ( matcher( elem, context, xml ) ) {
|
| |
+ return true;
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ } else {
|
| |
+ while ( (elem = elem[ dir ]) ) {
|
| |
+ if ( elem.nodeType === 1 || checkNonElements ) {
|
| |
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
|
| |
|
| |
- if ( value !== undefined ) {
|
| |
+ // Support: IE <9 only
|
| |
+ // Defend against cloned attroperties (jQuery gh-1709)
|
| |
+ uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
|
| |
|
| |
- if ( value === null ) {
|
| |
- jQuery.removeAttr( elem, name );
|
| |
- return;
|
| |
+ if ( skip && skip === elem.nodeName.toLowerCase() ) {
|
| |
+ elem = elem[ dir ] || elem;
|
| |
+ } else if ( (oldCache = uniqueCache[ key ]) &&
|
| |
+ oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
|
| |
|
| |
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
| |
- return ret;
|
| |
+ // Assign to newCache so results back-propagate to previous elements
|
| |
+ return (newCache[ 2 ] = oldCache[ 2 ]);
|
| |
+ } else {
|
| |
+ // Reuse newcache so results back-propagate to previous elements
|
| |
+ uniqueCache[ key ] = newCache;
|
| |
|
| |
- } else {
|
| |
- elem.setAttribute( name, "" + value );
|
| |
- return value;
|
| |
+ // A match means we're done; a fail means we have to keep checking
|
| |
+ if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
|
| |
+ return true;
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
}
|
| |
+ return false;
|
| |
+ };
|
| |
+ }
|
| |
|
| |
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
|
| |
- return ret;
|
| |
+ function elementMatcher( matchers ) {
|
| |
+ return matchers.length > 1 ?
|
| |
+ function( elem, context, xml ) {
|
| |
+ var i = matchers.length;
|
| |
+ while ( i-- ) {
|
| |
+ if ( !matchers[i]( elem, context, xml ) ) {
|
| |
+ return false;
|
| |
+ }
|
| |
+ }
|
| |
+ return true;
|
| |
+ } :
|
| |
+ matchers[0];
|
| |
+ }
|
| |
|
| |
- } else {
|
| |
+ function multipleContexts( selector, contexts, results ) {
|
| |
+ var i = 0,
|
| |
+ len = contexts.length;
|
| |
+ for ( ; i < len; i++ ) {
|
| |
+ Sizzle( selector, contexts[i], results );
|
| |
+ }
|
| |
+ return results;
|
| |
+ }
|
| |
|
| |
- ret = elem.getAttribute( name );
|
| |
+ function condense( unmatched, map, filter, context, xml ) {
|
| |
+ var elem,
|
| |
+ newUnmatched = [],
|
| |
+ i = 0,
|
| |
+ len = unmatched.length,
|
| |
+ mapped = map != null;
|
| |
|
| |
- // Non-existent attributes return null, we normalize to undefined
|
| |
- return ret === null ?
|
| |
- undefined :
|
| |
- ret;
|
| |
+ for ( ; i < len; i++ ) {
|
| |
+ if ( (elem = unmatched[i]) ) {
|
| |
+ if ( !filter || filter( elem, context, xml ) ) {
|
| |
+ newUnmatched.push( elem );
|
| |
+ if ( mapped ) {
|
| |
+ map.push( i );
|
| |
+ }
|
| |
+ }
|
| |
}
|
| |
- },
|
| |
+ }
|
| |
|
| |
- removeAttr: function( elem, value ) {
|
| |
- var propName, attrNames, name, l, isBool,
|
| |
- i = 0;
|
| |
+ return newUnmatched;
|
| |
+ }
|
| |
|
| |
- if ( value && elem.nodeType === 1 ) {
|
| |
- attrNames = value.toLowerCase().split( rspace );
|
| |
- l = attrNames.length;
|
| |
+ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
|
| |
+ if ( postFilter && !postFilter[ expando ] ) {
|
| |
+ postFilter = setMatcher( postFilter );
|
| |
+ }
|
| |
+ if ( postFinder && !postFinder[ expando ] ) {
|
| |
+ postFinder = setMatcher( postFinder, postSelector );
|
| |
+ }
|
| |
+ return markFunction(function( seed, results, context, xml ) {
|
| |
+ var temp, i, elem,
|
| |
+ preMap = [],
|
| |
+ postMap = [],
|
| |
+ preexisting = results.length,
|
| |
|
| |
- for ( ; i < l; i++ ) {
|
| |
- name = attrNames[ i ];
|
| |
+ // Get initial elements from seed or context
|
| |
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
| |
+
|
| |
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
|
| |
+ matcherIn = preFilter && ( seed || !selector ) ?
|
| |
+ condense( elems, preMap, preFilter, context, xml ) :
|
| |
+ elems,
|
| |
+
|
| |
+ matcherOut = matcher ?
|
| |
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
|
| |
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
|
| |
+
|
| |
+ // ...intermediate processing is necessary
|
| |
+ [] :
|
| |
+
|
| |
+ // ...otherwise use results directly
|
| |
+ results :
|
| |
+ matcherIn;
|
| |
+
|
| |
+ // Find primary matches
|
| |
+ if ( matcher ) {
|
| |
+ matcher( matcherIn, matcherOut, context, xml );
|
| |
+ }
|
| |
+
|
| |
+ // Apply postFilter
|
| |
+ if ( postFilter ) {
|
| |
+ temp = condense( matcherOut, postMap );
|
| |
+ postFilter( temp, [], context, xml );
|
| |
|
| |
- if ( name ) {
|
| |
- propName = jQuery.propFix[ name ] || name;
|
| |
- isBool = rboolean.test( name );
|
| |
+ // Un-match failing elements by moving them back to matcherIn
|
| |
+ i = temp.length;
|
| |
+ while ( i-- ) {
|
| |
+ if ( (elem = temp[i]) ) {
|
| |
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- // See #9699 for explanation of this approach (setting first, then removal)
|
| |
- // Do not do this for boolean attributes (see #10870)
|
| |
- if ( !isBool ) {
|
| |
- jQuery.attr( elem, name, "" );
|
| |
+ if ( seed ) {
|
| |
+ if ( postFinder || preFilter ) {
|
| |
+ if ( postFinder ) {
|
| |
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
|
| |
+ temp = [];
|
| |
+ i = matcherOut.length;
|
| |
+ while ( i-- ) {
|
| |
+ if ( (elem = matcherOut[i]) ) {
|
| |
+ // Restore matcherIn since elem is not yet a final match
|
| |
+ temp.push( (matcherIn[i] = elem) );
|
| |
+ }
|
| |
}
|
| |
- elem.removeAttribute( getSetAttribute ? name : propName );
|
| |
+ postFinder( null, (matcherOut = []), temp, xml );
|
| |
+ }
|
| |
+
|
| |
+ // Move matched elements from seed to results to keep them synchronized
|
| |
+ i = matcherOut.length;
|
| |
+ while ( i-- ) {
|
| |
+ if ( (elem = matcherOut[i]) &&
|
| |
+ (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
|
| |
|
| |
- // Set corresponding property to false for boolean attributes
|
| |
- if ( isBool && propName in elem ) {
|
| |
- elem[ propName ] = false;
|
| |
+ seed[temp] = !(results[temp] = elem);
|
| |
}
|
| |
}
|
| |
}
|
| |
+
|
| |
+ // Add elements to results, through postFinder if defined
|
| |
+ } else {
|
| |
+ matcherOut = condense(
|
| |
+ matcherOut === results ?
|
| |
+ matcherOut.splice( preexisting, matcherOut.length ) :
|
| |
+ matcherOut
|
| |
+ );
|
| |
+ if ( postFinder ) {
|
| |
+ postFinder( null, results, matcherOut, xml );
|
| |
+ } else {
|
| |
+ push.apply( results, matcherOut );
|
| |
+ }
|
| |
}
|
| |
- },
|
| |
+ });
|
| |
+ }
|
| |
|
| |
- attrHooks: {
|
| |
- type: {
|
| |
- set: function( elem, value ) {
|
| |
- // We can't allow the type property to be changed (since it causes problems in IE)
|
| |
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
|
| |
- jQuery.error( "type property can't be changed" );
|
| |
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
|
| |
- // Setting the type on a radio button after the value resets the value in IE6-9
|
| |
- // Reset value to it's default in case type is set after value
|
| |
- // This is for element creation
|
| |
- var val = elem.value;
|
| |
- elem.setAttribute( "type", value );
|
| |
- if ( val ) {
|
| |
- elem.value = val;
|
| |
+ function matcherFromTokens( tokens ) {
|
| |
+ var checkContext, matcher, j,
|
| |
+ len = tokens.length,
|
| |
+ leadingRelative = Expr.relative[ tokens[0].type ],
|
| |
+ implicitRelative = leadingRelative || Expr.relative[" "],
|
| |
+ i = leadingRelative ? 1 : 0,
|
| |
+
|
| |
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
|
| |
+ matchContext = addCombinator( function( elem ) {
|
| |
+ return elem === checkContext;
|
| |
+ }, implicitRelative, true ),
|
| |
+ matchAnyContext = addCombinator( function( elem ) {
|
| |
+ return indexOf( checkContext, elem ) > -1;
|
| |
+ }, implicitRelative, true ),
|
| |
+ matchers = [ function( elem, context, xml ) {
|
| |
+ var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
|
| |
+ (checkContext = context).nodeType ?
|
| |
+ matchContext( elem, context, xml ) :
|
| |
+ matchAnyContext( elem, context, xml ) );
|
| |
+ // Avoid hanging onto element (issue #299)
|
| |
+ checkContext = null;
|
| |
+ return ret;
|
| |
+ } ];
|
| |
+
|
| |
+ for ( ; i < len; i++ ) {
|
| |
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
| |
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
|
| |
+ } else {
|
| |
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
| |
+
|
| |
+ // Return special upon seeing a positional matcher
|
| |
+ if ( matcher[ expando ] ) {
|
| |
+ // Find the next relative operator (if any) for proper handling
|
| |
+ j = ++i;
|
| |
+ for ( ; j < len; j++ ) {
|
| |
+ if ( Expr.relative[ tokens[j].type ] ) {
|
| |
+ break;
|
| |
}
|
| |
- return value;
|
| |
}
|
| |
+ return setMatcher(
|
| |
+ i > 1 && elementMatcher( matchers ),
|
| |
+ i > 1 && toSelector(
|
| |
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
|
| |
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
|
| |
+ ).replace( rtrim, "$1" ),
|
| |
+ matcher,
|
| |
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
|
| |
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
|
| |
+ j < len && toSelector( tokens )
|
| |
+ );
|
| |
}
|
| |
- },
|
| |
- // Use the value property for back compat
|
| |
- // Use the nodeHook for button elements in IE6/7 (#1954)
|
| |
- value: {
|
| |
- get: function( elem, name ) {
|
| |
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
|
| |
- return nodeHook.get( elem, name );
|
| |
- }
|
| |
- return name in elem ?
|
| |
- elem.value :
|
| |
- null;
|
| |
- },
|
| |
- set: function( elem, value, name ) {
|
| |
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
|
| |
- return nodeHook.set( elem, value, name );
|
| |
+ matchers.push( matcher );
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
+ return elementMatcher( matchers );
|
| |
+ }
|
| |
+
|
| |
+ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
| |
+ var bySet = setMatchers.length > 0,
|
| |
+ byElement = elementMatchers.length > 0,
|
| |
+ superMatcher = function( seed, context, xml, results, outermost ) {
|
| |
+ var elem, j, matcher,
|
| |
+ matchedCount = 0,
|
| |
+ i = "0",
|
| |
+ unmatched = seed && [],
|
| |
+ setMatched = [],
|
| |
+ contextBackup = outermostContext,
|
| |
+ // We must always have either seed elements or outermost context
|
| |
+ elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
|
| |
+ // Use integer dirruns iff this is the outermost matcher
|
| |
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
|
| |
+ len = elems.length;
|
| |
+
|
| |
+ if ( outermost ) {
|
| |
+ outermostContext = context === document || context || outermost;
|
| |
+ }
|
| |
+
|
| |
+ // Add elements passing elementMatchers directly to results
|
| |
+ // Support: IE<9, Safari
|
| |
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
|
| |
+ for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
|
| |
+ if ( byElement && elem ) {
|
| |
+ j = 0;
|
| |
+ if ( !context && elem.ownerDocument !== document ) {
|
| |
+ setDocument( elem );
|
| |
+ xml = !documentIsHTML;
|
| |
+ }
|
| |
+ while ( (matcher = elementMatchers[j++]) ) {
|
| |
+ if ( matcher( elem, context || document, xml) ) {
|
| |
+ results.push( elem );
|
| |
+ break;
|
| |
+ }
|
| |
+ }
|
| |
+ if ( outermost ) {
|
| |
+ dirruns = dirrunsUnique;
|
| |
+ }
|
| |
+ }
|
| |
+
|
| |
+ // Track unmatched elements for set filters
|
| |
+ if ( bySet ) {
|
| |
+ // They will have gone through all possible matchers
|
| |
+ if ( (elem = !matcher && elem) ) {
|
| |
+ matchedCount--;
|
| |
+ }
|
| |
+
|
| |
+ // Lengthen the array for every element, matched or not
|
| |
+ if ( seed ) {
|
| |
+ unmatched.push( elem );
|
| |
+ }
|
| |
}
|
| |
- // Does not return so that setAttribute is also used
|
| |
- elem.value = value;
|
| |
}
|
| |
- }
|
| |
- },
|
| |
|
| |
- propFix: {
|
| |
- tabindex: "tabIndex",
|
| |
- readonly: "readOnly",
|
| |
- "for": "htmlFor",
|
| |
- "class": "className",
|
| |
- maxlength: "maxLength",
|
| |
- cellspacing: "cellSpacing",
|
| |
- cellpadding: "cellPadding",
|
| |
- rowspan: "rowSpan",
|
| |
- colspan: "colSpan",
|
| |
- usemap: "useMap",
|
| |
- frameborder: "frameBorder",
|
| |
- contenteditable: "contentEditable"
|
| |
- },
|
| |
+ // `i` is now the count of elements visited above, and adding it to `matchedCount`
|
| |
+ // makes the latter nonnegative.
|
| |
+ matchedCount += i;
|
| |
|
| |
- prop: function( elem, name, value ) {
|
| |
- var ret, hooks, notxml,
|
| |
- nType = elem.nodeType;
|
| |
+ // Apply set filters to unmatched elements
|
| |
+ // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
|
| |
+ // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
|
| |
+ // no element matchers and no seed.
|
| |
+ // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
|
| |
+ // case, which will result in a "00" `matchedCount` that differs from `i` but is also
|
| |
+ // numerically zero.
|
| |
+ if ( bySet && i !== matchedCount ) {
|
| |
+ j = 0;
|
| |
+ while ( (matcher = setMatchers[j++]) ) {
|
| |
+ matcher( unmatched, setMatched, context, xml );
|
| |
+ }
|
| |
|
| |
- // don't get/set properties on text, comment and attribute nodes
|
| |
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
| |
- return;
|
| |
- }
|
| |
+ if ( seed ) {
|
| |
+ // Reintegrate element matches to eliminate the need for sorting
|
| |
+ if ( matchedCount > 0 ) {
|
| |
+ while ( i-- ) {
|
| |
+ if ( !(unmatched[i] || setMatched[i]) ) {
|
| |
+ setMatched[i] = pop.call( results );
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
| |
+ // Discard index placeholder values to get only actual matches
|
| |
+ setMatched = condense( setMatched );
|
| |
+ }
|
| |
|
| |
- if ( notxml ) {
|
| |
- // Fix name and attach hooks
|
| |
- name = jQuery.propFix[ name ] || name;
|
| |
- hooks = jQuery.propHooks[ name ];
|
| |
- }
|
| |
+ // Add matches to results
|
| |
+ push.apply( results, setMatched );
|
| |
|
| |
- if ( value !== undefined ) {
|
| |
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
| |
- return ret;
|
| |
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
|
| |
+ if ( outermost && !seed && setMatched.length > 0 &&
|
| |
+ ( matchedCount + setMatchers.length ) > 1 ) {
|
| |
|
| |
- } else {
|
| |
- return ( elem[ name ] = value );
|
| |
+ Sizzle.uniqueSort( results );
|
| |
+ }
|
| |
}
|
| |
|
| |
- } else {
|
| |
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
| |
- return ret;
|
| |
+ // Override manipulation of globals by nested matchers
|
| |
+ if ( outermost ) {
|
| |
+ dirruns = dirrunsUnique;
|
| |
+ outermostContext = contextBackup;
|
| |
+ }
|
| |
+
|
| |
+ return unmatched;
|
| |
+ };
|
| |
+
|
| |
+ return bySet ?
|
| |
+ markFunction( superMatcher ) :
|
| |
+ superMatcher;
|
| |
+ }
|
| |
|
| |
+ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
|
| |
+ var i,
|
| |
+ setMatchers = [],
|
| |
+ elementMatchers = [],
|
| |
+ cached = compilerCache[ selector + " " ];
|
| |
+
|
| |
+ if ( !cached ) {
|
| |
+ // Generate a function of recursive functions that can be used to check each element
|
| |
+ if ( !match ) {
|
| |
+ match = tokenize( selector );
|
| |
+ }
|
| |
+ i = match.length;
|
| |
+ while ( i-- ) {
|
| |
+ cached = matcherFromTokens( match[i] );
|
| |
+ if ( cached[ expando ] ) {
|
| |
+ setMatchers.push( cached );
|
| |
} else {
|
| |
- return elem[ name ];
|
| |
+ elementMatchers.push( cached );
|
| |
}
|
| |
}
|
| |
- },
|
| |
|
| |
- propHooks: {
|
| |
- tabIndex: {
|
| |
- get: function( elem ) {
|
| |
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
| |
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
| |
- var attributeNode = elem.getAttributeNode("tabindex");
|
| |
+ // Cache the compiled function
|
| |
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
|
| |
|
| |
- return attributeNode && attributeNode.specified ?
|
| |
- parseInt( attributeNode.value, 10 ) :
|
| |
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
| |
- 0 :
|
| |
- undefined;
|
| |
- }
|
| |
- }
|
| |
+ // Save selector and tokenization
|
| |
+ cached.selector = selector;
|
| |
}
|
| |
- });
|
| |
+ return cached;
|
| |
+ };
|
| |
|
| |
- // Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
|
| |
- jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
|
| |
+ /**
|
| |
+ * A low-level selection function that works with Sizzle's compiled
|
| |
+ * selector functions
|
| |
+ * @param {String|Function} selector A selector or a pre-compiled
|
| |
+ * selector function built with Sizzle.compile
|
| |
+ * @param {Element} context
|
| |
+ * @param {Array} [results]
|
| |
+ * @param {Array} [seed] A set of elements to match against
|
| |
+ */
|
| |
+ select = Sizzle.select = function( selector, context, results, seed ) {
|
| |
+ var i, tokens, token, type, find,
|
| |
+ compiled = typeof selector === "function" && selector,
|
| |
+ match = !seed && tokenize( (selector = compiled.selector || selector) );
|
| |
|
| |
- // Hook for boolean attributes
|
| |
- boolHook = {
|
| |
- get: function( elem, name ) {
|
| |
- // Align boolean attributes with corresponding properties
|
| |
- // Fall back to attribute presence where some booleans are not supported
|
| |
- var attrNode,
|
| |
- property = jQuery.prop( elem, name );
|
| |
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
|
| |
- name.toLowerCase() :
|
| |
- undefined;
|
| |
- },
|
| |
- set: function( elem, value, name ) {
|
| |
- var propName;
|
| |
- if ( value === false ) {
|
| |
- // Remove boolean attributes when set to false
|
| |
- jQuery.removeAttr( elem, name );
|
| |
- } else {
|
| |
- // value is true since we know at this point it's type boolean and not false
|
| |
- // Set boolean attributes to the same name and set the DOM property
|
| |
- propName = jQuery.propFix[ name ] || name;
|
| |
- if ( propName in elem ) {
|
| |
- // Only set the IDL specifically if it already exists on the element
|
| |
- elem[ propName ] = true;
|
| |
- }
|
| |
+ results = results || [];
|
| |
|
| |
- elem.setAttribute( name, name.toLowerCase() );
|
| |
- }
|
| |
- return name;
|
| |
- }
|
| |
- };
|
| |
+ // Try to minimize operations if there is only one selector in the list and no seed
|
| |
+ // (the latter of which guarantees us context)
|
| |
+ if ( match.length === 1 ) {
|
| |
|
| |
- // IE6/7 do not support getting/setting some attributes with get/setAttribute
|
| |
- if ( !getSetAttribute ) {
|
| |
+ // Reduce context if the leading compound selector is an ID
|
| |
+ tokens = match[0] = match[0].slice( 0 );
|
| |
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
|
| |
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
|
| |
|
| |
- fixSpecified = {
|
| |
- name: true,
|
| |
- id: true,
|
| |
- coords: true
|
| |
- };
|
| |
+ context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
|
| |
+ if ( !context ) {
|
| |
+ return results;
|
| |
|
| |
- // Use this for any attribute in IE6/7
|
| |
- // This fixes almost every IE6/7 issue
|
| |
- nodeHook = jQuery.valHooks.button = {
|
| |
- get: function( elem, name ) {
|
| |
- var ret;
|
| |
- ret = elem.getAttributeNode( name );
|
| |
- return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
|
| |
- ret.nodeValue :
|
| |
- undefined;
|
| |
- },
|
| |
- set: function( elem, value, name ) {
|
| |
- // Set the existing or create a new attribute node
|
| |
- var ret = elem.getAttributeNode( name );
|
| |
- if ( !ret ) {
|
| |
- ret = document.createAttribute( name );
|
| |
- elem.setAttributeNode( ret );
|
| |
+ // Precompiled matchers will still verify ancestry, so step up a level
|
| |
+ } else if ( compiled ) {
|
| |
+ context = context.parentNode;
|
| |
}
|
| |
- return ( ret.nodeValue = value + "" );
|
| |
+
|
| |
+ selector = selector.slice( tokens.shift().value.length );
|
| |
}
|
| |
- };
|
| |
|
| |
- // Apply the nodeHook to tabindex
|
| |
- jQuery.attrHooks.tabindex.set = nodeHook.set;
|
| |
+ // Fetch a seed set for right-to-left matching
|
| |
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
|
| |
+ while ( i-- ) {
|
| |
+ token = tokens[i];
|
| |
|
| |
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
| |
- // This is for removals
|
| |
- jQuery.each([ "width", "height" ], function( i, name ) {
|
| |
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
|
| |
- set: function( elem, value ) {
|
| |
- if ( value === "" ) {
|
| |
- elem.setAttribute( name, "auto" );
|
| |
- return value;
|
| |
- }
|
| |
+ // Abort if we hit a combinator
|
| |
+ if ( Expr.relative[ (type = token.type) ] ) {
|
| |
+ break;
|
| |
}
|
| |
- });
|
| |
- });
|
| |
+ if ( (find = Expr.find[ type ]) ) {
|
| |
+ // Search, expanding context for leading sibling combinators
|
| |
+ if ( (seed = find(
|
| |
+ token.matches[0].replace( runescape, funescape ),
|
| |
+ rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
|
| |
+ )) ) {
|
| |
+
|
| |
+ // If seed is empty or no tokens remain, we can return early
|
| |
+ tokens.splice( i, 1 );
|
| |
+ selector = seed.length && toSelector( tokens );
|
| |
+ if ( !selector ) {
|
| |
+ push.apply( results, seed );
|
| |
+ return results;
|
| |
+ }
|
| |
|
| |
- // Set contenteditable to false on removals(#10429)
|
| |
- // Setting to empty string throws an error as an invalid value
|
| |
- jQuery.attrHooks.contenteditable = {
|
| |
- get: nodeHook.get,
|
| |
- set: function( elem, value, name ) {
|
| |
- if ( value === "" ) {
|
| |
- value = "false";
|
| |
+ break;
|
| |
+ }
|
| |
}
|
| |
- nodeHook.set( elem, value, name );
|
| |
}
|
| |
- };
|
| |
- }
|
| |
+ }
|
| |
|
| |
+ // Compile and execute a filtering function if one is not provided
|
| |
+ // Provide `match` to avoid retokenization if we modified the selector above
|
| |
+ ( compiled || compile( selector, match ) )(
|
| |
+ seed,
|
| |
+ context,
|
| |
+ !documentIsHTML,
|
| |
+ results,
|
| |
+ !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
|
| |
+ );
|
| |
+ return results;
|
| |
+ };
|
| |
|
| |
- // Some attributes require a special call on IE
|
| |
- if ( !jQuery.support.hrefNormalized ) {
|
| |
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
|
| |
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
|
| |
- get: function( elem ) {
|
| |
- var ret = elem.getAttribute( name, 2 );
|
| |
- return ret === null ? undefined : ret;
|
| |
- }
|
| |
- });
|
| |
- });
|
| |
- }
|
| |
+ // One-time assignments
|
| |
|
| |
- if ( !jQuery.support.style ) {
|
| |
- jQuery.attrHooks.style = {
|
| |
- get: function( elem ) {
|
| |
- // Return undefined in the case of empty string
|
| |
- // Normalize to lowercase since IE uppercases css property names
|
| |
- return elem.style.cssText.toLowerCase() || undefined;
|
| |
- },
|
| |
- set: function( elem, value ) {
|
| |
- return ( elem.style.cssText = "" + value );
|
| |
- }
|
| |
- };
|
| |
- }
|
| |
+ // Sort stability
|
| |
+ support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
|
| |
|
| |
- // Safari mis-reports the default selected property of an option
|
| |
- // Accessing the parent's selectedIndex property fixes it
|
| |
- if ( !jQuery.support.optSelected ) {
|
| |
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
|
| |
- get: function( elem ) {
|
| |
- var parent = elem.parentNode;
|
| |
+ // Support: Chrome 14-35+
|
| |
+ // Always assume duplicates if they aren't passed to the comparison function
|
| |
+ support.detectDuplicates = !!hasDuplicate;
|
| |
|
| |
- if ( parent ) {
|
| |
- parent.selectedIndex;
|
| |
+ // Initialize against the default document
|
| |
+ setDocument();
|
| |
|
| |
- // Make sure that it also works with optgroups, see #5701
|
| |
- if ( parent.parentNode ) {
|
| |
- parent.parentNode.selectedIndex;
|
| |
- }
|
| |
- }
|
| |
- return null;
|
| |
+ // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
|
| |
+ // Detached nodes confoundingly follow *each other*
|
| |
+ support.sortDetached = assert(function( el ) {
|
| |
+ // Should return 1, but returns 4 (following)
|
| |
+ return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
|
| |
+ });
|
| |
+
|
| |
+ // Support: IE<8
|
| |
+ // Prevent attribute/property "interpolation"
|
| |
+ // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
| |
+ if ( !assert(function( el ) {
|
| |
+ el.innerHTML = "<a href='#'></a>";
|
| |
+ return el.firstChild.getAttribute("href") === "#" ;
|
| |
+ }) ) {
|
| |
+ addHandle( "type|href|height|width", function( elem, name, isXML ) {
|
| |
+ if ( !isXML ) {
|
| |
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
|
| |
}
|
| |
});
|
| |
}
|
| |
|
| |
- // IE6/7 call enctype encoding
|
| |
- if ( !jQuery.support.enctype ) {
|
| |
- jQuery.propFix.enctype = "encoding";
|
| |
- }
|
| |
-
|
| |
- // Radios and checkboxes getter/setter
|
| |
- if ( !jQuery.support.checkOn ) {
|
| |
- jQuery.each([ "radio", "checkbox" ], function() {
|
| |
- jQuery.valHooks[ this ] = {
|
| |
- get: function( elem ) {
|
| |
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
|
| |
- return elem.getAttribute("value") === null ? "on" : elem.value;
|
| |
- }
|
| |
- };
|
| |
+ // Support: IE<9
|
| |
+ // Use defaultValue in place of getAttribute("value")
|
| |
+ if ( !support.attributes || !assert(function( el ) {
|
| |
+ el.innerHTML = "<input/>";
|
| |
+ el.firstChild.setAttribute( "value", "" );
|
| |
+ return el.firstChild.getAttribute( "value" ) === "";
|
| |
+ }) ) {
|
| |
+ addHandle( "value", function( elem, name, isXML ) {
|
| |
+ if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
|
| |
+ return elem.defaultValue;
|
| |
+ }
|
| |
});
|
| |
}
|
| |
- jQuery.each([ "radio", "checkbox" ], function() {
|
| |
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
|
| |
- set: function( elem, value ) {
|
| |
- if ( jQuery.isArray( value ) ) {
|
| |
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
|
| |
- }
|
| |
+
|
| |
+ // Support: IE<9
|
| |
+ // Use getAttributeNode to fetch booleans when getAttribute lies
|
| |
+ if ( !assert(function( el ) {
|
| |
+ return el.getAttribute("disabled") == null;
|
| |
+ }) ) {
|
| |
+ addHandle( booleans, function( elem, name, isXML ) {
|
| |
+ var val;
|
| |
+ if ( !isXML ) {
|
| |
+ return elem[ name ] === true ? name.toLowerCase() :
|
| |
+ (val = elem.getAttributeNode( name )) && val.specified ?
|
| |
+ val.value :
|
| |
+ null;
|
| |
}
|
| |
});
|
| |
- });
|
| |
+ }
|
| |
|
| |
+ return Sizzle;
|
| |
|
| |
+ })( window );
|
| |
|
| |
|
| |
- var rformElems = /^(?:textarea|input|select)$/i,
|
| |
- rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
|
| |
- rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
|
| |
- rkeyEvent = /^key/,
|
| |
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
|
| |
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
| |
- rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
|
| |
- quickParse = function( selector ) {
|
| |
- var quick = rquickIs.exec( selector );
|
| |
- if ( quick ) {
|
| |
- // 0 1 2 3
|
| |
- // [ _, tag, id, class ]
|
| |
- quick[1] = ( quick[1] || "" ).toLowerCase();
|
| |
- quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
|
| |
- }
|
| |
- return quick;
|
| |
- },
|
| |
- quickIs = function( elem, m ) {
|
| |
- var attrs = elem.attributes || {};
|
| |
- return (
|
| |
- (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
|
| |
- (!m[2] || (attrs.id || {}).value === m[2]) &&
|
| |
- (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
|
| |
- );
|
| |
- },
|
| |
- hoverHack = function( events ) {
|
| |
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
|
| |
- };
|
| |
|
| |
- /*
|
| |
- * Helper functions for managing events -- not part of the public interface.
|
| |
- * Props to Dean Edwards' addEvent library for many of the ideas.
|
| |
- */
|
| |
- jQuery.event = {
|
| |
+ jQuery.find = Sizzle;
|
| |
+ jQuery.expr = Sizzle.selectors;
|
| |
|
| |
- add: function( elem, types, handler, data, selector ) {
|
| |
+ // Deprecated
|
| |
+ jQuery.expr[ ":" ] = jQuery.expr.pseudos;
|
| |
+ jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
|
| |
+ jQuery.text = Sizzle.getText;
|
| |
+ jQuery.isXMLDoc = Sizzle.isXML;
|
| |
+ jQuery.contains = Sizzle.contains;
|
| |
+ jQuery.escapeSelector = Sizzle.escape;
|
| |
|
| |
- var elemData, eventHandle, events,
|
| |
- t, tns, type, namespaces, handleObj,
|
| |
- handleObjIn, quick, handlers, special;
|
| |
|
| |
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
|
| |
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
|
| |
- return;
|
| |
- }
|
| |
|
| |
- // Caller can pass in an object of custom data in lieu of the handler
|
| |
- if ( handler.handler ) {
|
| |
- handleObjIn = handler;
|
| |
- handler = handleObjIn.handler;
|
| |
- selector = handleObjIn.selector;
|
| |
- }
|
| |
|
| |
- // Make sure that the handler has a unique ID, used to find/remove it later
|
| |
- if ( !handler.guid ) {
|
| |
- handler.guid = jQuery.guid++;
|
| |
- }
|
| |
+ var dir = function( elem, dir, until ) {
|
| |
+ var matched = [],
|
| |
+ truncate = until !== undefined;
|
| |
|
| |
- // Init the element's event structure and main handler, if this is the first
|
| |
- events = elemData.events;
|
| |
- if ( !events ) {
|
| |
- elemData.events = events = {};
|
| |
+ while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
|
| |
+ if ( elem.nodeType === 1 ) {
|
| |
+ if ( truncate && jQuery( elem ).is( until ) ) {
|
| |
+ break;
|
| |
+ }
|
| |
+ matched.push( elem );
|
| |
}
|
| |
- eventHandle = elemData.handle;
|
| |
- if ( !eventHandle ) {
|
| |
- elemData.handle = eventHandle = function( e ) {
|
| |
- // Discard the second event of a jQuery.event.trigger() and
|
| |
- // when an event is called after a page has unloaded
|
| |
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
|
| |
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
|
| |
- undefined;
|
| |
- };
|
| |
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
|
| |
- eventHandle.elem = elem;
|
| |
+ }
|
| |
+ return matched;
|
| |
+ };
|
| |
+
|
| |
+
|
| |
+ var siblings = function( n, elem ) {
|
| |
+ var matched = [];
|
| |
+
|
| |
+ for ( ; n; n = n.nextSibling ) {
|
| |
+ if ( n.nodeType === 1 && n !== elem ) {
|
| |
+ matched.push( n );
|
| |
}
|
| |
+ }
|
| |
|
| |
- // Handle multiple events separated by a space
|
| |
- // jQuery(...).bind("mouseover mouseout", fn);
|
| |
- types = jQuery.trim( hoverHack(types) ).split( " " );
|
| |
- for ( t = 0; t < types.length; t++ ) {
|
| |
+ return matched;
|
| |
+ };
|
| |
|
| |
- tns = rtypenamespace.exec( types[t] ) || [];
|
| |
- type = tns[1];
|
| |
- namespaces = ( tns[2] || "" ).split( "." ).sort();
|
| |
|
| |
- // If event changes its type, use the special event handlers for the changed type
|
| |
- special = jQuery.event.special[ type ] || {};
|
| |
+ var rneedsContext = jQuery.expr.match.needsContext;
|
| |
|
| |
- // If selector defined, determine special event api type, otherwise given type
|
| |
- type = ( selector ? special.delegateType : special.bindType ) || type;
|
| |
|
| |
- // Update special based on newly reset type
|
| |
- special = jQuery.event.special[ type ] || {};
|
| |
|
| |
- // handleObj is passed to all event handlers
|
| |
- handleObj = jQuery.extend({
|
| |
- type: type,
|
| |
- origType: tns[1],
|
| |
- data: data,
|
| |
- handler: handler,
|
| |
- guid: handler.guid,
|
| |
- selector: selector,
|
| |
- quick: selector && quickParse( selector ),
|
| |
- namespace: namespaces.join(".")
|
| |
- }, handleObjIn );
|
| |
-
|
| |
- // Init the event handler queue if we're the first
|
| |
- handlers = events[ type ];
|
| |
- if ( !handlers ) {
|
| |
- handlers = events[ type ] = [];
|
| |
- handlers.delegateCount = 0;
|
| |
-
|
| |
- // Only use addEventListener/attachEvent if the special events handler returns false
|
| |
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
| |
- // Bind the global event handler to the element
|
| |
- if ( elem.addEventListener ) {
|
| |
- elem.addEventListener( type, eventHandle, false );
|
| |
-
|
| |
- } else if ( elem.attachEvent ) {
|
| |
- elem.attachEvent( "on" + type, eventHandle );
|
| |
- }
|
| |
- }
|
| |
- }
|
| |
+ function nodeName( elem, name ) {
|
| |
|
| |
- if ( special.add ) {
|
| |
- special.add.call( elem, handleObj );
|
| |
-
|
| |
- if ( !handleObj.handler.guid ) {
|
| |
- handleObj.handler.guid = handler.guid;
|
| |
- }
|
| |
- }
|
| |
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
| |
|
| |
- // Add to the element's handler list, delegates in front
|
| |
- if ( selector ) {
|
| |
- handlers.splice( handlers.delegateCount++, 0, handleObj );
|
| |
- } else {
|
| |
- handlers.push( handleObj );
|
| |
- }
|
| |
+ };
|
| |
+ var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
|
| |
|
| |
- // Keep track of which events have ever been used, for event optimization
|
| |
- jQuery.event.global[ type ] = true;
|
| |
- }
|
| |
|
| |
- // Nullify elem to prevent memory leaks in IE
|
| |
- elem = null;
|
| |
- },
|
| |
|
| |
- global: {},
|
| |
+ // Implement the identical functionality for filter and not
|
| |
+ function winnow( elements, qualifier, not ) {
|
| |
+ if ( isFunction( qualifier ) ) {
|
| |
+ return jQuery.grep( elements, function( elem, i ) {
|
| |
+ return !!qualifier.call( elem, i, elem ) !== not;
|
| |
+ } );
|
| |
+ }
|
| |
|
| |
- // Detach an event or set of events from an element
|
| |
- remove: function( elem, types, handler, selector, mappedTypes ) {
|
| |
+ // Single element
|
| |
+ if ( qualifier.nodeType ) {
|
| |
+ return jQuery.grep( elements, function( elem ) {
|
| |
+ return ( elem === qualifier ) !== not;
|
| |
+ } );
|
| |
+ }
|
| |
|
| |
- var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
|
| |
- t, tns, type, origType, namespaces, origCount,
|
| |
- j, events, special, handle, eventType, handleObj;
|
| |
+ // Arraylike of elements (jQuery, arguments, Array)
|
| |
+ if ( typeof qualifier !== "string" ) {
|
| |
+ return jQuery.grep( elements, function( elem ) {
|
| |
+ return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
|
| |
+ } );
|
| |
+ }
|
| |
|
| |
- if ( !elemData || !(events = elemData.events) ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Filtered directly for both simple and complex selectors
|
| |
+ return jQuery.filter( qualifier, elements, not );
|
| |
+ }
|
| |
|
| |
- // Once for each type.namespace in types; type may be omitted
|
| |
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
|
| |
- for ( t = 0; t < types.length; t++ ) {
|
| |
- tns = rtypenamespace.exec( types[t] ) || [];
|
| |
- type = origType = tns[1];
|
| |
- namespaces = tns[2];
|
| |
+ jQuery.filter = function( expr, elems, not ) {
|
| |
+ var elem = elems[ 0 ];
|
| |
|
| |
- // Unbind all events (on this namespace, if provided) for the element
|
| |
- if ( !type ) {
|
| |
- for ( type in events ) {
|
| |
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
|
| |
- }
|
| |
- continue;
|
| |
- }
|
| |
+ if ( not ) {
|
| |
+ expr = ":not(" + expr + ")";
|
| |
+ }
|
| |
|
| |
- special = jQuery.event.special[ type ] || {};
|
| |
- type = ( selector? special.delegateType : special.bindType ) || type;
|
| |
- eventType = events[ type ] || [];
|
| |
- origCount = eventType.length;
|
| |
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
|
| |
+ if ( elems.length === 1 && elem.nodeType === 1 ) {
|
| |
+ return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
|
| |
+ }
|
| |
|
| |
- // Remove matching events
|
| |
- for ( j = 0; j < eventType.length; j++ ) {
|
| |
- handleObj = eventType[ j ];
|
| |
+ return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
|
| |
+ return elem.nodeType === 1;
|
| |
+ } ) );
|
| |
+ };
|
| |
|
| |
- if ( ( mappedTypes || origType === handleObj.origType ) &&
|
| |
- ( !handler || handler.guid === handleObj.guid ) &&
|
| |
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
|
| |
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
|
| |
- eventType.splice( j--, 1 );
|
| |
+ jQuery.fn.extend( {
|
| |
+ find: function( selector ) {
|
| |
+ var i, ret,
|
| |
+ len = this.length,
|
| |
+ self = this;
|
| |
|
| |
- if ( handleObj.selector ) {
|
| |
- eventType.delegateCount--;
|
| |
- }
|
| |
- if ( special.remove ) {
|
| |
- special.remove.call( elem, handleObj );
|
| |
+ if ( typeof selector !== "string" ) {
|
| |
+ return this.pushStack( jQuery( selector ).filter( function() {
|
| |
+ for ( i = 0; i < len; i++ ) {
|
| |
+ if ( jQuery.contains( self[ i ], this ) ) {
|
| |
+ return true;
|
| |
}
|
| |
}
|
| |
- }
|
| |
-
|
| |
- // Remove generic event handler if we removed something and no more handlers exist
|
| |
- // (avoids potential for endless recursion during removal of special event handlers)
|
| |
- if ( eventType.length === 0 && origCount !== eventType.length ) {
|
| |
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
|
| |
- jQuery.removeEvent( elem, type, elemData.handle );
|
| |
- }
|
| |
-
|
| |
- delete events[ type ];
|
| |
- }
|
| |
+ } ) );
|
| |
}
|
| |
|
| |
- // Remove the expando if it's no longer used
|
| |
- if ( jQuery.isEmptyObject( events ) ) {
|
| |
- handle = elemData.handle;
|
| |
- if ( handle ) {
|
| |
- handle.elem = null;
|
| |
- }
|
| |
+ ret = this.pushStack( [] );
|
| |
|
| |
- // removeData also checks for emptiness and clears the expando if empty
|
| |
- // so use it instead of delete
|
| |
- jQuery.removeData( elem, [ "events", "handle" ], true );
|
| |
+ for ( i = 0; i < len; i++ ) {
|
| |
+ jQuery.find( selector, self[ i ], ret );
|
| |
}
|
| |
- },
|
| |
|
| |
- // Events that are safe to short-circuit if no handlers are attached.
|
| |
- // Native DOM events should not be added, they may have inline handlers.
|
| |
- customEvent: {
|
| |
- "getData": true,
|
| |
- "setData": true,
|
| |
- "changeData": true
|
| |
+ return len > 1 ? jQuery.uniqueSort( ret ) : ret;
|
| |
},
|
| |
+ filter: function( selector ) {
|
| |
+ return this.pushStack( winnow( this, selector || [], false ) );
|
| |
+ },
|
| |
+ not: function( selector ) {
|
| |
+ return this.pushStack( winnow( this, selector || [], true ) );
|
| |
+ },
|
| |
+ is: function( selector ) {
|
| |
+ return !!winnow(
|
| |
+ this,
|
| |
+
|
| |
+ // If this is a positional/relative selector, check membership in the returned set
|
| |
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
|
| |
+ typeof selector === "string" && rneedsContext.test( selector ) ?
|
| |
+ jQuery( selector ) :
|
| |
+ selector || [],
|
| |
+ false
|
| |
+ ).length;
|
| |
+ }
|
| |
+ } );
|
| |
|
| |
- trigger: function( event, data, elem, onlyHandlers ) {
|
| |
- // Don't do events on text and comment nodes
|
| |
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
|
| |
- return;
|
| |
- }
|
| |
-
|
| |
- // Event object or event type
|
| |
- var type = event.type || event,
|
| |
- namespaces = [],
|
| |
- cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
|
| |
-
|
| |
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
|
| |
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
|
| |
- return;
|
| |
- }
|
| |
-
|
| |
- if ( type.indexOf( "!" ) >= 0 ) {
|
| |
- // Exclusive events trigger only for the exact event (no namespaces)
|
| |
- type = type.slice(0, -1);
|
| |
- exclusive = true;
|
| |
- }
|
| |
-
|
| |
- if ( type.indexOf( "." ) >= 0 ) {
|
| |
- // Namespaced trigger; create a regexp to match event type in handle()
|
| |
- namespaces = type.split(".");
|
| |
- type = namespaces.shift();
|
| |
- namespaces.sort();
|
| |
- }
|
| |
|
| |
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
|
| |
- // No jQuery handlers for this event type, and it can't have inline handlers
|
| |
- return;
|
| |
- }
|
| |
+ // Initialize a jQuery object
|
| |
|
| |
- // Caller can pass in an Event, Object, or just an event type string
|
| |
- event = typeof event === "object" ?
|
| |
- // jQuery.Event object
|
| |
- event[ jQuery.expando ] ? event :
|
| |
- // Object literal
|
| |
- new jQuery.Event( type, event ) :
|
| |
- // Just the event type (string)
|
| |
- new jQuery.Event( type );
|
| |
|
| |
- event.type = type;
|
| |
- event.isTrigger = true;
|
| |
- event.exclusive = exclusive;
|
| |
- event.namespace = namespaces.join( "." );
|
| |
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
|
| |
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
|
| |
+ // A central reference to the root jQuery(document)
|
| |
+ var rootjQuery,
|
| |
|
| |
- // Handle a global trigger
|
| |
- if ( !elem ) {
|
| |
+ // A simple way to check for HTML strings
|
| |
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
| |
+ // Strict HTML recognition (#11290: must start with <)
|
| |
+ // Shortcut simple #id case for speed
|
| |
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
|
| |
|
| |
- // TODO: Stop taunting the data cache; remove global events and always attach to document
|
| |
- cache = jQuery.cache;
|
| |
- for ( i in cache ) {
|
| |
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
|
| |
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
|
| |
- }
|
| |
- }
|
| |
- return;
|
| |
- }
|
| |
+ init = jQuery.fn.init = function( selector, context, root ) {
|
| |
+ var match, elem;
|
| |
|
| |
- // Clean up the event in case it is being reused
|
| |
- event.result = undefined;
|
| |
- if ( !event.target ) {
|
| |
- event.target = elem;
|
| |
+ // HANDLE: $(""), $(null), $(undefined), $(false)
|
| |
+ if ( !selector ) {
|
| |
+ return this;
|
| |
}
|
| |
|
| |
- // Clone any incoming data and prepend the event, creating the handler arg list
|
| |
- data = data != null ? jQuery.makeArray( data ) : [];
|
| |
- data.unshift( event );
|
| |
-
|
| |
- // Allow special events to draw outside the lines
|
| |
- special = jQuery.event.special[ type ] || {};
|
| |
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Method init() accepts an alternate rootjQuery
|
| |
+ // so migrate can support jQuery.sub (gh-2101)
|
| |
+ root = root || rootjQuery;
|
| |
|
| |
- // Determine event propagation path in advance, per W3C events spec (#9951)
|
| |
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
| |
- eventPath = [[ elem, special.bindType || type ]];
|
| |
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
|
| |
+ // Handle HTML strings
|
| |
+ if ( typeof selector === "string" ) {
|
| |
+ if ( selector[ 0 ] === "<" &&
|
| |
+ selector[ selector.length - 1 ] === ">" &&
|
| |
+ selector.length >= 3 ) {
|
| |
|
| |
- bubbleType = special.delegateType || type;
|
| |
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
|
| |
- old = null;
|
| |
- for ( ; cur; cur = cur.parentNode ) {
|
| |
- eventPath.push([ cur, bubbleType ]);
|
| |
- old = cur;
|
| |
- }
|
| |
+ // Assume that strings that start and end with <> are HTML and skip the regex check
|
| |
+ match = [ null, selector, null ];
|
| |
|
| |
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
|
| |
- if ( old && old === elem.ownerDocument ) {
|
| |
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
|
| |
+ } else {
|
| |
+ match = rquickExpr.exec( selector );
|
| |
}
|
| |
- }
|
| |
|
| |
- // Fire handlers on the event path
|
| |
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
|
| |
-
|
| |
- cur = eventPath[i][0];
|
| |
- event.type = eventPath[i][1];
|
| |
-
|
| |
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
|
| |
- if ( handle ) {
|
| |
- handle.apply( cur, data );
|
| |
- }
|
| |
- // Note that this is a bare JS function and not a jQuery handler
|
| |
- handle = ontype && cur[ ontype ];
|
| |
- if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
|
| |
- event.preventDefault();
|
| |
- }
|
| |
- }
|
| |
- event.type = type;
|
| |
+ // Match html or make sure no context is specified for #id
|
| |
+ if ( match && ( match[ 1 ] || !context ) ) {
|
| |
|
| |
- // If nobody prevented the default action, do it now
|
| |
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
|
| |
+ // HANDLE: $(html) -> $(array)
|
| |
+ if ( match[ 1 ] ) {
|
| |
+ context = context instanceof jQuery ? context[ 0 ] : context;
|
| |
+
|
| |
+ // Option to run scripts is true for back-compat
|
| |
+ // Intentionally let the error be thrown if parseHTML is not present
|
| |
+ jQuery.merge( this, jQuery.parseHTML(
|
| |
+ match[ 1 ],
|
| |
+ context && context.nodeType ? context.ownerDocument || context : document,
|
| |
+ true
|
| |
+ ) );
|
| |
+
|
| |
+ // HANDLE: $(html, props)
|
| |
+ if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
|
| |
+ for ( match in context ) {
|
| |
+
|
| |
+ // Properties of context are called as methods if possible
|
| |
+ if ( isFunction( this[ match ] ) ) {
|
| |
+ this[ match ]( context[ match ] );
|
| |
+
|
| |
+ // ...and otherwise set as attributes
|
| |
+ } else {
|
| |
+ this.attr( match, context[ match ] );
|
| |
+ }
|
| |
+ }
|
| |
+ }
|
| |
|
| |
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
|
| |
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
|
| |
+ return this;
|
| |
|
| |
- // Call a native DOM method on the target with the same name name as the event.
|
| |
- // Can't use an .isFunction() check here because IE6/7 fails that test.
|
| |
- // Don't do default actions on window, that's where global variables be (#6170)
|
| |
- // IE<9 dies on focus/blur to hidden element (#1486)
|
| |
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
|
| |
+ // HANDLE: $(#id)
|
| |
+ } else {
|
| |
+ elem = document.getElementById( match[ 2 ] );
|
| |
|
| |
- // Don't re-trigger an onFOO event when we call its FOO() method
|
| |
- old = elem[ ontype ];
|
| |
+ if ( elem ) {
|
| |
|
| |
- if ( old ) {
|
| |
- elem[ ontype ] = null;
|
| |
+ // Inject the element directly into the jQuery object
|
| |
+ this[ 0 ] = elem;
|
| |
+ this.length = 1;
|
| |
}
|
| |
+ return this;
|
| |
+ }
|
| |
|
| |
- // Prevent re-triggering of the same event, since we already bubbled it above
|
| |
- jQuery.event.triggered = type;
|
| |
- elem[ type ]();
|
| |
- jQuery.event.triggered = undefined;
|
| |
+ // HANDLE: $(expr, $(...))
|
| |
+ } else if ( !context || context.jquery ) {
|
| |
+ return ( context || root ).find( selector );
|
| |
|
| |
- if ( old ) {
|
| |
- elem[ ontype ] = old;
|
| |
- }
|
| |
- }
|
| |
+ // HANDLE: $(expr, context)
|
| |
+ // (which is just equivalent to: $(context).find(expr)
|
| |
+ } else {
|
| |
+ return this.constructor( context ).find( selector );
|
| |
}
|
| |
- }
|
| |
|
| |
- return event.result;
|
| |
- },
|
| |
+ // HANDLE: $(DOMElement)
|
| |
+ } else if ( selector.nodeType ) {
|
| |
+ this[ 0 ] = selector;
|
| |
+ this.length = 1;
|
| |
+ return this;
|
| |
|
| |
- dispatch: function( event ) {
|
| |
+ // HANDLE: $(function)
|
| |
+ // Shortcut for document ready
|
| |
+ } else if ( isFunction( selector ) ) {
|
| |
+ return root.ready !== undefined ?
|
| |
+ root.ready( selector ) :
|
| |
|
| |
- // Make a writable jQuery.Event from the native event object
|
| |
- event = jQuery.event.fix( event || window.event );
|
| |
+ // Execute immediately if ready is not present
|
| |
+ selector( jQuery );
|
| |
+ }
|
| |
|
| |
- var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
|
| |
- delegateCount = handlers.delegateCount,
|
| |
- args = [].slice.call( arguments, 0 ),
|
| |
- run_all = !event.exclusive && !event.namespace,
|
| |
- special = jQuery.event.special[ event.type ] || {},
|
| |
- handlerQueue = [],
|
| |
- i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
|
| |
+ return jQuery.makeArray( selector, this );
|
| |
+ };
|
| |
|
| |
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
|
| |
- args[0] = event;
|
| |
- event.delegateTarget = this;
|
| |
+ // Give the init function the jQuery prototype for later instantiation
|
| |
+ init.prototype = jQuery.fn;
|
| |
|
| |
- // Call the preDispatch hook for the mapped type, and let it bail if desired
|
| |
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Initialize central reference
|
| |
+ rootjQuery = jQuery( document );
|
| |
|
| |
- // Determine handlers that should run if there are delegated events
|
| |
- // Avoid non-left-click bubbling in Firefox (#3861)
|
| |
- if ( delegateCount && !(event.button && event.type === "click") ) {
|
| |
|
| |
- // Pregenerate a single jQuery object for reuse with .is()
|
| |
- jqcur = jQuery(this);
|
| |
- jqcur.context = this.ownerDocument || this;
|
| |
+ var rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
| |
|
| |
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
|
| |
+ // Methods guaranteed to produce a unique set when starting from a unique set
|
| |
+ guaranteedUnique = {
|
| |
+ children: true,
|
| |
+ contents: true,
|
| |
+ next: true,
|
| |
+ prev: true
|
| |
+ };
|
| |
|
| |
- // Don't process events on disabled elements (#6911, #8165)
|
| |
- if ( cur.disabled !== true ) {
|
| |
- selMatch = {};
|
| |
- matches = [];
|
| |
- jqcur[0] = cur;
|
| |
- for ( i = 0; i < delegateCount; i++ ) {
|
| |
- handleObj = handlers[ i ];
|
| |
- sel = handleObj.selector;
|
| |
+ jQuery.fn.extend( {
|
| |
+ has: function( target ) {
|
| |
+ var targets = jQuery( target, this ),
|
| |
+ l = targets.length;
|
| |
|
| |
- if ( selMatch[ sel ] === undefined ) {
|
| |
- selMatch[ sel ] = (
|
| |
- handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
|
| |
- );
|
| |
- }
|
| |
- if ( selMatch[ sel ] ) {
|
| |
- matches.push( handleObj );
|
| |
- }
|
| |
- }
|
| |
- if ( matches.length ) {
|
| |
- handlerQueue.push({ elem: cur, matches: matches });
|
| |
- }
|
| |
+ return this.filter( function() {
|
| |
+ var i = 0;
|
| |
+ for ( ; i < l; i++ ) {
|
| |
+ if ( jQuery.contains( this, targets[ i ] ) ) {
|
| |
+ return true;
|
| |
}
|
| |
}
|
| |
- }
|
| |
-
|
| |
- // Add the remaining (directly-bound) handlers
|
| |
- if ( handlers.length > delegateCount ) {
|
| |
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
|
| |
- }
|
| |
-
|
| |
- // Run delegates first; they may want to stop propagation beneath us
|
| |
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
|
| |
- matched = handlerQueue[ i ];
|
| |
- event.currentTarget = matched.elem;
|
| |
+ } );
|
| |
+ },
|
| |
|
| |
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
|
| |
- handleObj = matched.matches[ j ];
|
| |
+ closest: function( selectors, context ) {
|
| |
+ var cur,
|
| |
+ i = 0,
|
| |
+ l = this.length,
|
| |
+ matched = [],
|
| |
+ targets = typeof selectors !== "string" && jQuery( selectors );
|
| |
|
| |
- // Triggered event must either 1) be non-exclusive and have no namespace, or
|
| |
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
|
| |
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
|
| |
+ // Positional selectors never match, since there's no _selection_ context
|
| |
+ if ( !rneedsContext.test( selectors ) ) {
|
| |
+ for ( ; i < l; i++ ) {
|
| |
+ for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
|
| |
|
| |
- event.data = handleObj.data;
|
| |
- event.handleObj = handleObj;
|
| |
+ // Always skip document fragments
|
| |
+ if ( cur.nodeType < 11 && ( targets ?
|
| |
+ targets.index( cur ) > -1 :
|
| |
|
| |
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
|
| |
- .apply( matched.elem, args );
|
| |
+ // Don't pass non-elements to Sizzle
|
| |
+ cur.nodeType === 1 &&
|
| |
+ jQuery.find.matchesSelector( cur, selectors ) ) ) {
|
| |
|
| |
- if ( ret !== undefined ) {
|
| |
- event.result = ret;
|
| |
- if ( ret === false ) {
|
| |
- event.preventDefault();
|
| |
- event.stopPropagation();
|
| |
- }
|
| |
+ matched.push( cur );
|
| |
+ break;
|
| |
}
|
| |
}
|
| |
}
|
| |
}
|
| |
|
| |
- // Call the postDispatch hook for the mapped type
|
| |
- if ( special.postDispatch ) {
|
| |
- special.postDispatch.call( this, event );
|
| |
- }
|
| |
-
|
| |
- return event.result;
|
| |
+ return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
|
| |
},
|
| |
|
| |
- // Includes some event props shared by KeyEvent and MouseEvent
|
| |
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
|
| |
- props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
|
| |
-
|
| |
- fixHooks: {},
|
| |
-
|
| |
- keyHooks: {
|
| |
- props: "char charCode key keyCode".split(" "),
|
| |
- filter: function( event, original ) {
|
| |
+ // Determine the position of an element within the set
|
| |
+ index: function( elem ) {
|
| |
|
| |
- // Add which for key events
|
| |
- if ( event.which == null ) {
|
| |
- event.which = original.charCode != null ? original.charCode : original.keyCode;
|
| |
- }
|
| |
+ // No argument, return index in parent
|
| |
+ if ( !elem ) {
|
| |
+ return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
|
| |
+ }
|
| |
|
| |
- return event;
|
| |
+ // Index in selector
|
| |
+ if ( typeof elem === "string" ) {
|
| |
+ return indexOf.call( jQuery( elem ), this[ 0 ] );
|
| |
}
|
| |
- },
|
| |
|
| |
- mouseHooks: {
|
| |
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
|
| |
- filter: function( event, original ) {
|
| |
- var eventDoc, doc, body,
|
| |
- button = original.button,
|
| |
- fromElement = original.fromElement;
|
| |
+ // Locate the position of the desired element
|
| |
+ return indexOf.call( this,
|
| |
|
| |
- // Calculate pageX/Y if missing and clientX/Y available
|
| |
- if ( event.pageX == null && original.clientX != null ) {
|
| |
- eventDoc = event.target.ownerDocument || document;
|
| |
- doc = eventDoc.documentElement;
|
| |
- body = eventDoc.body;
|
| |
+ // If it receives a jQuery object, the first element is used
|
| |
+ elem.jquery ? elem[ 0 ] : elem
|
| |
+ );
|
| |
+ },
|
| |
|
| |
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
|
| |
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
|
| |
- }
|
| |
+ add: function( selector, context ) {
|
| |
+ return this.pushStack(
|
| |
+ jQuery.uniqueSort(
|
| |
+ jQuery.merge( this.get(), jQuery( selector, context ) )
|
| |
+ )
|
| |
+ );
|
| |
+ },
|
| |
|
| |
- // Add relatedTarget, if necessary
|
| |
- if ( !event.relatedTarget && fromElement ) {
|
| |
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
|
| |
- }
|
| |
+ addBack: function( selector ) {
|
| |
+ return this.add( selector == null ?
|
| |
+ this.prevObject : this.prevObject.filter( selector )
|
| |
+ );
|
| |
+ }
|
| |
+ } );
|
| |
|
| |
- // Add which for click: 1 === left; 2 === middle; 3 === right
|
| |
- // Note: button is not normalized, so don't use it
|
| |
- if ( !event.which && button !== undefined ) {
|
| |
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
| |
- }
|
| |
+ function sibling( cur, dir ) {
|
| |
+ while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
|
| |
+ return cur;
|
| |
+ }
|
| |
|
| |
- return event;
|
| |
- }
|
| |
+ jQuery.each( {
|
| |
+ parent: function( elem ) {
|
| |
+ var parent = elem.parentNode;
|
| |
+ return parent && parent.nodeType !== 11 ? parent : null;
|
| |
},
|
| |
+ parents: function( elem ) {
|
| |
+ return dir( elem, "parentNode" );
|
| |
+ },
|
| |
+ parentsUntil: function( elem, i, until ) {
|
| |
+ return dir( elem, "parentNode", until );
|
| |
+ },
|
| |
+ next: function( elem ) {
|
| |
+ return sibling( elem, "nextSibling" );
|
| |
+ },
|
| |
+ prev: function( elem ) {
|
| |
+ return sibling( elem, "previousSibling" );
|
| |
+ },
|
| |
+ nextAll: function( elem ) {
|
| |
+ return dir( elem, "nextSibling" );
|
| |
+ },
|
| |
+ prevAll: function( elem ) {
|
| |
+ return dir( elem, "previousSibling" );
|
| |
+ },
|
| |
+ nextUntil: function( elem, i, until ) {
|
| |
+ return dir( elem, "nextSibling", until );
|
| |
+ },
|
| |
+ prevUntil: function( elem, i, until ) {
|
| |
+ return dir( elem, "previousSibling", until );
|
| |
+ },
|
| |
+ siblings: function( elem ) {
|
| |
+ return siblings( ( elem.parentNode || {} ).firstChild, elem );
|
| |
+ },
|
| |
+ children: function( elem ) {
|
| |
+ return siblings( elem.firstChild );
|
| |
+ },
|
| |
+ contents: function( elem ) {
|
| |
+ if ( nodeName( elem, "iframe" ) ) {
|
| |
+ return elem.contentDocument;
|
| |
+ }
|
| |
+
|
| |
+ // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
|
| |
+ // Treat the template element as a regular one in browsers that
|
| |
+ // don't support it.
|
| |
+ if ( nodeName( elem, "template" ) ) {
|
| |
+ elem = elem.content || elem;
|
| |
+ }
|
| |
+
|
| |
+ return jQuery.merge( [], elem.childNodes );
|
| |
+ }
|
| |
+ }, function( name, fn ) {
|
| |
+ jQuery.fn[ name ] = function( until, selector ) {
|
| |
+ var matched = jQuery.map( this, fn, until );
|
| |
|
| |
- fix: function( event ) {
|
| |
- if ( event[ jQuery.expando ] ) {
|
| |
- return event;
|
| |
- }
|
| |
-
|
| |
- // Create a writable copy of the event object and normalize some properties
|
| |
- var i, prop,
|
| |
- originalEvent = event,
|
| |
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
|
| |
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
|
| |
-
|
| |
- event = jQuery.Event( originalEvent );
|
| |
-
|
| |
- for ( i = copy.length; i; ) {
|
| |
- prop = copy[ --i ];
|
| |
- event[ prop ] = originalEvent[ prop ];
|
| |
- }
|
| |
-
|
| |
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
|
| |
- if ( !event.target ) {
|
| |
- event.target = originalEvent.srcElement || document;
|
| |
- }
|
| |
-
|
| |
- // Target should not be a text node (#504, Safari)
|
| |
- if ( event.target.nodeType === 3 ) {
|
| |
- event.target = event.target.parentNode;
|
| |
+ if ( name.slice( -5 ) !== "Until" ) {
|
| |
+ selector = until;
|
| |
}
|
| |
|
| |
- // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
|
| |
- if ( event.metaKey === undefined ) {
|
| |
- event.metaKey = event.ctrlKey;
|
| |
+ if ( selector && typeof selector === "string" ) {
|
| |
+ matched = jQuery.filter( selector, matched );
|
| |
}
|
| |
|
| |
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
|
| |
- },
|
| |
-
|
| |
- special: {
|
| |
- ready: {
|
| |
- // Make sure the ready event is setup
|
| |
- setup: jQuery.bindReady
|
| |
- },
|
| |
-
|
| |
- load: {
|
| |
- // Prevent triggered image.load events from bubbling to window.load
|
| |
- noBubble: true
|
| |
- },
|
| |
-
|
| |
- focus: {
|
| |
- delegateType: "focusin"
|
| |
- },
|
| |
- blur: {
|
| |
- delegateType: "focusout"
|
| |
- },
|
| |
-
|
| |
- beforeunload: {
|
| |
- setup: function( data, namespaces, eventHandle ) {
|
| |
- // We only want to do this special case on windows
|
| |
- if ( jQuery.isWindow( this ) ) {
|
| |
- this.onbeforeunload = eventHandle;
|
| |
- }
|
| |
- },
|
| |
+ if ( this.length > 1 ) {
|
| |
|
| |
- teardown: function( namespaces, eventHandle ) {
|
| |
- if ( this.onbeforeunload === eventHandle ) {
|
| |
- this.onbeforeunload = null;
|
| |
- }
|
| |
+ // Remove duplicates
|
| |
+ if ( !guaranteedUnique[ name ] ) {
|
| |
+ jQuery.uniqueSort( matched );
|
| |
}
|
| |
- }
|
| |
- },
|
| |
|
| |
- simulate: function( type, elem, event, bubble ) {
|
| |
- // Piggyback on a donor event to simulate a different one.
|
| |
- // Fake originalEvent to avoid donor's stopPropagation, but if the
|
| |
- // simulated event prevents default then we do the same on the donor.
|
| |
- var e = jQuery.extend(
|
| |
- new jQuery.Event(),
|
| |
- event,
|
| |
- { type: type,
|
| |
- isSimulated: true,
|
| |
- originalEvent: {}
|
| |
+ // Reverse order for parents* and prev-derivatives
|
| |
+ if ( rparentsprev.test( name ) ) {
|
| |
+ matched.reverse();
|
| |
}
|
| |
- );
|
| |
- if ( bubble ) {
|
| |
- jQuery.event.trigger( e, null, elem );
|
| |
- } else {
|
| |
- jQuery.event.dispatch.call( elem, e );
|
| |
}
|
| |
- if ( e.isDefaultPrevented() ) {
|
| |
- event.preventDefault();
|
| |
- }
|
| |
- }
|
| |
- };
|
| |
-
|
| |
- // Some plugins are using, but it's undocumented/deprecated and will be removed.
|
| |
- // The 1.7 special event interface should provide all the hooks needed now.
|
| |
- jQuery.event.handle = jQuery.event.dispatch;
|
| |
|
| |
- jQuery.removeEvent = document.removeEventListener ?
|
| |
- function( elem, type, handle ) {
|
| |
- if ( elem.removeEventListener ) {
|
| |
- elem.removeEventListener( type, handle, false );
|
| |
- }
|
| |
- } :
|
| |
- function( elem, type, handle ) {
|
| |
- if ( elem.detachEvent ) {
|
| |
- elem.detachEvent( "on" + type, handle );
|
| |
- }
|
| |
+ return this.pushStack( matched );
|
| |
};
|
| |
+ } );
|
| |
+ var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
|
| |
|
| |
- jQuery.Event = function( src, props ) {
|
| |
- // Allow instantiation without the 'new' keyword
|
| |
- if ( !(this instanceof jQuery.Event) ) {
|
| |
- return new jQuery.Event( src, props );
|
| |
- }
|
| |
-
|
| |
- // Event object
|
| |
- if ( src && src.type ) {
|
| |
- this.originalEvent = src;
|
| |
- this.type = src.type;
|
| |
-
|
| |
- // Events bubbling up the document may have been marked as prevented
|
| |
- // by a handler lower down the tree; reflect the correct value.
|
| |
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
|
| |
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
|
| |
|
| |
- // Event type
|
| |
- } else {
|
| |
- this.type = src;
|
| |
- }
|
| |
|
| |
- // Put explicitly provided properties onto the event object
|
| |
- if ( props ) {
|
| |
- jQuery.extend( this, props );
|
| |
- }
|
| |
+ // Convert String-formatted options into Object-formatted ones
|
| |
+ function createOptions( options ) {
|
| |
+ var object = {};
|
| |
+ jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
|
| |
+ object[ flag ] = true;
|
| |
+ } );
|
| |
+ return object;
|
| |
+ }
|
| |
|
| |
- // Create a timestamp if incoming event doesn't have one
|
| |
- this.timeStamp = src && src.timeStamp || jQuery.now();
|
| |
+ /*
|
| |
+ * Create a callback list using the following parameters:
|
| |
+ *
|
| |
+ * options: an optional list of space-separated options that will change how
|
| |
+ * the callback list behaves or a more traditional option object
|
| |
+ *
|
| |
+ * By default a callback list will act like an event callback list and can be
|
| |
+ * "fired" multiple times.
|
| |
+ *
|
| |
+ * Possible options:
|
| |
+ *
|
| |
+ * once: will ensure the callback list can only be fired once (like a Deferred)
|
| |
+ *
|
| |
+ * memory: will keep track of previous values and will call any callback added
|
| |
+ * after the list has been fired right away with the latest "memorized"
|
| |
+ * values (like a Deferred)
|
| |
+ *
|
| |
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
|
| |
+ *
|
| |
+ * stopOnFalse: interrupt callings when a callback returns false
|
| |
+ *
|
| |
+ */
|
| |
+ jQuery.Callbacks = function( options ) {
|
| |
|
| |
- // Mark it as fixed
|
| |
- this[ jQuery.expando ] = true;
|
| |
- };
|
| |
+ // Convert options from String-formatted to Object-formatted if needed
|
| |
+ // (we check in cache first)
|
| |
+ options = typeof options === "string" ?
|
| |
+ createOptions( options ) :
|
| |
+ jQuery.extend( {}, options );
|
| |
|
| |
- function returnFalse() {
|
| |
- return false;
|
| |
- }
|
| |
- function returnTrue() {
|
| |
- return true;
|
| |
- }
|
| |
+ var // Flag to know if list is currently firing
|
| |
+ firing,
|
| |
|
| |
- // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
| |
- // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
| |
- jQuery.Event.prototype = {
|
| |
- preventDefault: function() {
|
| |
- this.isDefaultPrevented = returnTrue;
|
| |
+ // Last fire value for non-forgettable lists
|
| |
+ memory,
|
| |
|
| |
- var e = this.originalEvent;
|
| |
- if ( !e ) {
|
| |
- return;
|
| |
- }
|
| |
+ // Flag to know if list was already fired
|
| |
+ fired,
|
| |
|
| |
- // if preventDefault exists run it on the original event
|
| |
- if ( e.preventDefault ) {
|
| |
- e.preventDefault();
|
| |
+ // Flag to prevent firing
|
| |
+ locked,
|
| |
|
| |
- // otherwise set the returnValue property of the original event to false (IE)
|
| |
- } else {
|
| |
- e.returnValue = false;
|
| |
- }
|
| |
- },
|
| |
- stopPropagation: function() {
|
| |
- this.isPropagationStopped = returnTrue;
|
| |
+ // Actual callback list
|
| |
+ list = [],
|
| |
|
| |
- var e = this.originalEvent;
|
| |
- if ( !e ) {
|
| |
- return;
|
| |
- }
|
| |
- // if stopPropagation exists run it on the original event
|
| |
- if ( e.stopPropagation ) {
|
| |
- e.stopPropagation();
|
| |
- }
|
| |
- // otherwise set the cancelBubble property of the original event to true (IE)
|
| |
- e.cancelBubble = true;
|
| |
- },
|
| |
- stopImmediatePropagation: function() {
|
| |
- this.isImmediatePropagationStopped = returnTrue;
|
| |
- this.stopPropagation();
|
| |
- },
|
| |
- isDefaultPrevented: returnFalse,
|
| |
- isPropagationStopped: returnFalse,
|
| |
- isImmediatePropagationStopped: returnFalse
|
| |
- };
|
| |
+ // Queue of execution data for repeatable lists
|
| |
+ queue = [],
|
| |
|
| |
- // Create mouseenter/leave events using mouseover/out and event-time checks
|
| |
- jQuery.each({
|
| |
- mouseenter: "mouseover",
|
| |
- mouseleave: "mouseout"
|
| |
- }, function( orig, fix ) {
|
| |
- jQuery.event.special[ orig ] = {
|
| |
- delegateType: fix,
|
| |
- bindType: fix,
|
| |
+ // Index of currently firing callback (modified by add/remove as needed)
|
| |
+ firingIndex = -1,
|
| |
|
| |
- handle: function( event ) {
|
| |
- var target = this,
|
| |
- related = event.relatedTarget,
|
| |
- handleObj = event.handleObj,
|
| |
- selector = handleObj.selector,
|
| |
- ret;
|
| |
+ // Fire callbacks
|
| |
+ fire = function() {
|
| |
|
| |
- // For mousenter/leave call the handler if related is outside the target.
|
| |
- // NB: No relatedTarget if the mouse left/entered the browser window
|
| |
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
|
| |
- event.type = handleObj.origType;
|
| |
- ret = handleObj.handler.apply( this, arguments );
|
| |
- event.type = fix;
|
| |
- }
|
| |
- return ret;
|
| |
- }
|
| |
- };
|
| |
- });
|
| |
+ // Enforce single-firing
|
| |
+ locked = locked || options.once;
|
| |
|
| |
- // IE submit delegation
|
| |
- if ( !jQuery.support.submitBubbles ) {
|
| |
+ // Execute callbacks for all pending executions,
|
| |
+ // respecting firingIndex overrides and runtime changes
|
| |
+ fired = firing = true;
|
| |
+ for ( ; queue.length; firingIndex = -1 ) {
|
| |
+ memory = queue.shift();
|
| |
+ while ( ++firingIndex < list.length ) {
|
| |
|
| |
- jQuery.event.special.submit = {
|
| |
- setup: function() {
|
| |
- // Only need this for delegated form submit events
|
| |
- if ( jQuery.nodeName( this, "form" ) ) {
|
| |
- return false;
|
| |
- }
|
| |
+ // Run callback and check for early termination
|
| |
+ if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
|
| |
+ options.stopOnFalse ) {
|
| |
|
| |
- // Lazy-add a submit handler when a descendant form may potentially be submitted
|
| |
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
|
| |
- // Node name check avoids a VML-related crash in IE (#9807)
|
| |
- var elem = e.target,
|
| |
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
|
| |
- if ( form && !form._submit_attached ) {
|
| |
- jQuery.event.add( form, "submit._submit", function( event ) {
|
| |
- event._submit_bubble = true;
|
| |
- });
|
| |
- form._submit_attached = true;
|
| |
- }
|
| |
- });
|
| |
- // return undefined since we don't need an event listener
|
| |
- },
|
| |
-
|
| |
- postDispatch: function( event ) {
|
| |
- // If form was submitted by the user, bubble the event up the tree
|
| |
- if ( event._submit_bubble ) {
|
| |
- delete event._submit_bubble;
|
| |
- if ( this.parentNode && !event.isTrigger ) {
|
| |
- jQuery.event.simulate( "submit", this.parentNode, event, true );
|
| |
+ // Jump to end and forget the data so .add doesn't re-fire
|
| |
+ firingIndex = list.length;
|
| |
+ memory = false;
|
| |
+ }
|
| |
}
|
| |
}
|
| |
- },
|
| |
|
| |
- teardown: function() {
|
| |
- // Only need this for delegated form submit events
|
| |
- if ( jQuery.nodeName( this, "form" ) ) {
|
| |
- return false;
|
| |
+ // Forget the data if we're done with it
|
| |
+ if ( !options.memory ) {
|
| |
+ memory = false;
|
| |
}
|
| |
|
| |
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
|
| |
- jQuery.event.remove( this, "._submit" );
|
| |
- }
|
| |
- };
|
| |
- }
|
| |
-
|
| |
- // IE change delegation and checkbox/radio fix
|
| |
- if ( !jQuery.support.changeBubbles ) {
|
| |
+ firing = false;
|
| |
|
| |
- jQuery.event.special.change = {
|
| |
+ // Clean up if we're done firing for good
|
| |
+ if ( locked ) {
|
| |
|
| |
- setup: function() {
|
| |
+ // Keep an empty list if we have data for future add calls
|
| |
+ if ( memory ) {
|
| |
+ list = [];
|
| |
|
| |
- if ( rformElems.test( this.nodeName ) ) {
|
| |
- // IE doesn't fire change on a check/radio until blur; trigger it on click
|
| |
- // after a propertychange. Eat the blur-change in special.change.handle.
|
| |
- // This still fires onchange a second time for check/radio after blur.
|
| |
- if ( this.type === "checkbox" || this.type === "radio" ) {
|
| |
- jQuery.event.add( this, "propertychange._change", function( event ) {
|
| |
- if ( event.originalEvent.propertyName === "checked" ) {
|
| |
- this._just_changed = true;
|
| |
- }
|
| |
- });
|
| |
- jQuery.event.add( this, "click._change", function( event ) {
|
| |
- if ( this._just_changed && !event.isTrigger ) {
|
| |
- this._just_changed = false;
|
| |
- jQuery.event.simulate( "change", this, event, true );
|
| |
- }
|
| |
- });
|
| |
+ // Otherwise, this object is spent
|
| |
+ } else {
|
| |
+ list = "";
|
| |
}
|
| |
- return false;
|
| |
}
|
| |
- // Delegated event; lazy-add a change handler on descendant inputs
|
| |
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
|
| |
- var elem = e.target;
|
| |
-
|
| |
- if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
|
| |
- jQuery.event.add( elem, "change._change", function( event ) {
|
| |
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
|
| |
- jQuery.event.simulate( "change", this.parentNode, event, true );
|
| |
- }
|
| |
- });
|
| |
- elem._change_attached = true;
|
| |
- }
|
| |
- });
|
| |
},
|
| |
|
| |
- handle: function( event ) {
|
| |
- var elem = event.target;
|
| |
-
|
| |
- // Swallow native change events from checkbox/radio, we already triggered them above
|
| |
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
|
| |
- return event.handleObj.handler.apply( this, arguments );
|
| |
- }
|
| |
- },
|
| |
+ // Actual Callbacks object
|
| |
+ self = {
|
| |
|
| |
- teardown: function() {
|
| |
- jQuery.event.remove( this, "._change" );
|
| |
+ // Add a callback or a collection of callbacks to the list
|
| |
+ add: function() {
|
| |
+ if ( list ) {
|
| |
|
| |
- return rformElems.test( this.nodeName );
|
| |
- }
|
| |
- };
|
| |
- }
|
| |
+ // If we have memory from a past run, we should fire after adding
|
| |
+ if ( memory && !firing ) {
|
| |
+ firingIndex = list.length - 1;
|
| |
+ queue.push( memory );
|
| |
+ }
|
| |
|
| |
- // Create "bubbling" focus and blur events
|
| |
- if ( !jQuery.support.focusinBubbles ) {
|
| |
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
| |
+ ( function add( args ) {
|
| |
+ jQuery.each( args, function( _, arg ) {
|
| |
+ if ( isFunction( arg ) ) {
|
| |
+ if ( !options.unique || !self.has( arg ) ) {
|
| |
+ list.push( arg );
|
| |
+ }
|
| |
+ } else if ( arg && arg.length && toType( arg ) !== "string" ) {
|
| |
|
| |
- // Attach a single capturing handler while someone wants focusin/focusout
|
| |
- var attaches = 0,
|
| |
- handler = function( event ) {
|
| |
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
|
| |
- };
|
| |
+ // Inspect recursively
|
| |
+ add( arg );
|
| |
+ }
|
| |
+ } );
|
| |
+ } )( arguments );
|
| |
|
| |
- jQuery.event.special[ fix ] = {
|
| |
- setup: function() {
|
| |
- if ( attaches++ === 0 ) {
|
| |
- document.addEventListener( orig, handler, true );
|
| |
+ if ( memory && !firing ) {
|
| |
+ fire();
|
| |
+ }
|
| |
}
|
| |
+ return this;
|
| |
},
|
| |
- teardown: function() {
|
| |
- if ( --attaches === 0 ) {
|
| |
- document.removeEventListener( orig, handler, true );
|
| |
- }
|
| |
- }
|
| |
- };
|
| |
- });
|
| |
- }
|
| |
|
| |
- jQuery.fn.extend({
|
| |
-
|
| |
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
|
| |
- var origFn, type;
|
| |
+ // Remove a callback from the list
|
| |
+ remove: function() {
|
| |
+ jQuery.each( arguments, function( _, arg ) {
|
| |
+ var index;
|
| |
+ while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
|
| |
+ list.splice( index, 1 );
|
| |
+
|
| |
+ // Handle firing indexes
|
| |
+ if ( index <= firingIndex ) {
|
| |
+ firingIndex--;
|
| |
+ }
|
| |
+ }
|
| |
+ } );
|
| |
+ return this;
|
| |
+ },
|
| |
|
| |
- // Types can be a map of types/handlers
|
| |
- if ( typeof types === "object" ) {
|
| |
- // ( types-Object, selector, data )
|
| |
- if ( typeof selector !== "string" ) { // && selector != null
|
| |
- // ( types-Object, data )
|
| |
- data = data || selector;
|
| |
- selector = undefined;
|
| |
- }
|
| |
- for ( type in types ) {
|
| |
- this.on( type, selector, data, types[ type ], one );
|
| |
- }
|
| |
- return this;
|
| |
- }
|
| |
+ // Check if a given callback is in the list.
|
| |
+ // If no argument is given, return whether or not list has callbacks attached.
|
| |
+ has: function( fn ) {
|
| |
+ return fn ?
|
| |
+ jQuery.inArray( fn, list ) > -1 :
|
| |
+ list.length > 0;
|
| |
+ },
|
| |
|
| |
- if ( data == null && fn == null ) {
|
| |
- // ( types, fn )
|
|