"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "framework/web/js/source/jquery.js" between
yii-1.1.23.445827.tar.gz and yii-1.1.24.a5ab20.tar.gz

About: Yii is a high-performance component-based PHP framework for developing large-scale Web applications. Hint: Yii 1.1 is now in maintenance mode.

jquery.js  (yii-1.1.23.445827):jquery.js  (yii-1.1.24.a5ab20)
/*! /*!
* jQuery JavaScript Library v1.11.1 * jQuery JavaScript Library v1.12.4
* http://jquery.com/ * http://jquery.com/
* *
* Includes Sizzle.js * Includes Sizzle.js
* http://sizzlejs.com/ * http://sizzlejs.com/
* *
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors * Copyright jQuery Foundation and other contributors
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-05-01T17:42Z * Date: 2016-05-20T17:17Z
*/ */
(function( global, factory ) { (function( global, factory ) {
if ( typeof module === "object" && typeof module.exports === "object" ) { if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper win // For CommonJS and CommonJS-like environments where a proper `wi
dow is present, ndow`
// execute the factory and get jQuery // is present, execute the factory and get jQuery.
// For environments that do not inherently posses a window with a // For environments that do not have a `window` with a `document`
document // (such as Node.js), expose a factory as module.exports.
// (such as Node.js), expose a jQuery-making factory as module.ex // This accentuates the need for the creation of a real `window`.
ports
// This accentuates the need for the creation of a real window
// e.g. var jQuery = require("jquery")(window); // e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info // See ticket #14549 for more info.
module.exports = global.document ? module.exports = global.document ?
factory( global, true ) : factory( global, true ) :
function( w ) { function( w ) {
if ( !w.document ) { if ( !w.document ) {
throw new Error( "jQuery requires a windo w with a document" ); throw new Error( "jQuery requires a windo w with a document" );
} }
return factory( w ); return factory( w );
}; };
} else { } else {
factory( global ); factory( global );
} }
// Pass this if window is not defined yet // Pass this if window is not defined yet
}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Can't do this because several apps including ASP.NET trace // Support: Firefox 18+
// Can't be in strict mode, several libs including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if // the stack via arguments.caller.callee and Firefox dies if
// you try to trace through "use strict" call chains. (#13335) // you try to trace through "use strict" call chains. (#13335)
// Support: Firefox 18+ //"use strict";
//
var deletedIds = []; var deletedIds = [];
var document = window.document;
var slice = deletedIds.slice; var slice = deletedIds.slice;
var concat = deletedIds.concat; var concat = deletedIds.concat;
var push = deletedIds.push; var push = deletedIds.push;
var indexOf = deletedIds.indexOf; var indexOf = deletedIds.indexOf;
var class2type = {}; var class2type = {};
var toString = class2type.toString; var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty; var hasOwn = class2type.hasOwnProperty;
var support = {}; var support = {};
var var
version = "1.11.1", version = "1.12.4",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhan ced' // The jQuery object is actually just the init constructor 'enhan ced'
// Need init if jQuery is called (just allow error to be thrown i f not included) // Need init if jQuery is called (just allow error to be thrown i f not included)
return new jQuery.fn.init( selector, context ); return new jQuery.fn.init( selector, context );
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1, IE<9
// Make sure we trim BOM and NBSP // Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing // Matches dashed string for camelizing
rmsPrefix = /^-ms-/, rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi, rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace() // Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) { fcamelCase = function( all, letter ) {
return letter.toUpperCase(); return letter.toUpperCase();
}; };
jQuery.fn = jQuery.prototype = { jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used // The current version of jQuery being used
jquery: version, jquery: version,
constructor: jQuery, constructor: jQuery,
// Start with an empty selector // Start with an empty selector
selector: "", selector: "",
// The default length of a jQuery object is 0 // The default length of a jQuery object is 0
length: 0, length: 0,
skipping to change at line 131 skipping to change at line 134
// Add the old object onto the stack (as a reference) // Add the old object onto the stack (as a reference)
ret.prevObject = this; ret.prevObject = this;
ret.context = this.context; ret.context = this.context;
// Return the newly-formed element set // Return the newly-formed element set
return ret; return ret;
}, },
// Execute a callback for every element in the matched set. // Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is each: function( callback ) {
// only used internally.) return jQuery.each( this, callback );
each: function( callback, args ) {
return jQuery.each( this, callback, args );
}, },
map: function( callback ) { map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) { return this.pushStack( jQuery.map( this, function( elem, i ) {
return callback.call( elem, i, elem ); return callback.call( elem, i, elem );
})); } ) );
}, },
slice: function() { slice: function() {
return this.pushStack( slice.apply( this, arguments ) ); return this.pushStack( slice.apply( this, arguments ) );
}, },
first: function() { first: function() {
return this.eq( 0 ); return this.eq( 0 );
}, },
last: function() { last: function() {
return this.eq( -1 ); return this.eq( -1 );
}, },
eq: function( i ) { eq: function( i ) {
var len = this.length, var len = this.length,
j = +i + ( i < 0 ? len : 0 ); j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
}, },
end: function() { end: function() {
return this.prevObject || this.constructor(null); return this.prevObject || this.constructor();
}, },
// For internal use only. // For internal use only.
// Behaves like an Array's method, not like a jQuery method. // Behaves like an Array's method, not like a jQuery method.
push: push, push: push,
sort: deletedIds.sort, sort: deletedIds.sort,
splice: deletedIds.splice splice: deletedIds.splice
}; };
jQuery.extend = jQuery.fn.extend = function() { jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone, var src, copyIsArray, copy, name, options, clone,
target = arguments[0] || {}, target = arguments[ 0 ] || {},
i = 1, i = 1,
length = arguments.length, length = arguments.length,
deep = false; deep = false;
// Handle a deep copy situation // Handle a deep copy situation
if ( typeof target === "boolean" ) { if ( typeof target === "boolean" ) {
deep = target; deep = target;
// skip the boolean and the target // skip the boolean and the target
target = arguments[ i ] || {}; target = arguments[ i ] || {};
i++; i++;
} }
// Handle case when target is a string or something (possible in deep cop y) // Handle case when target is a string or something (possible in deep cop y)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) { if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {}; target = {};
} }
// extend jQuery itself if only one argument is passed // extend jQuery itself if only one argument is passed
if ( i === length ) { if ( i === length ) {
target = this; target = this;
i--; i--;
} }
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values // Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) { if ( ( options = arguments[ i ] ) != null ) {
// Extend the base object // Extend the base object
for ( name in options ) { for ( name in options ) {
src = target[ name ]; src = target[ name ];
copy = options[ name ]; copy = options[ name ];
// Prevent never-ending loop // Prevent never-ending loop
if ( target === copy ) { if ( target === copy ) {
continue; continue;
} }
// Recurse if we're merging plain objects or arra ys // Recurse if we're merging plain objects or arra ys
if ( deep && copy && ( jQuery.isPlainObject(copy) if ( deep && copy && ( jQuery.isPlainObject( copy
|| (copyIsArray = jQuery.isArray(copy)) ) ) { ) ||
( copyIsArray = jQuery.isArray( copy ) )
) ) {
if ( copyIsArray ) { if ( copyIsArray ) {
copyIsArray = false; copyIsArray = false;
clone = src && jQuery.isArray(src ) ? src : []; clone = src && jQuery.isArray( sr c ) ? src : [];
} else { } else {
clone = src && jQuery.isPlainObje ct(src) ? src : {}; clone = src && jQuery.isPlainObje ct( src ) ? src : {};
} }
// Never move original objects, clone the m // Never move original objects, clone the m
target[ name ] = jQuery.extend( deep, clo ne, copy ); target[ name ] = jQuery.extend( deep, clo ne, copy );
// Don't bring in undefined values // Don't bring in undefined values
} else if ( copy !== undefined ) { } else if ( copy !== undefined ) {
target[ name ] = copy; target[ name ] = copy;
} }
} }
} }
} }
// Return the modified object // Return the modified object
return target; return target;
}; };
jQuery.extend({ jQuery.extend( {
// Unique for each copy of jQuery on the page // Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module // Assume jQuery is ready without the ready module
isReady: true, isReady: true,
error: function( msg ) { error: function( msg ) {
throw new Error( msg ); throw new Error( msg );
}, },
noop: function() {}, noop: function() {},
// See test/unit/core.js for details concerning isFunction. // See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert // Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968). // aren't supported. They return false on IE (#2968).
isFunction: function( obj ) { isFunction: function( obj ) {
return jQuery.type(obj) === "function"; return jQuery.type( obj ) === "function";
}, },
isArray: Array.isArray || function( obj ) { isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array"; return jQuery.type( obj ) === "array";
}, },
isWindow: function( obj ) { isWindow: function( obj ) {
/* jshint eqeqeq: false */ /* jshint eqeqeq: false */
return obj != null && obj == obj.window; return obj != null && obj == obj.window;
}, },
isNumeric: function( obj ) { isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false| "") // parseFloat NaNs numeric-cast false positives (null|true|false| "")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN // subtraction forces infinities to NaN
return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0; // adding 1 corrects loss of precision from parseFloat (#15100)
var realStringObj = obj && obj.toString();
return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( re
alStringObj ) + 1 ) >= 0;
}, },
isEmptyObject: function( obj ) { isEmptyObject: function( obj ) {
var name; var name;
for ( name in obj ) { for ( name in obj ) {
return false; return false;
} }
return true; return true;
}, },
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
var key; var key;
// Must be an Object. // Must be an Object.
// Because of IE, we also have to check the presence of the const ructor property. // Because of IE, we also have to check the presence of the const ructor property.
// Make sure that DOM nodes and window objects don't pass through , as well // Make sure that DOM nodes and window objects don't pass through , as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQu ery.isWindow( obj ) ) { if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || j Query.isWindow( obj ) ) {
return false; return false;
} }
try { try {
// Not own constructor property must be Object // Not own constructor property must be Object
if ( obj.constructor && if ( obj.constructor &&
!hasOwn.call(obj, "constructor") && !hasOwn.call( obj, "constructor" ) &&
!hasOwn.call(obj.constructor.prototype, "isProtot !hasOwn.call( obj.constructor.prototype, "isProto
ypeOf") ) { typeOf" ) ) {
return false; return false;
} }
} catch ( e ) { } catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9 897 // IE8,9 Will throw exceptions on certain host objects #9 897
return false; return false;
} }
// Support: IE<9 // Support: IE<9
// Handle iteration over inherited properties before own properti es. // Handle iteration over inherited properties before own properti es.
if ( support.ownLast ) { if ( !support.ownFirst ) {
for ( key in obj ) { for ( key in obj ) {
return hasOwn.call( obj, key ); return hasOwn.call( obj, key );
} }
} }
// Own properties are enumerated firstly, so to speed up, // Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own. // if last one is own, then all properties are own.
for ( key in obj ) {} for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key ); return key === undefined || hasOwn.call( obj, key );
}, },
type: function( obj ) { type: function( obj ) {
if ( obj == null ) { if ( obj == null ) {
return obj + ""; return obj + "";
} }
return typeof obj === "object" || typeof obj === "function" ? return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call(obj) ] || "object" : class2type[ toString.call( obj ) ] || "object" :
typeof obj; typeof obj;
}, },
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll // Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascri pt-global-context // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascri pt-global-context
globalEval: function( data ) { globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) { if ( data && jQuery.trim( data ) ) {
// We use execScript on Internet Explorer // We use execScript on Internet Explorer
// We use an anonymous function so that context is window // We use an anonymous function so that context is window
// rather than jQuery in Firefox // rather than jQuery in Firefox
( window.execScript || function( data ) { ( window.execScript || function( data ) {
window[ "eval" ].call( window, data ); window[ "eval" ].call( window, data ); // jscs:ig nore requireDotNotation
} )( data ); } )( data );
} }
}, },
// Convert dashed to camelCase; used by the css and data modules // Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572) // Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) { camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fc amelCase ); return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fc amelCase );
}, },
nodeName: function( elem, name ) { nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLo werCase(); return elem.nodeName && elem.nodeName.toLowerCase() === name.toLo werCase();
}, },
// args is for internal usage only each: function( obj, callback ) {
each: function( obj, callback, args ) { var length, i = 0;
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) { if ( isArrayLike( obj ) ) {
break; length = obj.length;
} for ( ; i < length; i++ ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === f
alse ) {
break;
} }
} }
// A special, fast, case for the most common use of each
} else { } else {
if ( isArray ) { for ( i in obj ) {
for ( ; i < length; i++ ) { if ( callback.call( obj[ i ], i, obj[ i ] ) === f
value = callback.call( obj[ i ], i, obj[ alse ) {
i ] ); break;
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[
i ] );
if ( value === false ) {
break;
}
} }
} }
} }
return obj; return obj;
}, },
// Support: Android<4.1, IE<9 // Support: Android<4.1, IE<9
trim: function( text ) { trim: function( text ) {
return text == null ? return text == null ?
"" : "" :
( text + "" ).replace( rtrim, "" ); ( text + "" ).replace( rtrim, "" );
}, },
// results is for internal usage only // results is for internal usage only
makeArray: function( arr, results ) { makeArray: function( arr, results ) {
var ret = results || []; var ret = results || [];
if ( arr != null ) { if ( arr != null ) {
if ( isArraylike( Object(arr) ) ) { if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret, jQuery.merge( ret,
typeof arr === "string" ? typeof arr === "string" ?
[ arr ] : arr [ arr ] : arr
); );
} else { } else {
push.call( ret, arr ); push.call( ret, arr );
} }
} }
return ret; return ret;
skipping to change at line 438 skipping to change at line 420
if ( arr ) { if ( arr ) {
if ( indexOf ) { if ( indexOf ) {
return indexOf.call( arr, elem, i ); return indexOf.call( arr, elem, i );
} }
len = arr.length; len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) { for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays // Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) { if ( i in arr && arr[ i ] === elem ) {
return i; return i;
} }
} }
} }
return -1; return -1;
}, },
skipping to change at line 460 skipping to change at line 443
j = 0, j = 0,
i = first.length; i = first.length;
while ( j < len ) { while ( j < len ) {
first[ i++ ] = second[ j++ ]; first[ i++ ] = second[ j++ ];
} }
// Support: IE<9 // Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike ob jects (e.g., NodeLists) // Workaround casting of .length to NaN on otherwise arraylike ob jects (e.g., NodeLists)
if ( len !== len ) { if ( len !== len ) {
while ( second[j] !== undefined ) { while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ]; first[ i++ ] = second[ j++ ];
} }
} }
first.length = i; first.length = i;
return first; return first;
}, },
grep: function( elems, callback, invert ) { grep: function( elems, callback, invert ) {
skipping to change at line 491 skipping to change at line 474
if ( callbackInverse !== callbackExpect ) { if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] ); matches.push( elems[ i ] );
} }
} }
return matches; return matches;
}, },
// arg is for internal usage only // arg is for internal usage only
map: function( elems, callback, arg ) { map: function( elems, callback, arg ) {
var value, var length, value,
i = 0, i = 0,
length = elems.length,
isArray = isArraylike( elems ),
ret = []; ret = [];
// Go through the array, translating each of the items to their n ew values // Go through the array, translating each of the items to their n ew values
if ( isArray ) { if ( isArrayLike( elems ) ) {
length = elems.length;
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg ); value = callback( elems[ i ], i, arg );
if ( value != null ) { if ( value != null ) {
ret.push( value ); ret.push( value );
} }
} }
// Go through every key on the object, // Go through every key on the object,
} else { } else {
skipping to change at line 561 skipping to change at line 543
return proxy; return proxy;
}, },
now: function() { now: function() {
return +( new Date() ); return +( new Date() );
}, },
// jQuery.support is not used in Core but other projects attach their // jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist. // properties to it so it needs to exist.
support: support support: support
}); } );
// JSHint would error on this code due to the Symbol not being defined in ES5.
// Defining this global in .jshintrc would create a danger of using the global
// unguarded in another place, it seems safer to just disable JSHint for these
// three lines.
/* jshint ignore: start */
if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
}
/* jshint ignore: end */
// Populate the class2type map // Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symb
t(" "), function(i, name) { ol".split( " " ),
function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase(); class2type[ "[object " + name + "]" ] = name.toLowerCase();
}); } );
function isArraylike( obj ) { function isArrayLike( obj ) {
var length = obj.length,
// Support: iOS 8.2 (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 = jQuery.type( obj ); type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) { if ( type === "function" || jQuery.isWindow( obj ) ) {
return false; return false;
} }
if ( obj.nodeType === 1 && length ) {
return true;
}
return type === "array" || length === 0 || return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj ; typeof length === "number" && length > 0 && ( length - 1 ) in obj ;
} }
var Sizzle = var Sizzle =
/*! /*!
* Sizzle CSS Selector Engine v1.10.19 * Sizzle CSS Selector Engine v2.2.1
* http://sizzlejs.com/ * http://sizzlejs.com/
* *
* Copyright 2013 jQuery Foundation, Inc. and other contributors * Copyright jQuery Foundation and other contributors
* Released under the MIT license * Released under the MIT license
* http://jquery.org/license * http://jquery.org/license
* *
* Date: 2014-04-18 * Date: 2015-10-17
*/ */
(function( window ) { (function( window ) {
var i, var i,
support, support,
Expr, Expr,
getText, getText,
isXML, isXML,
tokenize, tokenize,
compile, compile,
skipping to change at line 619 skipping to change at line 613
setDocument, setDocument,
document, document,
docElem, docElem,
documentIsHTML, documentIsHTML,
rbuggyQSA, rbuggyQSA,
rbuggyMatches, rbuggyMatches,
matches, matches,
contains, contains,
// Instance-specific data // Instance-specific data
expando = "sizzle" + -(new Date()), expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document, preferredDoc = window.document,
dirruns = 0, dirruns = 0,
done = 0, done = 0,
classCache = createCache(), classCache = createCache(),
tokenCache = createCache(), tokenCache = createCache(),
compilerCache = createCache(), compilerCache = createCache(),
sortOrder = function( a, b ) { sortOrder = function( a, b ) {
if ( a === b ) { if ( a === b ) {
hasDuplicate = true; hasDuplicate = true;
} }
return 0; return 0;
}, },
// General-purpose constants // General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31, MAX_NEGATIVE = 1 << 31,
// Instance methods // Instance methods
hasOwn = ({}).hasOwnProperty, hasOwn = ({}).hasOwnProperty,
arr = [], arr = [],
pop = arr.pop, pop = arr.pop,
push_native = arr.push, push_native = arr.push,
push = arr.push, push = arr.push,
slice = arr.slice, slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one // Use a stripped-down indexOf as it's faster than native
indexOf = arr.indexOf || function( elem ) { // http://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0, var i = 0,
len = this.length; len = list.length;
for ( ; i < len; i++ ) { for ( ; i < len; i++ ) {
if ( this[i] === elem ) { if ( list[i] === elem ) {
return i; return i;
} }
} }
return -1; return -1;
}, },
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disa bled|hidden|ismap|loop|multiple|open|readonly|required|scoped", booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disa bled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions // Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace // http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]", whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-ident
ifier
identifier = characterEncoding.replace( "w", "w#" ),
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selecto rs // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selecto rs
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whi tespace + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2) // Operator (capture 2)
"*([*^$|!~]?=)" + whitespace + "*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strin gs [capture 3 or capture 4]" // "Attribute values must be CSS identifiers [capture 5] or strin gs [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + iden tifier + "))|)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + iden tifier + "))|)" + whitespace +
"*\\]", "*\\]",
pseudos = ":(" + characterEncoding + ")(?:\\((" + pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preF ilter, prefer arguments: // To reduce the number of selectors needing tokenize in the preF ilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5) // 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6) // 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2) // 3. anything else (capture 2)
".*" + ".*" +
")\\)|)", ")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whites pace characters preceding the latter // Leading and non-escaped trailing whitespace, capturing some non-whites pace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + wh itespace + "+$", "g" ), rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + wh itespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + " )" + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + " )" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whit espace + "*\\]", "g" ), rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whit espace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ), rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ), ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = { matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ), "ID": new RegExp( "^#(" + identifier + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) "TAG": new RegExp( "^(" + identifier + "|[*])" ),
+ ")" ),
"ATTR": new RegExp( "^" + attributes ), "ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ), "PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of- type)(?:\\(" + whitespace + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of- type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]| )" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]| )" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ), "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ), "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is() // For use in libraries implementing .is()
// We use this for POS matching in `select` // We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd |eq|gt|lt|nth|first|last)(?:\\(" + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd |eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?= [^-]|$)", "i" ) whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?= [^-]|$)", "i" )
skipping to change at line 740 skipping to change at line 731
// NaN means non-codepoint // NaN means non-codepoint
// Support: Firefox<24 // Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x" // Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ? return high !== high || escapedWhitespace ?
escaped : escaped :
high < 0 ? high < 0 ?
// BMP codepoint // BMP codepoint
String.fromCharCode( high + 0x10000 ) : String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair) // Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
}; };
// Optimize for push.apply( _, NodeList ) // Optimize for push.apply( _, NodeList )
try { try {
push.apply( push.apply(
(arr = slice.call( preferredDoc.childNodes )), (arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes preferredDoc.childNodes
); );
// Support: Android<4.0 // Support: Android<4.0
// Detect silently failing push.apply // Detect silently failing push.apply
skipping to change at line 772 skipping to change at line 771
var j = target.length, var j = target.length,
i = 0; i = 0;
// Can't trust NodeList.length // Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {} while ( (target[j++] = els[i++]) ) {}
target.length = j - 1; target.length = j - 1;
} }
}; };
} }
function Sizzle( selector, context, results, seed ) { function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType, var m, i, elem, nid, nidselect, match, groups, newSelector,
// QSA vars newContext = context && context.ownerDocument,
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== do // nodeType defaults to 9, since context defaults to document
cument ) { nodeType = context ? context.nodeType : 9;
setDocument( context );
}
context = context || document;
results = results || []; results = results || [];
if ( !selector || typeof selector !== "string" ) { // Return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results; return results;
} }
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { // Try to shortcut find operations (as opposed to filters) in HTML docume
return []; nts
} if ( !seed ) {
if ( documentIsHTML && !seed ) { if ( ( context ? context.ownerDocument || context : preferredDoc
) !== document ) {
setDocument( context );
}
context = context || document;
// Shortcuts if ( documentIsHTML ) {
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID") // If the selector is sufficiently simple, try using a "g
if ( (m = match[1]) ) { et*By*" DOM method
if ( nodeType === 9 ) { // (excepting DocumentFragment context, where the methods
elem = context.getElementById( m ); don't exist)
// Check parentNode to catch when Blackbe if ( nodeType !== 11 && (match = rquickExpr.exec( selecto
rry 4.6 returns r )) ) {
// nodes that are no longer in the docume
nt (jQuery #6963) // ID selector
if ( elem && elem.parentNode ) { if ( (m = match[1]) ) {
// Handle the case where IE, Oper
a, and Webkit return items // Document context
// by name instead of ID if ( nodeType === 9 ) {
if ( elem.id === m ) { if ( (elem = context.getElementBy
results.push( elem ); Id( m )) ) {
// Support: IE, Opera, We
bkit
// TODO: identify version
s
// getElementById can mat
ch elements by name instead of ID
if ( elem.id === m ) {
results.push( ele
m );
return results;
}
} else {
return results; return results;
} }
// Element context
} else { } else {
return results;
} // Support: IE, Opera, Webkit
} else { // TODO: identify versions
// Context is not a document // getElementById can match eleme
if ( context.ownerDocument && (elem = con nts by name instead of ID
text.ownerDocument.getElementById( m )) && if ( newContext && (elem = newCon
contains( context, elem ) && elem text.getElementById( m )) &&
.id === m ) { contains( context, elem )
results.push( elem ); &&
return results; elem.id === m ) {
results.push( elem );
return results;
}
} }
}
// Speed-up: Sizzle("TAG") // Type selector
} else if ( match[2] ) { } else if ( match[2] ) {
push.apply( results, context.getElementsByTagName push.apply( results, context.getElementsB
( selector ) ); yTagName( selector ) );
return results; return results;
// Speed-up: Sizzle(".CLASS") // Class selector
} else if ( (m = match[3]) && support.getElementsByClassN } else if ( (m = match[3]) && support.getElements
ame && context.getElementsByClassName ) { ByClassName &&
push.apply( results, context.getElementsByClassNa context.getElementsByClassName ) {
me( m ) );
return results; push.apply( results, context.getElementsB
yClassName( m ) );
return results;
}
} }
}
// QSA path // Take advantage of querySelectorAll
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) if ( support.qsa &&
{ !compilerCache[ selector + " " ] &&
nid = old = expando; (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
newContext = context;
newSelector = nodeType === 9 && selector; if ( nodeType !== 1 ) {
newContext = context;
// qSA works strangely on Element-rooted queries newSelector = selector;
// We can work around this by specifying an extra ID on t
he root // qSA looks outside Element context, which is no
// and working up from there (Thanks to Andrew Dupont for t what we want
the technique) // Thanks to Andrew Dupont for this workaround te
// IE 8 doesn't work on object elements chnique
if ( nodeType === 1 && context.nodeName.toLowerCase() !== // Support: IE <=8
"object" ) { // Exclude object elements
groups = tokenize( selector ); } else if ( context.nodeName.toLowerCase() !== "o
bject" ) {
// Capture the context ID, setting it fir
st if necessary
if ( (nid = context.getAttribute( "id" ))
) {
nid = nid.replace( rescape, "\\$&
" );
} else {
context.setAttribute( "id", (nid
= expando) );
}
if ( (old = context.getAttribute("id")) ) { // Prefix every selector in the list
nid = old.replace( rescape, "\\$&" ); groups = tokenize( selector );
} else { i = groups.length;
context.setAttribute( "id", nid ); nidselect = ridentifier.test( nid ) ? "#"
} + nid : "[id='" + nid + "']";
nid = "[id='" + nid + "'] "; while ( i-- ) {
groups[i] = nidselect + " " + toS
elector( groups[i] );
}
newSelector = groups.join( "," );
i = groups.length; // Expand context for sibling selectors
while ( i-- ) { newContext = rsibling.test( selector ) &&
groups[i] = nid + toSelector( groups[i] ) testContext( context.parentNode ) ||
; context;
} }
newContext = rsibling.test( selector ) && testCon
text( context.parentNode ) || context;
newSelector = groups.join(",");
}
if ( newSelector ) { if ( newSelector ) {
try { try {
push.apply( results, push.apply( results,
newContext.querySelectorAll( newS newContext.querySelectorA
elector ) ll( newSelector )
); );
return results; return results;
} catch(qsaError) { } catch ( qsaError ) {
} finally { } finally {
if ( !old ) { if ( nid === expando ) {
context.removeAttribute("id"); context.removeAttribute(
"id" );
}
} }
} }
} }
} }
} }
// All others // All others
return select( selector.replace( rtrim, "$1" ), context, results, seed ); return select( selector.replace( rtrim, "$1" ), context, results, seed );
} }
/** /**
* Create key-value caches of limited size * Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with * @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 tha n Expr.cacheLength) * property name the (space-suffixed) string and (if the cache is larger tha n Expr.cacheLength)
* deleting the oldest entry * deleting the oldest entry
*/ */
function createCache() { function createCache() {
var keys = []; var keys = [];
function cache( key, value ) { function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype prope rties (see Issue #157) // Use (key + " ") to avoid collision with native prototype prope rties (see Issue #157)
if ( keys.push( key + " " ) > Expr.cacheLength ) { if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries // Only keep the most recent entries
skipping to change at line 937 skipping to change at line 961
} }
} }
/** /**
* Adds the same handler for all of the specified attrs * Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes * @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied * @param {Function} handler The method that will be applied
*/ */
function addHandle( attrs, handler ) { function addHandle( attrs, handler ) {
var arr = attrs.split("|"), var arr = attrs.split("|"),
i = attrs.length; i = arr.length;
while ( i-- ) { while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler; Expr.attrHandle[ arr[i] ] = handler;
} }
} }
/** /**
* Checks document order of two siblings * Checks document order of two siblings
* @param {Element} a * @param {Element} a
* @param {Element} b * @param {Element} b
skipping to change at line 1023 skipping to change at line 1047
}); });
}); });
} }
/** /**
* Checks a node for validity as a Sizzle context * Checks a node for validity as a Sizzle context
* @param {Element|Object=} context * @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a f alsy value * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a f alsy value
*/ */
function testContext( context ) { function testContext( context ) {
return context && typeof context.getElementsByTagName !== strundefined && context; return context && typeof context.getElementsByTagName !== "undefined" && context;
} }
// Expose support vars for convenience // Expose support vars for convenience
support = Sizzle.support = {}; support = Sizzle.support = {};
/** /**
* Detects XML nodes * Detects XML nodes
* @param {Element|Object} elem An element or a document * @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node * @returns {Boolean} True iff elem is a non-HTML XML node
*/ */
skipping to change at line 1047 skipping to change at line 1071
var documentElement = elem && (elem.ownerDocument || elem).documentElemen t; var documentElement = elem && (elem.ownerDocument || elem).documentElemen t;
return documentElement ? documentElement.nodeName !== "HTML" : false; return documentElement ? documentElement.nodeName !== "HTML" : false;
}; };
/** /**
* Sets document-related variables once based on the current document * 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 * @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document * @returns {Object} Returns the current document
*/ */
setDocument = Sizzle.setDocument = function( node ) { setDocument = Sizzle.setDocument = function( node ) {
var hasCompare, var hasCompare, parent,
doc = node ? node.ownerDocument || node : preferredDoc, doc = node ? node.ownerDocument || node : preferredDoc;
parent = doc.defaultView;
// If no document and documentElement is available, return // Return early if doc is invalid or already selected
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document; return document;
} }
// Set our document // Update global variables
document = doc; document = doc;
docElem = doc.documentElement; docElem = document.documentElement;
documentIsHTML = !isXML( document );
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8 // Support: IE 9-11, Edge
// If iframe document is assigned to "document" variable and if iframe ha // Accessing iframe documents after unload throws "permission denied" err
s been reloaded, ors (jQuery #13936)
// IE will throw "permission denied" error when accessing "document" vari if ( (parent = document.defaultView) && parent.top !== parent ) {
able, see jQuery #13936 // Support: IE 11
// IE6-8 do not support the defaultView property so parent will be undefi
ned
if ( parent && parent !== parent.top ) {
// IE11 does not have attachEvent, so all must suffer
if ( parent.addEventListener ) { if ( parent.addEventListener ) {
parent.addEventListener( "unload", function() { parent.addEventListener( "unload", unloadHandler, false )
setDocument(); ;
}, false );
// Support: IE 9 - 10 only
} else if ( parent.attachEvent ) { } else if ( parent.attachEvent ) {
parent.attachEvent( "onunload", function() { parent.attachEvent( "onunload", unloadHandler );
setDocument();
});
} }
} }
/* Attributes /* Attributes
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
// Support: IE<8 // Support: IE<8
// Verify that getAttribute really returns attributes and not properties // Verify that getAttribute really returns attributes and not properties
(excepting IE8 booleans) // (excepting IE8 booleans)
support.attributes = assert(function( div ) { support.attributes = assert(function( div ) {
div.className = "i"; div.className = "i";
return !div.getAttribute("className"); return !div.getAttribute("className");
}); });
/* getElement(s)By* /* getElement(s)By*
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements // Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) { support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") ); div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length; return !div.getElementsByTagName("*").length;
}); });
// Check if getElementsByClassName can be trusted // Support: IE<9
support.getElementsByClassName = rnative.test( doc.getElementsByClassName support.getElementsByClassName = rnative.test( document.getElementsByClas
) && assert(function( div ) { sName );
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10 // Support: IE<10
// Check if getElementById returns elements by name // Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set na mes, // The broken getElementById methods don't pick up programatically-set na mes,
// so use a roundabout getElementsByName test // so use a roundabout getElementsByName test
support.getById = assert(function( div ) { support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando; docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length; return !document.getElementsByName || !document.getElementsByName ( expando ).length;
}); });
// ID find and filter // ID find and filter
if ( support.getById ) { if ( support.getById ) {
Expr.find["ID"] = function( id, context ) { Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && do cumentIsHTML ) { if ( typeof context.getElementById !== "undefined" && doc umentIsHTML ) {
var m = context.getElementById( id ); var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 return m ? [ m ] : [];
returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [ m ] : [];
} }
}; };
Expr.filter["ID"] = function( id ) { Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape ); var attrId = id.replace( runescape, funescape );
return function( elem ) { return function( elem ) {
return elem.getAttribute("id") === attrId; return elem.getAttribute("id") === attrId;
}; };
}; };
} else { } else {
// Support: IE6/7 // Support: IE6/7
// getElementById is not reliable as a find shortcut // getElementById is not reliable as a find shortcut
delete Expr.find["ID"]; delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) { Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape ); var attrId = id.replace( runescape, funescape );
return function( elem ) { return function( elem ) {
var node = typeof elem.getAttributeNode !== strun var node = typeof elem.getAttributeNode !== "unde
defined && elem.getAttributeNode("id"); fined" &&
elem.getAttributeNode("id");
return node && node.value === attrId; return node && node.value === attrId;
}; };
}; };
} }
// Tag // Tag
Expr.find["TAG"] = support.getElementsByTagName ? Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) { function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) { if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( tag ); return context.getElementsByTagName( tag );
// DocumentFragment nodes don't have gEBTN
} else if ( support.qsa ) {
return context.querySelectorAll( tag );
} }
} : } :
function( tag, context ) { function( tag, context ) {
var elem, var elem,
tmp = [], tmp = [],
i = 0, i = 0,
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
results = context.getElementsByTagName( tag ); results = context.getElementsByTagName( tag );
// Filter out possible comments // Filter out possible comments
if ( tag === "*" ) { if ( tag === "*" ) {
while ( (elem = results[i++]) ) { while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
tmp.push( elem ); tmp.push( elem );
} }
} }
return tmp; return tmp;
} }
return results; return results;
}; };
// Class // Class
Expr.find["CLASS"] = support.getElementsByClassName && function( classNam e, context ) { Expr.find["CLASS"] = support.getElementsByClassName && function( classNam e, context ) {
if ( typeof context.getElementsByClassName !== strundefined && do cumentIsHTML ) { if ( typeof context.getElementsByClassName !== "undefined" && doc umentIsHTML ) {
return context.getElementsByClassName( className ); return context.getElementsByClassName( className );
} }
}; };
/* QSA/matchesSelector /* QSA/matchesSelector
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
// QSA and matchesSelector support // QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5) // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = []; rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21) // qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error // We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe // whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE e rror // So, we allow :focus to pass through QSA all the time to avoid the IE e rror
// See http://bugs.jquery.com/ticket/13378 // See http://bugs.jquery.com/ticket/13378
rbuggyQSA = []; rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) { if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
// Build QSA regex // Build QSA regex
// Regex strategy adopted from Diego Perini // Regex strategy adopted from Diego Perini
assert(function( div ) { assert(function( div ) {
// Select is set to empty string on purpose // Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly // This is to test IE's treatment of not explicitly
// setting a boolean content attribute, // setting a boolean content attribute,
// since its presence should be enough // since its presence should be enough
// http://bugs.jquery.com/ticket/12359 // http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select msallowclip=''><option selected= docElem.appendChild( div ).innerHTML = "<a id='" + expand
''></option></select>"; o + "'></a>" +
"<select id='" + expando + "-\r\\' msallowcapture
=''>" +
"<option selected=''></option></select>";
// Support: IE8, Opera 11-12.16 // Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^ = or $= or *= // Nothing should be selected when empty strings follow ^ = or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT // The test attribute must be unknown in Opera but "safe" for WinRT
// http://msdn.microsoft.com/en-us/library/ie/hh465388.as px#attribute_section // http://msdn.microsoft.com/en-us/library/ie/hh465388.as px#attribute_section
if ( div.querySelectorAll("[msallowclip^='']").length ) { if ( div.querySelectorAll("[msallowcapture^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\ "\")" ); rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\ "\")" );
} }
// Support: IE8 // Support: IE8
// Boolean attributes and "value" are not treated correct ly // Boolean attributes and "value" are not treated correct ly
if ( !div.querySelectorAll("[selected]").length ) { if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
} }
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+
, PhantomJS<1.9.8+
if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).le
ngth ) {
rbuggyQSA.push("~=");
}
// Webkit/Opera - :checked should return selected option elements // Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/ #checked // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/ #checked
// IE8 throws error here and will not see later tests // IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) { if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked"); rbuggyQSA.push(":checked");
} }
// Support: Safari 8+, iOS 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// In-page `selector#id sibing-combinator selector` fails
if ( !div.querySelectorAll( "a#" + expando + "+*" ).lengt
h ) {
rbuggyQSA.push(".#.+[+~]");
}
}); });
assert(function( div ) { assert(function( div ) {
// Support: Windows 8 Native Apps // Support: Windows 8 Native Apps
// The type and name attributes are restricted during .in nerHTML assignment // The type and name attributes are restricted during .in nerHTML assignment
var input = doc.createElement("input"); var input = document.createElement("input");
input.setAttribute( "type", "hidden" ); input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "name", "D" ); div.appendChild( input ).setAttribute( "name", "D" );
// Support: IE8 // Support: IE8
// Enforce case-sensitivity of name attribute // Enforce case-sensitivity of name attribute
if ( div.querySelectorAll("[name=d]").length ) { if ( div.querySelectorAll("[name=d]").length ) {
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]? =" ); rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]? =" );
} }
// FF 3.5 - :enabled/:disabled and hidden elements (hidde n elements are still enabled) // FF 3.5 - :enabled/:disabled and hidden elements (hidde n elements are still enabled)
skipping to change at line 1282 skipping to change at line 1310
} }
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("| ") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("| ") );
/* Contains /* Contains
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
hasCompare = rnative.test( docElem.compareDocumentPosition ); hasCompare = rnative.test( docElem.compareDocumentPosition );
// Element contains another // Element contains another
// Purposefully does not implement inclusive descendent // Purposefully self-exclusive
// As in, an element does not contain itself // As in, an element does not contain itself
contains = hasCompare || rnative.test( docElem.contains ) ? contains = hasCompare || rnative.test( docElem.contains ) ?
function( a, b ) { function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a, var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode; bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && ( return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ? adown.contains ?
adown.contains( bup ) : adown.contains( bup ) :
a.compareDocumentPosition && a.compareDoc umentPosition( bup ) & 16 a.compareDocumentPosition && a.compareDoc umentPosition( bup ) & 16
)); ));
skipping to change at line 1336 skipping to change at line 1364
a.compareDocumentPosition( b ) : a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected // Otherwise we know they are disconnected
1; 1;
// Disconnected nodes // Disconnected nodes
if ( compare & 1 || if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our prefer red document // Choose the first element that is related to our prefer red document
if ( a === doc || a.ownerDocument === preferredDoc && con tains(preferredDoc, a) ) { if ( a === document || a.ownerDocument === preferredDoc & & contains(preferredDoc, a) ) {
return -1; return -1;
} }
if ( b === doc || b.ownerDocument === preferredDoc && con tains(preferredDoc, b) ) { if ( b === document || b.ownerDocument === preferredDoc & & contains(preferredDoc, b) ) {
return 1; return 1;
} }
// Maintain original order // Maintain original order
return sortInput ? return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( so rtInput, b ) ) : ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0; 0;
} }
return compare & 4 ? -1 : 1; return compare & 4 ? -1 : 1;
} : } :
function( a, b ) { function( a, b ) {
// Exit early if the nodes are identical // Exit early if the nodes are identical
if ( a === b ) { if ( a === b ) {
hasDuplicate = true; hasDuplicate = true;
return 0; return 0;
skipping to change at line 1367 skipping to change at line 1395
var cur, var cur,
i = 0, i = 0,
aup = a.parentNode, aup = a.parentNode,
bup = b.parentNode, bup = b.parentNode,
ap = [ a ], ap = [ a ],
bp = [ b ]; bp = [ b ];
// Parentless nodes are either documents or disconnected // Parentless nodes are either documents or disconnected
if ( !aup || !bup ) { if ( !aup || !bup ) {
return a === doc ? -1 : return a === document ? -1 :
b === doc ? 1 : b === document ? 1 :
aup ? -1 : aup ? -1 :
bup ? 1 : bup ? 1 :
sortInput ? sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( so rtInput, b ) ) : ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0; 0;
// If the nodes are siblings, we can do a quick check // If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) { } else if ( aup === bup ) {
return siblingCheck( a, b ); return siblingCheck( a, b );
} }
// Otherwise we need full lists of their ancestors for comparison // Otherwise we need full lists of their ancestors for comparison
cur = a; cur = a;
while ( (cur = cur.parentNode) ) { while ( (cur = cur.parentNode) ) {
skipping to change at line 1405 skipping to change at line 1433
return i ? return i ?
// Do a sibling check if the nodes have a common ancestor // Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) : siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first // Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 : ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 : bp[i] === preferredDoc ? 1 :
0; 0;
}; };
return doc; return document;
}; };
Sizzle.matches = function( expr, elements ) { Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements ); return Sizzle( expr, null, null, elements );
}; };
Sizzle.matchesSelector = function( elem, expr ) { Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed // Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) { if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem ); setDocument( elem );
} }
// Make sure that attribute selectors are quoted // Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" ); expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML && if ( support.matchesSelector && documentIsHTML &&
!compilerCache[ expr + " " ] &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try { try {
var ret = matches.call( elem, expr ); var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected n odes // IE 9's matchesSelector returns false on disconnected n odes
if ( ret || support.disconnectedMatch || if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said t o be in a document // As well, disconnected nodes are said t o be in a document
// fragment in IE 9 // fragment in IE 9
elem.document && elem.document.nodeType ! == 11 ) { elem.document && elem.document.nodeType ! == 11 ) {
return ret; return ret;
} }
} catch(e) {} } catch (e) {}
} }
return Sizzle( expr, document, null, [ elem ] ).length > 0; return Sizzle( expr, document, null, [ elem ] ).length > 0;
}; };
Sizzle.contains = function( context, elem ) { Sizzle.contains = function( context, elem ) {
// Set document vars if needed // Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) { if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context ); setDocument( context );
} }
skipping to change at line 1654 skipping to change at line 1683
return elem.nodeName && elem.nodeName.toL owerCase() === nodeName; return elem.nodeName && elem.nodeName.toL owerCase() === nodeName;
}; };
}, },
"CLASS": function( className ) { "CLASS": function( className ) {
var pattern = classCache[ className + " " ]; var pattern = classCache[ className + " " ];
return pattern || return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) { classCache( className, function( elem ) {
return pattern.test( typeof elem.classNam e === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" ); return pattern.test( typeof elem.classNam e === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
}); });
}, },
"ATTR": function( name, operator, check ) { "ATTR": function( name, operator, check ) {
return function( elem ) { return function( elem ) {
var result = Sizzle.attr( elem, name ); var result = Sizzle.attr( elem, name );
if ( result == null ) { if ( result == null ) {
return operator === "!="; return operator === "!=";
} }
skipping to change at line 1676 skipping to change at line 1705
return true; return true;
} }
result += ""; result += "";
return operator === "=" ? result === check : return operator === "=" ? result === check :
operator === "!=" ? result !== check : operator === "!=" ? result !== check :
operator === "^=" ? check && result.index Of( check ) === 0 : operator === "^=" ? check && result.index Of( check ) === 0 :
operator === "*=" ? check && result.index Of( check ) > -1 : operator === "*=" ? check && result.index Of( check ) > -1 :
operator === "$=" ? check && result.slice ( -check.length ) === check : operator === "$=" ? check && result.slice ( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "~=" ? ( " " + result.replac e( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || r esult.slice( 0, check.length + 1 ) === check + "-" : operator === "|=" ? result === check || r esult.slice( 0, check.length + 1 ) === check + "-" :
false; false;
}; };
}, },
"CHILD": function( type, what, argument, first, last ) { "CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth", var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last", forward = type.slice( -4 ) !== "last",
ofType = what === "of-type"; ofType = what === "of-type";
return first === 1 && last === 0 ? return first === 1 && last === 0 ?
// Shortcut for :nth-*(n) // Shortcut for :nth-*(n)
function( elem ) { function( elem ) {
return !!elem.parentNode; return !!elem.parentNode;
} : } :
function( elem, context, xml ) { function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIn dex, start, var cache, uniqueCache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextS ibling" : "previousSibling", dir = simple !== forward ? "nextS ibling" : "previousSibling",
parent = elem.parentNode, parent = elem.parentNode,
name = ofType && elem.nodeName.to LowerCase(), name = ofType && elem.nodeName.to LowerCase(),
useCache = !xml && !ofType; useCache = !xml && !ofType,
diff = false;
if ( parent ) { if ( parent ) {
// :(first|last|only)-(child|of-t ype) // :(first|last|only)-(child|of-t ype)
if ( simple ) { if ( simple ) {
while ( dir ) { while ( dir ) {
node = elem; node = elem;
while ( (node = n ode[ dir ]) ) { while ( (node = n ode[ dir ]) ) {
if ( ofTy if ( ofTy
pe ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { pe ?
n
ode.nodeName.toLowerCase() === name :
n
ode.nodeType === 1 ) {
r eturn false; r eturn false;
} }
} }
// Reverse direct ion for :only-* (if we haven't yet done so) // Reverse direct ion for :only-* (if we haven't yet done so)
start = dir = typ e === "only" && !start && "nextSibling"; start = dir = typ e === "only" && !start && "nextSibling";
} }
return true; return true;
} }
start = [ forward ? parent.firstC hild : parent.lastChild ]; start = [ forward ? parent.firstC hild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent` // non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) { if ( forward && useCache ) {
// Seek `elem` from a pre viously-cached index // Seek `elem` from a pre viously-cached index
outerCache = parent[ expa
ndo ] || (parent[ expando ] = {}); // ...in a gzip-friendly
cache = outerCache[ type way
] || []; node = parent;
nodeIndex = cache[0] === outerCache = node[ expand
dirruns && cache[1]; o ] || (node[ expando ] = {});
diff = cache[0] === dirru
ns && cache[2]; // 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 && cache
[ 2 ];
node = nodeIndex && paren t.childNodes[ nodeIndex ]; node = nodeIndex && paren t.childNodes[ nodeIndex ];
while ( (node = ++nodeInd ex && node && node[ dir ] || while ( (node = ++nodeInd ex && node && node[ dir ] ||
// Fallback to se eking `elem` from the start // Fallback to se eking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) { (diff = nodeIndex = 0) || start.pop()) ) {
// When found, ca che indexes on `parent` and break // When found, ca che indexes on `parent` and break
if ( node.nodeTyp e === 1 && ++diff && node === elem ) { if ( node.nodeTyp e === 1 && ++diff && node === elem ) {
outerCach e[ type ] = [ dirruns, nodeIndex, diff ]; uniqueCac he[ type ] = [ dirruns, nodeIndex, diff ];
break; break;
} }
} }
// Use previously-cached element
index if available
} else if ( useCache && (cache =
(elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-la
st-child(...) or :nth(-last)?-of-type(...)
} else { } else {
// Use the same loop as a // Use previously-cached
bove to seek `elem` from the start element index if available
while ( (node = ++nodeInd if ( useCache ) {
ex && node && node[ dir ] || // ...in a gzip-f
(diff = nodeIndex riendly way
= 0) || start.pop()) ) { node = elem;
outerCache = node
[ expando ] || (node[ expando ] = {});
if ( ( ofType ? n // Support: IE <9
ode.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { only
// Cache // Defend against
the index of each encountered element cloned attroperties (jQuery gh-1709)
if ( useC uniqueCache = out
ache ) { erCache[ node.uniqueID ] ||
( (outerCac
node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; he[ node.uniqueID ] = {});
}
cache = uniqueCac
he[ type ] || [];
nodeIndex = cache
[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex;
}
if ( node // xml :nth-child(...)
=== elem ) { // or :nth-last-child(...
b ) or :nth(-last)?-of-type(...)
reak; if ( diff === false ) {
// Use the same l
oop as above to seek `elem` from the start
while ( (node = +
+nodeIndex && node && node[ dir ] ||
(diff = n
odeIndex = 0) || start.pop()) ) {
if ( ( of
Type ?
n
ode.nodeName.toLowerCase() === name :
n
ode.nodeType === 1 ) &&
+
+diff ) {
/
/ Cache the index of each encountered element
i
f ( useCache ) {
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
uniqueCache[ type ] = [ dirruns, diff ];
}
i
f ( node === elem ) {
break;
}
} }
} }
} }
} }
// Incorporate the offset, then c heck against cycle size // Incorporate the offset, then c heck against cycle size
diff -= last; diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 ); return diff === first || ( diff % first === 0 && diff / first >= 0 );
} }
}; };
skipping to change at line 1796 skipping to change at line 1865
// But maintain support for old signatures // But maintain support for old signatures
if ( fn.length > 1 ) { if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ]; args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toL owerCase() ) ? return Expr.setFilters.hasOwnProperty( pseudo.toL owerCase() ) ?
markFunction(function( seed, matches ) { markFunction(function( seed, matches ) {
var idx, var idx,
matched = fn( seed, argum ent ), matched = fn( seed, argum ent ),
i = matched.length; i = matched.length;
while ( i-- ) { while ( i-- ) {
idx = indexOf.call( seed, matched[i] ); idx = indexOf( seed, matc hed[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] );
} }
}) : }) :
function( elem ) { function( elem ) {
return fn( elem, 0, args ); return fn( elem, 0, args );
}; };
} }
return fn; return fn;
} }
skipping to change at line 1835 skipping to change at line 1904
// Match elements unmatched by `matcher` // Match elements unmatched by `matcher`
while ( i-- ) { while ( i-- ) {
if ( (elem = unmatched[i]) ) { if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem); seed[i] = !(matches[i] = elem);
} }
} }
}) : }) :
function( elem, context, xml ) { function( elem, context, xml ) {
input[0] = elem; input[0] = elem;
matcher( input, null, xml, results ); matcher( input, null, xml, results );
// Don't keep the element (issue #299)
input[0] = null;
return !results.pop(); return !results.pop();
}; };
}), }),
"has": markFunction(function( selector ) { "has": markFunction(function( selector ) {
return function( elem ) { return function( elem ) {
return Sizzle( selector, elem ).length > 0; return Sizzle( selector, elem ).length > 0;
}; };
}), }),
"contains": markFunction(function( text ) { "contains": markFunction(function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) { return function( elem ) {
return ( elem.textContent || elem.innerText || ge tText( elem ) ).indexOf( text ) > -1; return ( elem.textContent || elem.innerText || ge tText( elem ) ).indexOf( text ) > -1;
}; };
}), }),
// "Whether an element is represented by a :lang() selector // "Whether an element is represented by a :lang() selector
// is based solely on the element's language value // is based solely on the element's language value
// being equal to the identifier C, // being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-" . // or beginning with the identifier C immediately followed by "-" .
// The matching of C against the element's language value is perf ormed case-insensitively. // The matching of C against the element's language value is perf ormed case-insensitively.
skipping to change at line 2117 skipping to change at line 2189
function( elem, context, xml ) { function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) { while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) { if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml ); return matcher( elem, context, xml );
} }
} }
} : } :
// Check against all ancestor/preceding elements // Check against all ancestor/preceding elements
function( elem, context, xml ) { function( elem, context, xml ) {
var oldCache, outerCache, var oldCache, uniqueCache, outerCache,
newCache = [ dirruns, doneName ]; newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don' t benefit from dir caching // We can't set arbitrary data on XML nodes, so they don' t benefit from combinator caching
if ( xml ) { if ( xml ) {
while ( (elem = elem[ dir ]) ) { while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonEleme nts ) { if ( elem.nodeType === 1 || checkNonEleme nts ) {
if ( matcher( elem, context, xml ) ) { if ( matcher( elem, context, xml ) ) {
return true; return true;
} }
} }
} }
} else { } else {
while ( (elem = elem[ dir ]) ) { while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonEleme nts ) { if ( elem.nodeType === 1 || checkNonEleme nts ) {
outerCache = elem[ expando ] || ( elem[ expando ] = {}); outerCache = elem[ expando ] || ( elem[ expando ] = {});
if ( (oldCache = outerCache[ dir
]) && // Support: IE <9 only
// Defend against cloned attroper
ties (jQuery gh-1709)
uniqueCache = outerCache[ elem.un
iqueID ] || (outerCache[ elem.uniqueID ] = {});
if ( (oldCache = uniqueCache[ dir
]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements // Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = o ldCache[ 2 ]); return (newCache[ 2 ] = o ldCache[ 2 ]);
} else { } else {
// Reuse newcache so resu lts back-propagate to previous elements // Reuse newcache so resu lts back-propagate to previous elements
outerCache[ dir ] = newCa che; uniqueCache[ dir ] = newC ache;
// A match means we're do ne; a fail means we have to keep checking // A match means we're do ne; a fail means we have to keep checking
if ( (newCache[ 2 ] = mat cher( elem, context, xml )) ) { if ( (newCache[ 2 ] = mat cher( elem, context, xml )) ) {
return true; return true;
} }
} }
} }
} }
} }
}; };
skipping to change at line 2267 skipping to change at line 2344
temp.push( (matcherIn[i] = elem) ); temp.push( (matcherIn[i] = elem) );
} }
} }
postFinder( null, (matcherOut = []), temp , xml ); postFinder( null, (matcherOut = []), temp , xml );
} }
// Move matched elements from seed to results to keep them synchronized // Move matched elements from seed to results to keep them synchronized
i = matcherOut.length; i = matcherOut.length;
while ( i-- ) { while ( i-- ) {
if ( (elem = matcherOut[i]) && if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call ( seed, elem ) : preMap[i]) > -1 ) { (temp = postFinder ? indexOf( see d, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = el em); seed[temp] = !(results[temp] = el em);
} }
} }
} }
// Add elements to results, through postFinder if defined // Add elements to results, through postFinder if defined
} else { } else {
matcherOut = condense( matcherOut = condense(
matcherOut === results ? matcherOut === results ?
skipping to change at line 2302 skipping to change at line 2379
len = tokens.length, len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ], leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "], implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0, i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable f rom top-level context(s) // The foundational matcher ensures that elements are reachable f rom top-level context(s)
matchContext = addCombinator( function( elem ) { matchContext = addCombinator( function( elem ) {
return elem === checkContext; return elem === checkContext;
}, implicitRelative, true ), }, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) { matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1; return indexOf( checkContext, elem ) > -1;
}, implicitRelative, true ), }, implicitRelative, true ),
matchers = [ function( elem, context, xml ) { matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermo stContext ) ) || ( var ret = ( !leadingRelative && ( xml || context !== oute rmostContext ) ) || (
(checkContext = context).nodeType ? (checkContext = context).nodeType ?
matchContext( elem, context, xml ) : matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) ); matchAnyContext( elem, context, xml ) );
// Avoid hanging onto element (issue #299)
checkContext = null;
return ret;
} ]; } ];
for ( ; i < len; i++ ) { for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), ma tcher) ]; matchers = [ addCombinator(elementMatcher( matchers ), ma tcher) ];
} else { } else {
matcher = Expr.filter[ tokens[i].type ].apply( null, toke ns[i].matches ); matcher = Expr.filter[ tokens[i].type ].apply( null, toke ns[i].matches );
// Return special upon seeing a positional matcher // Return special upon seeing a positional matcher
if ( matcher[ expando ] ) { if ( matcher[ expando ] ) {
skipping to change at line 2362 skipping to change at line 2442
unmatched = seed && [], unmatched = seed && [],
setMatched = [], setMatched = [],
contextBackup = outermostContext, contextBackup = outermostContext,
// We must always have either seed elements or ou termost context // We must always have either seed elements or ou termost context
elems = seed || byElement && Expr.find["TAG"]( "* ", outermost ), elems = seed || byElement && Expr.find["TAG"]( "* ", outermost ),
// Use integer dirruns iff this is the outermost matcher // Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length; len = elems.length;
if ( outermost ) { if ( outermost ) {
outermostContext = context !== document && contex t; outermostContext = context === document || contex t || outermost;
} }
// Add elements passing elementMatchers directly to resul ts // Add elements passing elementMatchers directly to resul ts
// Keep `i` a string if there are no elements so `matched Count` will be "00" below
// Support: IE<9, Safari // Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <n umber>) matching elements by id // Tolerate NodeList properties (IE: "length"; Safari: <n umber>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) { for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) { if ( byElement && elem ) {
j = 0; j = 0;
if ( !context && elem.ownerDocument !== d
ocument ) {
setDocument( elem );
xml = !documentIsHTML;
}
while ( (matcher = elementMatchers[j++]) ) { while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) { if ( matcher( elem, context || do cument, xml) ) {
results.push( elem ); results.push( elem );
break; break;
} }
} }
if ( outermost ) { if ( outermost ) {
dirruns = dirrunsUnique; dirruns = dirrunsUnique;
} }
} }
// Track unmatched elements for set filters // Track unmatched elements for set filters
skipping to change at line 2397 skipping to change at line 2480
matchedCount--; matchedCount--;
} }
// Lengthen the array for every element, matched or not // Lengthen the array for every element, matched or not
if ( seed ) { if ( seed ) {
unmatched.push( elem ); unmatched.push( elem );
} }
} }
} }
// Apply set filters to unmatched elements // `i` is now the count of elements visited above, and ad
ding it to `matchedCount`
// makes the latter nonnegative.
matchedCount += i; matchedCount += i;
// Apply set filters to unmatched elements
// NOTE: This can be skipped if there are no unmatched el
ements (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 ) { if ( bySet && i !== matchedCount ) {
j = 0; j = 0;
while ( (matcher = setMatchers[j++]) ) { while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml ); matcher( unmatched, setMatched, context, xml );
} }
if ( seed ) { if ( seed ) {
// Reintegrate element matches to elimina te the need for sorting // Reintegrate element matches to elimina te the need for sorting
if ( matchedCount > 0 ) { if ( matchedCount > 0 ) {
while ( i-- ) { while ( i-- ) {
skipping to change at line 2490 skipping to change at line 2582
* @param {Array} [results] * @param {Array} [results]
* @param {Array} [seed] A set of elements to match against * @param {Array} [seed] A set of elements to match against
*/ */
select = Sizzle.select = function( selector, context, results, seed ) { select = Sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find, var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector, compiled = typeof selector === "function" && selector,
match = !seed && tokenize( (selector = compiled.selector || selec tor) ); match = !seed && tokenize( (selector = compiled.selector || selec tor) );
results = results || []; results = results || [];
// Try to minimize operations if there is no seed and only one group // Try to minimize operations if there is only one selector in the list a
nd no seed
// (the latter of which guarantees us context)
if ( match.length === 1 ) { if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID // Reduce context if the leading compound selector is an ID
tokens = match[0] = match[0].slice( 0 ); tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && docu mentIsHTML && support.getById && context.nodeType === 9 && docu mentIsHTML &&
Expr.relative[ tokens[1].type ] ) { Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(run escape, funescape), context ) || [] )[0]; context = ( Expr.find["ID"]( token.matches[0].replace(run escape, funescape), context ) || [] )[0];
if ( !context ) { if ( !context ) {
return results; return results;
// Precompiled matchers will still verify ancestry, so st ep up a level // Precompiled matchers will still verify ancestry, so st ep up a level
skipping to change at line 2548 skipping to change at line 2641
} }
} }
// Compile and execute a filtering function if one is not provided // Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector ab ove // Provide `match` to avoid retokenization if we modified the selector ab ove
( compiled || compile( selector, match ) )( ( compiled || compile( selector, match ) )(
seed, seed,
context, context,
!documentIsHTML, !documentIsHTML,
results, results,
rsibling.test( selector ) && testContext( context.parentNode ) || context !context || rsibling.test( selector ) && testContext( context.par entNode ) || context
); );
return results; return results;
}; };
// One-time assignments // One-time assignments
// Sort stability // Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14 // Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function // Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate; support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document // Initialize against the default document
setDocument(); setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other* // Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) { support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following) // Should return 1, but returns 4 (following)
skipping to change at line 2622 skipping to change at line 2715
} }
}); });
} }
return Sizzle; return Sizzle;
})( window ); })( window );
jQuery.find = Sizzle; jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors; jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort; jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText; jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML; jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains; jQuery.contains = Sizzle.contains;
var dir = function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
var siblings = function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext; var rneedsContext = jQuery.expr.match.needsContext;
var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
var risSimple = /^.[^:#\[\.,]*$/; var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not // Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) { function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) { if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) { return jQuery.grep( elements, function( elem, i ) {
/* jshint -W018 */ /* jshint -W018 */
return !!qualifier.call( elem, i, elem ) !== not; return !!qualifier.call( elem, i, elem ) !== not;
}); } );
} }
if ( qualifier.nodeType ) { if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) { return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not; return ( elem === qualifier ) !== not;
}); } );
} }
if ( typeof qualifier === "string" ) { if ( typeof qualifier === "string" ) {
if ( risSimple.test( qualifier ) ) { if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not ); return jQuery.filter( qualifier, elements, not );
} }
qualifier = jQuery.filter( qualifier, elements ); qualifier = jQuery.filter( qualifier, elements );
} }
return jQuery.grep( elements, function( elem ) { return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not; return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
}); } );
} }
jQuery.filter = function( expr, elems, not ) { jQuery.filter = function( expr, elems, not ) {
var elem = elems[ 0 ]; var elem = elems[ 0 ];
if ( not ) { if ( not ) {
expr = ":not(" + expr + ")"; expr = ":not(" + expr + ")";
} }
return elems.length === 1 && elem.nodeType === 1 ? return elems.length === 1 && elem.nodeType === 1 ?
jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1; return elem.nodeType === 1;
})); } ) );
}; };
jQuery.fn.extend({ jQuery.fn.extend( {
find: function( selector ) { find: function( selector ) {
var i, var i,
ret = [], ret = [],
self = this, self = this,
len = self.length; len = self.length;
if ( typeof selector !== "string" ) { if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter(function () { return this.pushStack( jQuery( selector ).filter( functio n() {
for ( i = 0; i < len; i++ ) { for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) { if ( jQuery.contains( self[ i ], this ) ) {
return true; return true;
} }
} }
}) ); } ) );
} }
for ( i = 0; i < len; i++ ) { for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret ); jQuery.find( selector, self[ i ], ret );
} }
// Needed because $( selector, context ) becomes $( context ).fin d( selector ) // Needed because $( selector, context ) becomes $( context ).fin d( selector )
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
ret.selector = this.selector ? this.selector + " " + selector : s elector; ret.selector = this.selector ? this.selector + " " + selector : s elector;
return ret; return ret;
}, },
filter: function( selector ) { filter: function( selector ) {
return this.pushStack( winnow(this, selector || [], false) ); return this.pushStack( winnow( this, selector || [], false ) );
}, },
not: function( selector ) { not: function( selector ) {
return this.pushStack( winnow(this, selector || [], true) ); return this.pushStack( winnow( this, selector || [], true ) );
}, },
is: function( selector ) { is: function( selector ) {
return !!winnow( return !!winnow(
this, this,
// If this is a positional/relative selector, check membe rship in the returned set // If this is a positional/relative selector, check membe rship in the returned set
// so $("p:first").is("p:last") won't return true for a d oc with two "p". // so $("p:first").is("p:last") won't return true for a d oc with two "p".
typeof selector === "string" && rneedsContext.test( selec tor ) ? typeof selector === "string" && rneedsContext.test( selec tor ) ?
jQuery( selector ) : jQuery( selector ) :
selector || [], selector || [],
false false
).length; ).length;
} }
}); } );
// Initialize a jQuery object // Initialize a jQuery object
// A central reference to the root jQuery(document) // A central reference to the root jQuery(document)
var rootjQuery, var rootjQuery,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
// A simple way to check for HTML strings // A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <) // Strict HTML recognition (#11290: must start with <)
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
init = jQuery.fn.init = function( selector, context ) { init = jQuery.fn.init = function( selector, context, root ) {
var match, elem; var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false) // HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) { if ( !selector ) {
return this; return this;
} }
// init accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings // Handle HTML strings
if ( typeof selector === "string" ) { if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selec if ( selector.charAt( 0 ) === "<" &&
tor.length - 1 ) === ">" && selector.length >= 3 ) { selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check // Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ]; match = [ null, selector, null ];
} else { } else {
match = rquickExpr.exec( selector ); match = rquickExpr.exec( selector );
} }
// Match html or make sure no context is specified for #i d // Match html or make sure no context is specified for #i d
if ( match && (match[1] || !context) ) { if ( match && ( match[ 1 ] || !context ) ) {
// HANDLE: $(html) -> $(array) // HANDLE: $(html) -> $(array)
if ( match[1] ) { if ( match[ 1 ] ) {
context = context instanceof jQuery ? con context = context instanceof jQuery ? con
text[0] : context; text[ 0 ] : context;
// scripts is true for back-compat // scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present // Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML( jQuery.merge( this, jQuery.parseHTML(
match[1], match[ 1 ],
context && context.nodeType ? con text.ownerDocument || context : document, context && context.nodeType ? con text.ownerDocument || context : document,
true true
) ); ) );
// HANDLE: $(html, props) // HANDLE: $(html, props)
if ( rsingleTag.test( match[1] ) && jQuer y.isPlainObject( context ) ) { if ( rsingleTag.test( match[ 1 ] ) && jQu ery.isPlainObject( context ) ) {
for ( match in context ) { for ( match in context ) {
// Properties of context are called as methods if possible // Properties of context are called as methods if possible
if ( jQuery.isFunction( t his[ match ] ) ) { if ( jQuery.isFunction( t his[ match ] ) ) {
this[ match ]( co ntext[ match ] ); this[ match ]( co ntext[ match ] );
// ...and otherwise set a s attributes // ...and otherwise set a s attributes
} else { } else {
this.attr( match, context[ match ] ); this.attr( match, context[ match ] );
} }
} }
} }
return this; return this;
// HANDLE: $(#id) // HANDLE: $(#id)
} else { } else {
elem = document.getElementById( match[2] ); elem = document.getElementById( match[ 2 ] );
// Check parentNode to catch when Blackbe rry 4.6 returns // Check parentNode to catch when Blackbe rry 4.6 returns
// nodes that are no longer in the docume nt #6963 // nodes that are no longer in the docume nt #6963
if ( elem && elem.parentNode ) { if ( elem && elem.parentNode ) {
// Handle the case where IE and O pera return items // Handle the case where IE and O pera return items
// by name instead of ID // by name instead of ID
if ( elem.id !== match[2] ) { if ( elem.id !== match[ 2 ] ) {
return rootjQuery.find( s elector ); return rootjQuery.find( s elector );
} }
// Otherwise, we inject the eleme nt directly into the jQuery object // Otherwise, we inject the eleme nt directly into the jQuery object
this.length = 1; this.length = 1;
this[0] = elem; this[ 0 ] = elem;
} }
this.context = document; this.context = document;
this.selector = selector; this.selector = selector;
return this; return this;
} }
// HANDLE: $(expr, $(...)) // HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) { } else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector ) ; return ( context || root ).find( selector );
// HANDLE: $(expr, context) // HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr) // (which is just equivalent to: $(context).find(expr)
} else { } else {
return this.constructor( context ).find( selector ); return this.constructor( context ).find( selector );
} }
// HANDLE: $(DOMElement) // HANDLE: $(DOMElement)
} else if ( selector.nodeType ) { } else if ( selector.nodeType ) {
this.context = this[0] = selector; this.context = this[ 0 ] = selector;
this.length = 1; this.length = 1;
return this; return this;
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) { } else if ( jQuery.isFunction( selector ) ) {
return typeof rootjQuery.ready !== "undefined" ? return typeof root.ready !== "undefined" ?
rootjQuery.ready( selector ) : root.ready( selector ) :
// Execute immediately if ready is not present // Execute immediately if ready is not present
selector( jQuery ); selector( jQuery );
} }
if ( selector.selector !== undefined ) { if ( selector.selector !== undefined ) {
this.selector = selector.selector; this.selector = selector.selector;
this.context = selector.context; this.context = selector.context;
} }
return jQuery.makeArray( selector, this ); return jQuery.makeArray( selector, this );
}; };
// Give the init function the jQuery prototype for later instantiation // Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn; init.prototype = jQuery.fn;
// Initialize central reference // Initialize central reference
rootjQuery = jQuery( document ); rootjQuery = jQuery( document );
var rparentsprev = /^(?:parents|prev(?:Until|All))/, var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// methods guaranteed to produce a unique set when starting from a unique set // methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = { guaranteedUnique = {
children: true, children: true,
contents: true, contents: true,
next: true, next: true,
prev: true prev: true
}; };
jQuery.extend({ jQuery.fn.extend( {
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.
nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
jQuery.fn.extend({
has: function( target ) { has: function( target ) {
var i, var i,
targets = jQuery( target, this ), targets = jQuery( target, this ),
len = targets.length; len = targets.length;
return this.filter(function() { return this.filter( function() {
for ( i = 0; i < len; i++ ) { for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) { if ( jQuery.contains( this, targets[ i ] ) ) {
return true; return true;
} }
} }
}); } );
}, },
closest: function( selectors, context ) { closest: function( selectors, context ) {
var cur, var cur,
i = 0, i = 0,
l = this.length, l = this.length,
matched = [], matched = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) : jQuery( selectors, context || this.context ) :
0; 0;
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
for ( cur = this[i]; cur && cur !== context; cur = cur.pa for ( cur = this[ i ]; cur && cur !== context; cur = cur.
rentNode ) { parentNode ) {
// Always skip document fragments // Always skip document fragments
if ( cur.nodeType < 11 && (pos ? if ( cur.nodeType < 11 && ( pos ?
pos.index(cur) > -1 : pos.index( cur ) > -1 :
// Don't pass non-elements to Sizzle // Don't pass non-elements to Sizzle
cur.nodeType === 1 && cur.nodeType === 1 &&
jQuery.find.matchesSelector(cur, selectors)) ) { jQuery.find.matchesSelector( cur, selectors ) ) ) {
matched.push( cur ); matched.push( cur );
break; break;
} }
} }
} }
return this.pushStack( matched.length > 1 ? jQuery.unique( matche d ) : matched ); return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( ma tched ) : matched );
}, },
// Determine the position of an element within // Determine the position of an element within
// the matched set of elements // the matched set of elements
index: function( elem ) { index: function( elem ) {
// No argument, return index in parent // No argument, return index in parent
if ( !elem ) { if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.first().p revAll().length : -1; return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first ().prevAll().length : -1;
} }
// index in selector // index in selector
if ( typeof elem === "string" ) { if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) ); return jQuery.inArray( this[ 0 ], jQuery( elem ) );
} }
// Locate the position of the desired element // Locate the position of the desired element
return jQuery.inArray( return jQuery.inArray(
// If it receives a jQuery object, the first element is u sed // If it receives a jQuery object, the first element is u sed
elem.jquery ? elem[0] : elem, this ); elem.jquery ? elem[ 0 ] : elem, this );
}, },
add: function( selector, context ) { add: function( selector, context ) {
return this.pushStack( return this.pushStack(
jQuery.unique( jQuery.uniqueSort(
jQuery.merge( this.get(), jQuery( selector, conte xt ) ) jQuery.merge( this.get(), jQuery( selector, conte xt ) )
) )
); );
}, },
addBack: function( selector ) { addBack: function( selector ) {
return this.add( selector == null ? return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector) this.prevObject : this.prevObject.filter( selector )
); );
} }
}); } );
function sibling( cur, dir ) { function sibling( cur, dir ) {
do { do {
cur = cur[ dir ]; cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 ); } while ( cur && cur.nodeType !== 1 );
return cur; return cur;
} }
jQuery.each({ jQuery.each( {
parent: function( elem ) { parent: function( elem ) {
var parent = elem.parentNode; var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null; return parent && parent.nodeType !== 11 ? parent : null;
}, },
parents: function( elem ) { parents: function( elem ) {
return jQuery.dir( elem, "parentNode" ); return dir( elem, "parentNode" );
}, },
parentsUntil: function( elem, i, until ) { parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until ); return dir( elem, "parentNode", until );
}, },
next: function( elem ) { next: function( elem ) {
return sibling( elem, "nextSibling" ); return sibling( elem, "nextSibling" );
}, },
prev: function( elem ) { prev: function( elem ) {
return sibling( elem, "previousSibling" ); return sibling( elem, "previousSibling" );
}, },
nextAll: function( elem ) { nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" ); return dir( elem, "nextSibling" );
}, },
prevAll: function( elem ) { prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" ); return dir( elem, "previousSibling" );
}, },
nextUntil: function( elem, i, until ) { nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until ); return dir( elem, "nextSibling", until );
}, },
prevUntil: function( elem, i, until ) { prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until ); return dir( elem, "previousSibling", until );
}, },
siblings: function( elem ) { siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); return siblings( ( elem.parentNode || {} ).firstChild, elem );
}, },
children: function( elem ) { children: function( elem ) {
return jQuery.sibling( elem.firstChild ); return siblings( elem.firstChild );
}, },
contents: function( elem ) { contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ? return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document : elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes ); jQuery.merge( [], elem.childNodes );
} }
}, function( name, fn ) { }, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) { jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until ); var ret = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) { if ( name.slice( -5 ) !== "Until" ) {
selector = until; selector = until;
} }
if ( selector && typeof selector === "string" ) { if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret ); ret = jQuery.filter( selector, ret );
} }
if ( this.length > 1 ) { if ( this.length > 1 ) {
// Remove duplicates // Remove duplicates
if ( !guaranteedUnique[ name ] ) { if ( !guaranteedUnique[ name ] ) {
ret = jQuery.unique( ret ); ret = jQuery.uniqueSort( ret );
} }
// Reverse order for parents* and prev-derivatives // Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) { if ( rparentsprev.test( name ) ) {
ret = ret.reverse(); ret = ret.reverse();
} }
} }
return this.pushStack( ret ); return this.pushStack( ret );
}; };
}); } );
var rnotwhite = (/\S+/g); var rnotwhite = ( /\S+/g );
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cach e // Convert String-formatted options into Object-formatted ones
function createOptions( options ) { function createOptions( options ) {
var object = optionsCache[ options ] = {}; var object = {};
jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true; object[ flag ] = true;
}); } );
return object; return object;
} }
/* /*
* Create a callback list using the following parameters: * Create a callback list using the following parameters:
* *
* options: an optional list of space-separated options that will change how * options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option ob ject * the callback list behaves or a more traditional option ob ject
* *
* By default a callback list will act like an event callback list and can be * By default a callback list will act like an event callback list and can be
skipping to change at line 3078 skipping to change at line 3179
* unique: will ensure a callback can only be added once (no duplicate in the list) * unique: will ensure a callback can only be added once (no duplicate in the list)
* *
* stopOnFalse: interrupt callings when a callback returns false * stopOnFalse: interrupt callings when a callback returns false
* *
*/ */
jQuery.Callbacks = function( options ) { jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed // Convert options from String-formatted to Object-formatted if needed
// (we check in cache first) // (we check in cache first)
options = typeof options === "string" ? options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) : createOptions( options ) :
jQuery.extend( {}, options ); jQuery.extend( {}, options );
var // Flag to know if list is currently firing var // Flag to know if list is currently firing
firing, firing,
// Last fire value (for non-forgettable lists)
// Last fire value for non-forgettable lists
memory, memory,
// Flag to know if list was already fired // Flag to know if list was already fired
fired, fired,
// End of the loop when firing
firingLength, // Flag to prevent firing
// Index of currently firing callback (modified by remove if need locked,
ed)
firingIndex,
// First callback to fire (used internally by add and fireWith)
firingStart,
// Actual callback list // Actual callback list
list = [], list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [], // Queue of execution data for repeatable lists
queue = [],
// Index of currently firing callback (modified by add/remove as
needed)
firingIndex = -1,
// Fire callbacks // Fire callbacks
fire = function( data ) { fire = function() {
memory = options.memory && data;
fired = true; // Enforce single-firing
firingIndex = firingStart || 0; locked = options.once;
firingStart = 0;
firingLength = list.length; // Execute callbacks for all pending executions,
firing = true; // respecting firingIndex overrides and runtime changes
for ( ; list && firingIndex < firingLength; firingIndex++ fired = firing = true;
) { for ( ; queue.length; firingIndex = -1 ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ memory = queue.shift();
1 ] ) === false && options.stopOnFalse ) { while ( ++firingIndex < list.length ) {
memory = false; // To prevent further cal
ls using add // Run callback and check for early termi
break; nation
if ( list[ firingIndex ].apply( memory[ 0
], memory[ 1 ] ) === false &&
options.stopOnFalse ) {
// Jump to end and forget the dat
a so .add doesn't re-fire
firingIndex = list.length;
memory = false;
}
} }
} }
// Forget the data if we're done with it
if ( !options.memory ) {
memory = false;
}
firing = false; firing = false;
if ( list ) {
if ( stack ) { // Clean up if we're done firing for good
if ( stack.length ) { if ( locked ) {
fire( stack.shift() );
} // Keep an empty list if we have data for future
} else if ( memory ) { add calls
if ( memory ) {
list = []; list = [];
// Otherwise, this object is spent
} else { } else {
self.disable(); list = "";
} }
} }
}, },
// Actual Callbacks object // Actual Callbacks object
self = { self = {
// Add a callback or a collection of callbacks to the lis t // Add a callback or a collection of callbacks to the lis t
add: function() { add: function() {
if ( list ) { if ( list ) {
// First, we save the current length
var start = list.length; // If we have memory from a past run, we
(function add( args ) { should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jQuery.each( args, function( _, a rg ) { jQuery.each( args, function( _, a rg ) {
var type = jQuery.type( a if ( jQuery.isFunction( a
rg ); rg ) ) {
if ( type === "function"
) {
if ( !options.uni que || !self.has( arg ) ) { if ( !options.uni que || !self.has( arg ) ) {
list.push ( arg ); list.push ( arg );
} }
} else if ( arg && arg.le } else if ( arg && arg.le
ngth && type !== "string" ) { ngth && jQuery.type( arg ) !== "string" ) {
// Inspect recurs ively // Inspect recurs ively
add( arg ); add( arg );
} }
}); } );
})( arguments ); } )( arguments );
// Do we need to add the callbacks to the
// current firing batch? if ( memory && !firing ) {
if ( firing ) { fire();
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
} }
} }
return this; return this;
}, },
// Remove a callback from the list // Remove a callback from the list
remove: function() { remove: function() {
if ( list ) { jQuery.each( arguments, function( _, arg ) {
jQuery.each( arguments, function( _, arg var index;
) { while ( ( index = jQuery.inArray( arg, li
var index; st, index ) ) > -1 ) {
while ( ( index = jQuery.inArray( list.splice( index, 1 );
arg, list, index ) ) > -1 ) {
list.splice( index, 1 ); // Handle firing indexes
// Handle firing indexes if ( index <= firingIndex ) {
if ( firing ) { firingIndex--;
if ( index <= fir
ingLength ) {
firingLen
gth--;
}
if ( index <= fir
ingIndex ) {
firingInd
ex--;
}
}
} }
}); }
} } );
return this; return this;
}, },
// Check if a given callback is in the list. // Check if a given callback is in the list.
// If no argument is given, return whether or not list ha s callbacks attached. // If no argument is given, return whether or not list ha s callbacks attached.
has: function( fn ) { has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( return fn ?
list && list.length ); jQuery.inArray( fn, list ) > -1 :
list.length > 0;
}, },
// Remove all callbacks from the list // Remove all callbacks from the list
empty: function() { empty: function() {
list = []; if ( list ) {
firingLength = 0; list = [];
}
return this; return this;
}, },
// Have the list do nothing anymore
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function() { disable: function() {
list = stack = memory = undefined; locked = queue = [];
list = memory = "";
return this; return this;
}, },
// Is it disabled?
disabled: function() { disabled: function() {
return !list; return !list;
}, },
// Lock the list in its current state
// Disable .fire
// Also disable .add unless we have memory (since it woul
d have no effect)
// Abort any pending executions
lock: function() { lock: function() {
stack = undefined; locked = true;
if ( !memory ) { if ( !memory ) {
self.disable(); self.disable();
} }
return this; return this;
}, },
// Is it locked?
locked: function() { locked: function() {
return !stack; return !!locked;
}, },
// Call all callbacks with the given context and argument s // Call all callbacks with the given context and argument s
fireWith: function( context, args ) { fireWith: function( context, args ) {
if ( list && ( !fired || stack ) ) { if ( !locked ) {
args = args || []; args = args || [];
args = [ context, args.slice ? args.slice () : args ]; args = [ context, args.slice ? args.slice () : args ];
if ( firing ) { queue.push( args );
stack.push( args ); if ( !firing ) {
} else { fire();
fire( args );
} }
} }
return this; return this;
}, },
// Call all the callbacks with the given arguments // Call all the callbacks with the given arguments
fire: function() { fire: function() {
self.fireWith( this, arguments ); self.fireWith( this, arguments );
return this; return this;
}, },
// To know if the callbacks have already been called at l east once // To know if the callbacks have already been called at l east once
fired: function() { fired: function() {
return !!fired; return !!fired;
} }
}; };
return self; return self;
}; };
jQuery.extend({ jQuery.extend( {
Deferred: function( func ) { Deferred: function( func ) {
var tuples = [ var tuples = [
// action, add listener, listener list, final sta te // action, add listener, listener list, final sta te
[ "resolve", "done", jQuery.Callbacks("once memor [ "resolve", "done", jQuery.Callbacks( "once memo
y"), "resolved" ], ry" ), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory [ "reject", "fail", jQuery.Callbacks( "once memor
"), "rejected" ], y" ), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory" [ "notify", "progress", jQuery.Callbacks( "memory
) ] " ) ]
], ],
state = "pending", state = "pending",
promise = { promise = {
state: function() { state: function() {
return state; return state;
}, },
always: function() { always: function() {
deferred.done( arguments ).fail( argument s ); deferred.done( arguments ).fail( argument s );
return this; return this;
}, },
then: function( /* fnDone, fnFail, fnProgress */ ) { then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments; var fns = arguments;
return jQuery.Deferred(function( newDefer ) { return jQuery.Deferred( function( newDefe r ) {
jQuery.each( tuples, function( i, tuple ) { jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunctio n( fns[ i ] ) && fns[ i ]; var fn = jQuery.isFunctio n( fns[ i ] ) && fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer // deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ](func tion() { deferred[ tuple[ 1 ] ]( f unction() {
var returned = fn && fn.apply( this, arguments ); var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) { if ( returned && jQuery.isFunction( returned.promise ) ) {
returned. promise() returned. promise()
. progress( newDefer.notify )
. done( newDefer.resolve ) . done( newDefer.resolve )
. .
fail( newDefer.reject ) fail( newDefer.reject );
.
progress( newDefer.notify );
} else { } else {
newDefer[ newDefer[
tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ ret tuple[ 0 ] + "With" ](
urned ] : arguments ); t
his === promise ? newDefer.promise() : this,
f
n ? [ returned ] : arguments
);
} }
}); } );
}); } );
fns = null; fns = null;
}).promise(); } ).promise();
}, },
// Get a promise for this deferred // Get a promise for this deferred
// If obj is provided, the promise aspect is adde d to the object // If obj is provided, the promise aspect is adde d to the object
promise: function( obj ) { promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise; return obj != null ? jQuery.extend( obj, promise ) : promise;
} }
}, },
deferred = {}; deferred = {};
// Keep pipe for back-compat // Keep pipe for back-compat
promise.pipe = promise.then; promise.pipe = promise.then;
// Add list-specific methods // Add list-specific methods
jQuery.each( tuples, function( i, tuple ) { jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ], var list = tuple[ 2 ],
stateString = tuple[ 3 ]; stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add // promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add; promise[ tuple[ 1 ] ] = list.add;
// Handle state // Handle state
if ( stateString ) { if ( stateString ) {
list.add(function() { list.add( function() {
// state = [ resolved | rejected ] // state = [ resolved | rejected ]
state = stateString; state = stateString;
// [ reject_list | resolve_list ].disable; progre ss_list.lock // [ reject_list | resolve_list ].disable; progre ss_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ] .lock ); }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ] .lock );
} }
// deferred[ resolve | reject | notify ] // deferred[ resolve | reject | notify ]
deferred[ tuple[0] ] = function() { deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[0] + "With" ]( this === deferred deferred[ tuple[ 0 ] + "With" ]( this === deferre
? promise : this, arguments ); d ? promise : this, arguments );
return this; return this;
}; };
deferred[ tuple[0] + "With" ] = list.fireWith; deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
}); } );
// Make the deferred a promise // Make the deferred a promise
promise.promise( deferred ); promise.promise( deferred );
// Call given func if any // Call given func if any
if ( func ) { if ( func ) {
func.call( deferred, deferred ); func.call( deferred, deferred );
} }
// All done! // All done!
return deferred; return deferred;
}, },
// Deferred helper // Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) { when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0, var i = 0,
resolveValues = slice.call( arguments ), resolveValues = slice.call( arguments ),
length = resolveValues.length, length = resolveValues.length,
// the count of uncompleted subordinates // the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFun remaining = length !== 1 ||
ction( subordinate.promise ) ) ? length : 0, ( subordinate && jQuery.isFunction( subordinate.p
romise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only // the master Deferred.
a single Deferred, just use that. // If resolveValues consist of only a single Deferred, ju
st use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferre d(), deferred = remaining === 1 ? subordinate : jQuery.Deferre d(),
// Update function for both resolve and progress values // Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) { updateFunc = function( i, contexts, values ) {
return function( value ) { return function( value ) {
contexts[ i ] = this; contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slic e.call( arguments ) : value; values[ i ] = arguments.length > 1 ? slic e.call( arguments ) : value;
if ( values === progressValues ) { if ( values === progressValues ) {
deferred.notifyWith( contexts, va lues ); deferred.notifyWith( contexts, va lues );
} else if ( !(--remaining) ) { } else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, v alues ); deferred.resolveWith( contexts, v alues );
} }
}; };
}, },
progressValues, progressContexts, resolveContexts; progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolv ed // add listeners to Deferred subordinates; treat others as resolv ed
if ( length > 1 ) { if ( length > 1 ) {
progressValues = new Array( length ); progressValues = new Array( length );
progressContexts = new Array( length ); progressContexts = new Array( length );
resolveContexts = new Array( length ); resolveContexts = new Array( length );
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( res olveValues[ i ].promise ) ) { if ( resolveValues[ i ] && jQuery.isFunction( res olveValues[ i ].promise ) ) {
resolveValues[ i ].promise() resolveValues[ i ].promise()
.progress( updateFunc( i, progres sContexts, progressValues ) )
.done( updateFunc( i, resolveCont exts, resolveValues ) ) .done( updateFunc( i, resolveCont exts, resolveValues ) )
.fail( deferred.reject ) .fail( deferred.reject );
.progress( updateFunc( i, progres
sContexts, progressValues ) );
} else { } else {
--remaining; --remaining;
} }
} }
} }
// if we're not waiting on anything, resolve the master // if we're not waiting on anything, resolve the master
if ( !remaining ) { if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues ); deferred.resolveWith( resolveContexts, resolveValues );
} }
return deferred.promise(); return deferred.promise();
} }
}); } );
// The deferred used on DOM ready // The deferred used on DOM ready
var readyList; var readyList;
jQuery.fn.ready = function( fn ) { jQuery.fn.ready = function( fn ) {
// Add the callback // Add the callback
jQuery.ready.promise().done( fn ); jQuery.ready.promise().done( fn );
return this; return this;
}; };
jQuery.extend({ jQuery.extend( {
// Is the DOM ready to be used? Set to true once it occurs. // Is the DOM ready to be used? Set to true once it occurs.
isReady: false, isReady: false,
// A counter to track how many items to wait for before // A counter to track how many items to wait for before
// the ready event fires. See #6781 // the ready event fires. See #6781
readyWait: 1, readyWait: 1,
// Hold (or release) the ready event // Hold (or release) the ready event
holdReady: function( hold ) { holdReady: function( hold ) {
if ( hold ) { if ( hold ) {
skipping to change at line 3414 skipping to change at line 3556
}, },
// Handle when the DOM is ready // Handle when the DOM is ready
ready: function( wait ) { ready: function( wait ) {
// Abort if there are pending holds or we're already ready // Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return; return;
} }
// Make sure body exists, at least, in case IE gets a little over
zealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready );
}
// Remember that the DOM is ready // Remember that the DOM is ready
jQuery.isReady = true; jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be // If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) { if ( wait !== true && --jQuery.readyWait > 0 ) {
return; return;
} }
// If there are functions bound, to execute // If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] ); readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events // Trigger any bound ready events
if ( jQuery.fn.triggerHandler ) { if ( jQuery.fn.triggerHandler ) {
jQuery( document ).triggerHandler( "ready" ); jQuery( document ).triggerHandler( "ready" );
jQuery( document ).off( "ready" ); jQuery( document ).off( "ready" );
} }
} }
}); } );
/** /**
* Clean-up method for dom ready events * Clean-up method for dom ready events
*/ */
function detach() { function detach() {
if ( document.addEventListener ) { if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", completed, fals document.removeEventListener( "DOMContentLoaded", completed );
e ); window.removeEventListener( "load", completed );
window.removeEventListener( "load", completed, false );
} else { } else {
document.detachEvent( "onreadystatechange", completed ); document.detachEvent( "onreadystatechange", completed );
window.detachEvent( "onload", completed ); window.detachEvent( "onload", completed );
} }
} }
/** /**
* The ready event handler and self cleanup method * The ready event handler and self cleanup method
*/ */
function completed() { function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE // readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.ready if ( document.addEventListener ||
State === "complete" ) { window.event.type === "load" ||
document.readyState === "complete" ) {
detach(); detach();
jQuery.ready(); jQuery.ready();
} }
} }
jQuery.ready.promise = function( obj ) { jQuery.ready.promise = function( obj ) {
if ( !readyList ) { if ( !readyList ) {
readyList = jQuery.Deferred(); readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the brow // Catch cases where $(document).ready() is called
ser event has already occurred. // after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it cau // Support: IE6-10
sed issues like the one // Older IE sometimes signals "interactive" too soon
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282 if ( document.readyState === "complete" ||
#comment:15 ( document.readyState !== "loading" && !document.document
if ( document.readyState === "complete" ) { Element.doScroll ) ) {
// Handle it asynchronously to allow scripts the opportun ity to delay ready // Handle it asynchronously to allow scripts the opportun ity to delay ready
setTimeout( jQuery.ready ); window.setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded // Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) { } else if ( document.addEventListener ) {
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false ); document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
window.addEventListener( "load", completed, false ); window.addEventListener( "load", completed );
// If IE event model is used // If IE event model is used
} else { } else {
// Ensure firing before onload, maybe late but safe also for iframes // Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed ); document.attachEvent( "onreadystatechange", completed );
// A fallback to window.onload, that will always work // A fallback to window.onload, that will always work
window.attachEvent( "onload", completed ); window.attachEvent( "onload", completed );
// If IE and not a frame // If IE and not a frame
// continually check to see if the document is ready // continually check to see if the document is ready
var top = false; var top = false;
try { try {
top = window.frameElement == null && document.doc umentElement; top = window.frameElement == null && document.doc umentElement;
} catch(e) {} } catch ( e ) {}
if ( top && top.doScroll ) { if ( top && top.doScroll ) {
(function doScrollCheck() { ( function doScrollCheck() {
if ( !jQuery.isReady ) { if ( !jQuery.isReady ) {
try { try {
// Use the trick by Diego Perini // Use the trick by Diego Perini
// http://javascript.nwbo x.com/IEContentLoaded/ // http://javascript.nwbo x.com/IEContentLoaded/
top.doScroll("left"); top.doScroll( "left" );
} catch(e) { } catch ( e ) {
return setTimeout( doScro return window.setTimeout(
llCheck, 50 ); doScrollCheck, 50 );
} }
// detach all dom ready events // detach all dom ready events
detach(); detach();
// and execute any waiting functi ons // and execute any waiting functi ons
jQuery.ready(); jQuery.ready();
} }
})(); } )();
} }
} }
} }
return readyList.promise( obj ); return readyList.promise( obj );
}; };
var strundefined = typeof undefined; // Kick off the DOM ready check even if the user does not
jQuery.ready.promise();
// Support: IE<9 // Support: IE<9
// Iteration over object's inherited properties before its own // Iteration over object's inherited properties before its own
var i; var i;
for ( i in jQuery( support ) ) { for ( i in jQuery( support ) ) {
break; break;
} }
support.ownLast = i !== "0"; support.ownFirst = i === "0";
// Note: most support tests are defined in their respective modules. // Note: most support tests are defined in their respective modules.
// false until the test is run // false until the test is run
support.inlineBlockNeedsLayout = false; support.inlineBlockNeedsLayout = false;
// Execute ASAP in case we need to set body.style.zoom // Execute ASAP in case we need to set body.style.zoom
jQuery(function() { jQuery( function() {
// Minified: var a,b,c,d // Minified: var a,b,c,d
var val, div, body, container; var val, div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ]; body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) { if ( !body || !body.style ) {
// Return for frameset docs that don't have a body // Return for frameset docs that don't have a body
return; return;
} }
// Setup // Setup
div = document.createElement( "div" ); div = document.createElement( "div" );
container = document.createElement( "div" ); container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;height:0;to p:0;left:-9999px"; container.style.cssText = "position:absolute;border:0;width:0;height:0;to p:0;left:-9999px";
body.appendChild( container ).appendChild( div ); body.appendChild( container ).appendChild( div );
if ( typeof div.style.zoom !== strundefined ) { if ( typeof div.style.zoom !== "undefined" ) {
// Support: IE<8 // Support: IE<8
// Check if natively block-level elements act like inline-block // Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving // elements when setting their display to 'inline' and giving
// them layout // them layout
div.style.cssText = "display:inline;margin:0;border:0;padding:1px ;width:1px;zoom:1"; div.style.cssText = "display:inline;margin:0;border:0;padding:1px ;width:1px;zoom:1";
support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; support.inlineBlockNeedsLayout = val = div.offsetWidth === 3;
if ( val ) { if ( val ) {
// Prevent IE 6 from affecting layout for positioned elem ents #11048 // Prevent IE 6 from affecting layout for positioned elem ents #11048
// Prevent IE from shrinking the body in IE 7 mode #12869 // Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8 // Support: IE<8
body.style.zoom = 1; body.style.zoom = 1;
} }
} }
body.removeChild( container ); body.removeChild( container );
}); } );
(function() { ( function() {
var div = document.createElement( "div" ); var div = document.createElement( "div" );
// Execute the test only if not already executed in another module. // Support: IE<9
if (support.deleteExpando == null) { support.deleteExpando = true;
// Support: IE<9 try {
support.deleteExpando = true; delete div.test;
try { } catch ( e ) {
delete div.test; support.deleteExpando = false;
} catch( e ) {
support.deleteExpando = false;
}
} }
// Null elements to avoid leaks in IE. // Null elements to avoid leaks in IE.
div = null; div = null;
})(); } )();
var acceptData = function( elem ) {
/** var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ],
* Determines whether an object can have data
*/
jQuery.acceptData = function( elem ) {
var noData = jQuery.noData[ (elem.nodeName + " ").toLowerCase() ],
nodeType = +elem.nodeType || 1; nodeType = +elem.nodeType || 1;
// Do not set data on non-element DOM nodes because it will not be cleare d (#8335). // Do not set data on non-element DOM nodes because it will not be cleare d (#8335).
return nodeType !== 1 && nodeType !== 9 ? return nodeType !== 1 && nodeType !== 9 ?
false : false :
// Nodes accept data unless otherwise specified; rejection can be conditional // Nodes accept data unless otherwise specified; rejection can be conditional
!noData || noData !== true && elem.getAttribute("classid") === no Data; !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
}; };
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /([A-Z])/g; rmultiDash = /([A-Z])/g;
function dataAttr( elem, key, data ) { function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any // If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute // data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) { if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase (); var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase ();
data = elem.getAttribute( name ); data = elem.getAttribute( name );
if ( typeof data === "string" ) { if ( typeof data === "string" ) {
try { try {
data = data === "true" ? true : data = data === "true" ? true :
data === "false" ? false : data === "false" ? false :
data === "null" ? null : data === "null" ? null :
// Only convert to a number if it doesn't change the string // Only convert to a number if it doesn't change the string
+data + "" === data ? +data : +data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( d ata ) : rbrace.test( data ) ? jQuery.parseJSON( d ata ) :
data; data;
} catch( e ) {} } catch ( e ) {}
// Make sure we set the data so it isn't changed later // Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data ); jQuery.data( elem, key, data );
} else { } else {
data = undefined; data = undefined;
} }
} }
return data; return data;
} }
// checks a cache object for emptiness // checks a cache object for emptiness
function isEmptyDataObject( obj ) { function isEmptyDataObject( obj ) {
var name; var name;
for ( name in obj ) { for ( name in obj ) {
// if the public data object is empty, the private is still empty // if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) {
continue; continue;
} }
if ( name !== "toJSON" ) { if ( name !== "toJSON" ) {
return false; return false;
} }
} }
return true; return true;
} }
function internalData( elem, name, data, pvt /* Internal Use Only */ ) { function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) { if ( !acceptData( elem ) ) {
return; return;
} }
var ret, thisCache, var ret, thisCache,
internalKey = jQuery.expando, internalKey = jQuery.expando,
// We have to handle DOM nodes and JS objects differently because IE6-7 // We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary // can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType, isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is // Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically // attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem, cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows // 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 ca che // the code to shortcut on the same path as a DOM node with no ca che
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && intern alKey; id = isNode ? elem[ internalKey ] : elem[ internalKey ] && intern alKey;
// Avoid doing any more work than we need to when trying to get data on a n // Avoid doing any more work than we need to when trying to get data on a n
// object that has no data at all // object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefin if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) &&
ed && typeof name === "string" ) { data === undefined && typeof name === "string" ) {
return; return;
} }
if ( !id ) { if ( !id ) {
// Only DOM nodes need a new unique ID for each element since the ir data // Only DOM nodes need a new unique ID for each element since the ir data
// ends up in the global cache // ends up in the global cache
if ( isNode ) { if ( isNode ) {
id = elem[ internalKey ] = deletedIds.pop() || jQuery.gui d++; id = elem[ internalKey ] = deletedIds.pop() || jQuery.gui d++;
} else { } else {
id = internalKey; id = internalKey;
} }
} }
if ( !cache[ id ] ) { if ( !cache[ id ] ) {
// Avoid exposing jQuery metadata on plain JS objects when the ob ject // Avoid exposing jQuery metadata on plain JS objects when the ob ject
// is serialized using JSON.stringify // is serialized using JSON.stringify
cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; cache[ id ] = isNode ? {} : { toJSON: jQuery.noop };
} }
// An object can be passed to jQuery.data instead of a key/value pair; th is gets // An object can be passed to jQuery.data instead of a key/value pair; th is gets
// shallow copied over onto the existing cache // shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) { if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) { if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name ); cache[ id ] = jQuery.extend( cache[ id ], name );
skipping to change at line 3748 skipping to change at line 3898
ret = thisCache[ jQuery.camelCase( name ) ]; ret = thisCache[ jQuery.camelCase( name ) ];
} }
} else { } else {
ret = thisCache; ret = thisCache;
} }
return ret; return ret;
} }
function internalRemoveData( elem, name, pvt ) { function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) { if ( !acceptData( elem ) ) {
return; return;
} }
var thisCache, i, var thisCache, i,
isNode = elem.nodeType, isNode = elem.nodeType,
// See jQuery.data for more information // See jQuery.data for more information
cache = isNode ? jQuery.cache : elem, cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando; id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
skipping to change at line 3784 skipping to change at line 3934
// try the string as a key before any manipulatio n // try the string as a key before any manipulatio n
if ( name in thisCache ) { if ( name in thisCache ) {
name = [ name ]; name = [ name ];
} else { } else {
// split the camel cased version by space s unless a key with the spaces exists // split the camel cased version by space s unless a key with the spaces exists
name = jQuery.camelCase( name ); name = jQuery.camelCase( name );
if ( name in thisCache ) { if ( name in thisCache ) {
name = [ name ]; name = [ name ];
} else { } else {
name = name.split(" "); name = name.split( " " );
} }
} }
} else { } else {
// If "name" is an array of keys... // If "name" is an array of keys...
// When data is initially created, via ("key", "v al") signature, // When data is initially created, via ("key", "v al") signature,
// keys will be converted to camelCase. // keys will be converted to camelCase.
// Since there is no way to tell _how_ a key was added, remove // Since there is no way to tell _how_ a key was added, remove
// both plain key and camelCase key. #12786 // both plain key and camelCase key. #12786
// This will only penalize the array argument pat h. // This will only penalize the array argument pat h.
name = name.concat( jQuery.map( name, jQuery.came lCase ) ); name = name.concat( jQuery.map( name, jQuery.came lCase ) );
} }
i = name.length; i = name.length;
while ( i-- ) { while ( i-- ) {
delete thisCache[ name[i] ]; delete thisCache[ name[ i ] ];
} }
// If there is no data left in the cache, we want to cont inue // If there is no data left in the cache, we want to cont inue
// and let the cache object itself get destroyed // and let the cache object itself get destroyed
if ( pvt ? !isEmptyDataObject(thisCache) : !jQuery.isEmpt yObject(thisCache) ) { if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEm ptyObject( thisCache ) ) {
return; return;
} }
} }
} }
// See jQuery.data for more information // See jQuery.data for more information
if ( !pvt ) { if ( !pvt ) {
delete cache[ id ].data; delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object // Don't destroy the parent cache unless the internal data object
skipping to change at line 3831 skipping to change at line 3982
// Destroy the cache // Destroy the cache
if ( isNode ) { if ( isNode ) {
jQuery.cleanData( [ elem ], true ); jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
/* jshint eqeqeq: false */ /* jshint eqeqeq: false */
} else if ( support.deleteExpando || cache != cache.window ) { } else if ( support.deleteExpando || cache != cache.window ) {
/* jshint eqeqeq: true */ /* jshint eqeqeq: true */
delete cache[ id ]; delete cache[ id ];
// When all else fails, null // When all else fails, undefined
} else { } else {
cache[ id ] = null; cache[ id ] = undefined;
} }
} }
jQuery.extend({ jQuery.extend( {
cache: {}, cache: {},
// The following elements (space-suffixed to avoid Object.prototype colli sions) // The following elements (space-suffixed to avoid Object.prototype colli sions)
// throw uncatchable exceptions if you attempt to set expando properties // throw uncatchable exceptions if you attempt to set expando properties
noData: { noData: {
"applet ": true, "applet ": true,
"embed ": true, "embed ": true,
// ...but Flash objects (which have this classid) *can* handle ex pandos // ...but Flash objects (which have this classid) *can* handle ex pandos
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
}, },
hasData: function( elem ) { hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : ele m[ jQuery.expando ]; elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : e lem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem ); return !!elem && !isEmptyDataObject( elem );
}, },
data: function( elem, name, data ) { data: function( elem, name, data ) {
return internalData( elem, name, data ); return internalData( elem, name, data );
}, },
removeData: function( elem, name ) { removeData: function( elem, name ) {
return internalRemoveData( elem, name ); return internalRemoveData( elem, name );
}, },
// For internal use only. // For internal use only.
_data: function( elem, name, data ) { _data: function( elem, name, data ) {
return internalData( elem, name, data, true ); return internalData( elem, name, data, true );
}, },
_removeData: function( elem, name ) { _removeData: function( elem, name ) {
return internalRemoveData( elem, name, true ); return internalRemoveData( elem, name, true );
} }
}); } );
jQuery.fn.extend({ jQuery.fn.extend( {
data: function( key, value ) { data: function( key, value ) {
var i, name, data, var i, name, data,
elem = this[0], elem = this[ 0 ],
attrs = elem && elem.attributes; attrs = elem && elem.attributes;
// Special expections of .data basically thwart jQuery.access, // Special expections of .data basically thwart jQuery.access,
// so implement the relevant behavior ourselves // so implement the relevant behavior ourselves
// Gets all values // Gets all values
if ( key === undefined ) { if ( key === undefined ) {
if ( this.length ) { if ( this.length ) {
data = jQuery.data( elem ); data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
i = attrs.length; i = attrs.length;
while ( i-- ) { while ( i-- ) {
// Support: IE11+ // Support: IE11+
// The attrs elements can be null (#14894) // The attrs elements can be null (#14894)
if ( attrs[ i ] ) { if ( attrs[ i ] ) {
name = attrs[ i ].name; name = attrs[ i ].name;
if ( name.indexOf( "data- " ) === 0 ) { if ( name.indexOf( "data- " ) === 0 ) {
name = jQuery.cam elCase( name.slice(5) ); name = jQuery.cam elCase( name.slice( 5 ) );
dataAttr( elem, n ame, data[ name ] ); dataAttr( elem, n ame, data[ name ] );
} }
} }
} }
jQuery._data( elem, "parsedAttrs", true ) ; jQuery._data( elem, "parsedAttrs", true ) ;
} }
} }
return data; return data;
} }
// Sets multiple values // Sets multiple values
if ( typeof key === "object" ) { if ( typeof key === "object" ) {
return this.each(function() { return this.each( function() {
jQuery.data( this, key ); jQuery.data( this, key );
}); } );
} }
return arguments.length > 1 ? return arguments.length > 1 ?
// Sets one value // Sets one value
this.each(function() { this.each( function() {
jQuery.data( this, key, value ); jQuery.data( this, key, value );
}) : } ) :
// Gets one value // Gets one value
// Try to fetch any internally stored data first // Try to fetch any internally stored data first
elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined;
}, },
removeData: function( key ) { removeData: function( key ) {
return this.each(function() { return this.each( function() {
jQuery.removeData( this, key ); jQuery.removeData( this, key );
}); } );
} }
}); } );
jQuery.extend({ jQuery.extend( {
queue: function( elem, type, data ) { queue: function( elem, type, data ) {
var queue; var queue;
if ( elem ) { if ( elem ) {
type = ( type || "fx" ) + "queue"; type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type ); queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is jus t a lookup // Speed up dequeue by getting out quickly if this is jus t a lookup
if ( data ) { if ( data ) {
if ( !queue || jQuery.isArray(data) ) { if ( !queue || jQuery.isArray( data ) ) {
queue = jQuery._data( elem, type, jQuery. queue = jQuery._data( elem, type, jQuery.
makeArray(data) ); makeArray( data ) );
} else { } else {
queue.push( data ); queue.push( data );
} }
} }
return queue || []; return queue || [];
} }
}, },
dequeue: function( elem, type ) { dequeue: function( elem, type ) {
type = type || "fx"; type = type || "fx";
skipping to change at line 3988 skipping to change at line 4140
// clear up the last queue stop function // clear up the last queue stop function
delete hooks.stop; delete hooks.stop;
fn.call( elem, next, hooks ); fn.call( elem, next, hooks );
} }
if ( !startLength && hooks ) { if ( !startLength && hooks ) {
hooks.empty.fire(); hooks.empty.fire();
} }
}, },
// not intended for public consumption - generates a queueHooks object, o // not intended for public consumption - generates a queueHooks object,
r returns the current one // or returns the current one
_queueHooks: function( elem, type ) { _queueHooks: function( elem, type ) {
var key = type + "queueHooks"; var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, { return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() { empty: jQuery.Callbacks( "once memory" ).add( function() {
jQuery._removeData( elem, type + "queue" ); jQuery._removeData( elem, type + "queue" );
jQuery._removeData( elem, key ); jQuery._removeData( elem, key );
}) } )
}); } );
} }
}); } );
jQuery.fn.extend({ jQuery.fn.extend( {
queue: function( type, data ) { queue: function( type, data ) {
var setter = 2; var setter = 2;
if ( typeof type !== "string" ) { if ( typeof type !== "string" ) {
data = type; data = type;
type = "fx"; type = "fx";
setter--; setter--;
} }
if ( arguments.length < setter ) { if ( arguments.length < setter ) {
return jQuery.queue( this[0], type ); return jQuery.queue( this[ 0 ], type );
} }
return data === undefined ? return data === undefined ?
this : this :
this.each(function() { this.each( function() {
var queue = jQuery.queue( this, type, data ); var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue // ensure a hooks for this queue
jQuery._queueHooks( this, type ); jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) { if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jQuery.dequeue( this, type ); jQuery.dequeue( this, type );
} }
}); } );
}, },
dequeue: function( type ) { dequeue: function( type ) {
return this.each(function() { return this.each( function() {
jQuery.dequeue( this, type ); jQuery.dequeue( this, type );
}); } );
}, },
clearQueue: function( type ) { clearQueue: function( type ) {
return this.queue( type || "fx", [] ); return this.queue( type || "fx", [] );
}, },
// Get a promise resolved when queues of a certain type // Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default) // are emptied (fx is the type by default)
promise: function( type, obj ) { promise: function( type, obj ) {
var tmp, var tmp,
count = 1, count = 1,
defer = jQuery.Deferred(), defer = jQuery.Deferred(),
elements = this, elements = this,
i = this.length, i = this.length,
resolve = function() { resolve = function() {
if ( !( --count ) ) { if ( !( --count ) ) {
skipping to change at line 4065 skipping to change at line 4219
while ( i-- ) { while ( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" ); tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) { if ( tmp && tmp.empty ) {
count++; count++;
tmp.empty.add( resolve ); tmp.empty.add( resolve );
} }
} }
resolve(); resolve();
return defer.promise( obj ); return defer.promise( obj );
} }
}); } );
var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
( function() {
var shrinkWrapBlocksVal;
support.shrinkWrapBlocks = function() {
if ( shrinkWrapBlocksVal != null ) {
return shrinkWrapBlocksVal;
}
// Will be changed later if needed.
shrinkWrapBlocksVal = false;
// Minified: var b,c,d
var div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body || !body.style ) {
// Test fired too early or in an unsupported environment,
exit.
return;
}
// Setup
div = document.createElement( "div" );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;hei
ght:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
// Support: IE6
// Check if elements with layout shrink-wrap their children
if ( typeof div.style.zoom !== "undefined" ) {
// Reset CSS: box-sizing; display; margin; border
div.style.cssText =
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:c
ontent-box;" +
"box-sizing:content-box;display:block;margin:0;bo
rder:0;" +
"padding:1px;width:1px;zoom:1";
div.appendChild( document.createElement( "div" ) ).style.
width = "5px";
shrinkWrapBlocksVal = div.offsetWidth !== 3;
}
body.removeChild( container );
return shrinkWrapBlocksVal;
};
} )();
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
var isHidden = function( elem, el ) { var isHidden = function( elem, el ) {
// isHidden might be called from jQuery#filter function; // isHidden might be called from jQuery#filter function;
// in that case, element will be second argument // in that case, element will be second argument
elem = el || elem; elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contai return jQuery.css( elem, "display" ) === "none" ||
ns( elem.ownerDocument, elem ); !jQuery.contains( elem.ownerDocument, elem );
}; };
function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted,
scale = 1,
maxIterations = 20,
currentValue = tween ?
function() { return tween.cur(); } :
function() { return jQuery.css( elem, prop, "" ); },
initial = currentValue(),
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop
] ? "" : "px" ),
// Starting value computation is required for potential unit mism
atches
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +i
nitial ) &&
rcssNum.exec( jQuery.css( elem, prop ) );
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ];
// Make sure we update the tween properties later on
valueParts = valueParts || [];
// Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1;
do {
// If previous iteration zeroed out, double until we get
*something*.
// Use string for doubling so we don't accidentally see s
cale as unchanged below
scale = scale || ".5";
// Adjust and apply
initialInUnit = initialInUnit / scale;
jQuery.style( elem, prop, initialInUnit + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// Break the loop if scale is unchanged or perfect, or if we've j
ust had enough.
} while (
scale !== ( scale = currentValue() / initial ) && scale !
== 1 && --maxIterations
);
}
if ( valueParts ) {
initialInUnit = +initialInUnit || +initial || 0;
// Apply relative offset (+=/-=) if specified
adjusted = valueParts[ 1 ] ?
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ]
:
+valueParts[ 2 ];
if ( tween ) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
// Multifunctional method to get and set values of a collection // Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function // The value/s can optionally be executed if it's a function
var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGe t, raw ) { var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0, var i = 0,
length = elems.length, length = elems.length,
bulk = key == null; bulk = key == null;
// Sets many values // Sets many values
if ( jQuery.type( key ) === "object" ) { if ( jQuery.type( key ) === "object" ) {
chainable = true; chainable = true;
for ( i in key ) { for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); access( elems, fn, i, key[ i ], true, emptyGet, raw );
} }
// Sets one value // Sets one value
} else if ( value !== undefined ) { } else if ( value !== undefined ) {
chainable = true; chainable = true;
if ( !jQuery.isFunction( value ) ) { if ( !jQuery.isFunction( value ) ) {
raw = true; raw = true;
} }
if ( bulk ) { if ( bulk ) {
// Bulk operations run against the entire set // Bulk operations run against the entire set
if ( raw ) { if ( raw ) {
fn.call( elems, value ); fn.call( elems, value );
fn = null; fn = null;
// ...except when executing function values // ...except when executing function values
} else { } else {
bulk = fn; bulk = fn;
fn = function( elem, key, value ) { fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value ) ; return bulk.call( jQuery( elem ), value ) ;
}; };
} }
} }
if ( fn ) { if ( fn ) {
for ( ; i < length; i++ ) { for ( ; i < length; i++ ) {
fn( elems[i], key, raw ? value : value.call( elem fn(
s[i], i, fn( elems[i], key ) ) ); elems[ i ],
key,
raw ? value : value.call( elems[ i ], i,
fn( elems[ i ], key ) )
);
} }
} }
} }
return chainable ? return chainable ?
elems : elems :
// Gets // Gets
bulk ? bulk ?
fn.call( elems ) : fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet; length ? fn( elems[ 0 ], key ) : emptyGet;
}; };
var rcheckableType = (/^(?:checkbox|radio)$/i); var rcheckableType = ( /^(?:checkbox|radio)$/i );
(function() { var rtagName = ( /<([\w:-]+)/ );
// Minified: var a,b,c
var input = document.createElement( "input" ), var rscriptType = ( /^$|\/(?:java|ecma)script/i );
div = document.createElement( "div" ),
fragment = document.createDocumentFragment(); var rleadingWhitespace = ( /^\s+/ );
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
"details|dialog|figcaption|figure|footer|header|hgroup|main|" +
"mark|meter|nav|output|picture|progress|section|summary|template|
time|video";
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
( function() {
var div = document.createElement( "div" ),
fragment = document.createDocumentFragment(),
input = document.createElement( "input" );
// Setup // Setup
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='c heckbox'/>"; div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='c heckbox'/>";
// IE strips leading whitespace when .innerHTML is used // IE strips leading whitespace when .innerHTML is used
support.leadingWhitespace = div.firstChild.nodeType === 3; support.leadingWhitespace = div.firstChild.nodeType === 3;
// Make sure that tbody elements aren't automatically inserted // Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables // IE will insert them into empty tables
support.tbody = !div.getElementsByTagName( "tbody" ).length; support.tbody = !div.getElementsByTagName( "tbody" ).length;
skipping to change at line 4170 skipping to change at line 4464
fragment.appendChild( input ); fragment.appendChild( input );
support.appendChecked = input.checked; support.appendChecked = input.checked;
// Make sure textarea (and checkbox) defaultValue is properly cloned // Make sure textarea (and checkbox) defaultValue is properly cloned
// Support: IE6-IE11+ // Support: IE6-IE11+
div.innerHTML = "<textarea>x</textarea>"; div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
// #11217 - WebKit loses check when the name is after the checked attribu te // #11217 - WebKit loses check when the name is after the checked attribu te
fragment.appendChild( div ); fragment.appendChild( div );
div.innerHTML = "<input type='radio' checked='checked' name='t'/>";
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input = document.createElement( "input" );
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
div.appendChild( input );
// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
// old WebKit doesn't clone checked state correctly in fragments // old WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.ch ecked; support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.ch ecked;
// Support: IE<9 // Support: IE<9
// Opera does not clone events (and typeof div.attachEvent === undefined) // Cloned elements keep attachEvent handlers, we use addEventListener on
. IE9+
// IE9-10 clones events bound via attachEvent, but they don't trigger wit support.noCloneEvent = !!div.addEventListener;
h .click()
support.noCloneEvent = true; // Support: IE<9
if ( div.attachEvent ) { // Since attributes and properties are the same in IE,
div.attachEvent( "onclick", function() { // cleanData must set properties to undefined rather than use removeAttri
support.noCloneEvent = false; bute
}); div[ jQuery.expando ] = 1;
support.attributes = !div.getAttribute( jQuery.expando );
} )();
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
// Support: IE8
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags
,
// unless wrapped in a div with non-breaking characters in front of it.
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>"
]
};
// Support: IE8-IE9
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.the
ad;
wrapMap.th = wrapMap.td;
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== "undefined" ?
context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context;
( elem = elems[ i ] ) != null;
i++
) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
div.cloneNode( true ).click(); // Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; ( elem = elems[ i ] ) != null; i++ ) {
jQuery._data(
elem,
"globalEval",
!refElements || jQuery._data( refElements[ i ], "globalEv
al" )
);
} }
}
// Execute the test only if not already executed in another module. var rhtml = /<|&#?\w+;/,
if (support.deleteExpando == null) { rtbody = /<tbody/i;
// Support: IE<9
support.deleteExpando = true; function fixDefaultChecked( elem ) {
try { if ( rcheckableType.test( elem.type ) ) {
delete div.test; elem.defaultChecked = elem.checked;
} catch( e ) { }
support.deleteExpando = false; }
function buildFragment( elems, context, scripts, selection, ignored ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ elem ] : e
lem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.createElem
ent( "div" ) );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1
].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter(
elem ) + wrap[ 2 ];
// Descend through wrappers to the right content
j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !support.leadingWhitespace && rleadingWhites
pace.test( elem ) ) {
nodes.push( context.createTextNode( rlead
ingWhitespace.exec( elem )[ 0 ] ) );
}
// Remove IE's autoinserted <tbody> from table fr
agments
if ( !support.tbody ) {
// String was a <table>, *may* have spuri
ous <tbody>
elem = tag === "table" && !rtbody.test( e
lem ) ?
tmp.firstChild :
// String was a bare <thead> or <
tfoot>
wrap[ 1 ] === "<table>" && !rtbod
y.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
if ( jQuery.nodeName( ( tbody = e
lem.childNodes[ j ] ), "tbody" ) &&
!tbody.childNodes.length
) {
elem.removeChild( tbody )
;
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild );
}
// Remember the top-level container for proper cl
eanup
tmp = safe.lastChild;
}
} }
} }
})();
(function() { // Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
}
i = 0;
while ( ( elem = nodes[ i++ ] ) ) {
// Skip elements already in the context collection (trac-4087)
if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( ( elem = tmp[ j++ ] ) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
}
( function() {
var i, eventName, var i, eventName,
div = document.createElement( "div" ); div = document.createElement( "div" );
// Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin e // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | ou
vent) t) events)
for ( i in { submit: true, change: true, focusin: true }) { for ( i in { submit: true, change: true, focusin: true } ) {
eventName = "on" + i; eventName = "on" + i;
if ( !(support[ i + "Bubbles" ] = eventName in window) ) { if ( !( support[ i ] = eventName in window ) ) {
// Beware of CSP restrictions (https://developer.mozilla. org/en/Security/CSP) // Beware of CSP restrictions (https://developer.mozilla. org/en/Security/CSP)
div.setAttribute( eventName, "t" ); div.setAttribute( eventName, "t" );
support[ i + "Bubbles" ] = div.attributes[ eventName ].ex pando === false; support[ i ] = div.attributes[ eventName ].expando === fa lse;
} }
} }
// Null elements to avoid leaks in IE. // Null elements to avoid leaks in IE.
div = null; div = null;
})(); } )();
var rformElems = /^(?:input|select|textarea)$/i, var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/, rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() { function returnTrue() {
return true; return true;
} }
function returnFalse() { function returnFalse() {
return false; return false;
} }
// Support: IE9
// See #13393 for more info
function safeActiveElement() { function safeActiveElement() {
try { try {
return document.activeElement; return document.activeElement;
} catch ( err ) { } } catch ( err ) { }
} }
function on( elem, types, selector, data, fn, one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
on( elem, type, selector, data, types[ type ], one );
}
return elem;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return elem;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return elem.each( function() {
jQuery.event.add( this, types, fn, data, selector );
} );
}
/* /*
* Helper functions for managing events -- not part of the public interface. * Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas. * Props to Dean Edwards' addEvent library for many of the ideas.
*/ */
jQuery.event = { jQuery.event = {
global: {}, global: {},
add: function( elem, types, handler, data, selector ) { add: function( elem, types, handler, data, selector ) {
var tmp, events, t, handleObjIn, var tmp, events, t, handleObjIn,
skipping to change at line 4271 skipping to change at line 4829
handler = handleObjIn.handler; handler = handleObjIn.handler;
selector = handleObjIn.selector; selector = handleObjIn.selector;
} }
// Make sure that the handler has a unique ID, used to find/remov e it later // Make sure that the handler has a unique ID, used to find/remov e it later
if ( !handler.guid ) { if ( !handler.guid ) {
handler.guid = jQuery.guid++; handler.guid = jQuery.guid++;
} }
// Init the element's event structure and main handler, if this i s the first // Init the element's event structure and main handler, if this i s the first
if ( !(events = elemData.events) ) { if ( !( events = elemData.events ) ) {
events = elemData.events = {}; events = elemData.events = {};
} }
if ( !(eventHandle = elemData.handle) ) { if ( !( eventHandle = elemData.handle ) ) {
eventHandle = elemData.handle = function( e ) { eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.tri gger() and // Discard the second event of a jQuery.event.tri gger() and
// when an event is called after a page has unloa ded // when an event is called after a page has unloa ded
return typeof jQuery !== strundefined && (!e || j return typeof jQuery !== "undefined" &&
Query.event.triggered !== e.type) ? ( !e || jQuery.event.triggered !== e.type
) ?
jQuery.event.dispatch.apply( eventHandle. elem, arguments ) : jQuery.event.dispatch.apply( eventHandle. elem, arguments ) :
undefined; undefined;
}; };
// Add elem as a property of the handle fn to prevent a m
emory leak with IE non-native events // Add elem as a property of the handle fn to prevent a m
emory leak
// with IE non-native events
eventHandle.elem = elem; eventHandle.elem = elem;
} }
// Handle multiple events separated by a space // Handle multiple events separated by a space
types = ( types || "" ).match( rnotwhite ) || [ "" ]; types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length; t = types.length;
while ( t-- ) { while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || []; tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[1]; type = origType = tmp[ 1 ];
namespaces = ( tmp[2] || "" ).split( "." ).sort(); namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only ha ndlers // There *must* be a type, no attaching namespace-only ha ndlers
if ( !type ) { if ( !type ) {
continue; continue;
} }
// If event changes its type, use the special event handl ers for the changed type // If event changes its type, use the special event handl ers for the changed type
special = jQuery.event.special[ type ] || {}; special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type // If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindTy pe ) || type; type = ( selector ? special.delegateType : special.bindTy pe ) || type;
// Update special based on newly reset type // Update special based on newly reset type
special = jQuery.event.special[ type ] || {}; special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers // handleObj is passed to all event handlers
handleObj = jQuery.extend({ handleObj = jQuery.extend( {
type: type, type: type,
origType: origType, origType: origType,
data: data, data: data,
handler: handler, handler: handler,
guid: handler.guid, guid: handler.guid,
selector: selector, selector: selector,
needsContext: selector && jQuery.expr.match.needs Context.test( selector ), needsContext: selector && jQuery.expr.match.needs Context.test( selector ),
namespace: namespaces.join(".") namespace: namespaces.join( "." )
}, handleObjIn ); }, handleObjIn );
// Init the event handler queue if we're the first // Init the event handler queue if we're the first
if ( !(handlers = events[ type ]) ) { if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = []; handlers = events[ type ] = [];
handlers.delegateCount = 0; handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the s pecial events handler returns false // Only use addEventListener/attachEvent if the s pecial events handler returns false
if ( !special.setup || special.setup.call( elem, if ( !special.setup ||
data, namespaces, eventHandle ) === false ) { special.setup.call( elem, data, namespace
s, eventHandle ) === false ) {
// Bind the global event handler to the e lement // Bind the global event handler to the e lement
if ( elem.addEventListener ) { if ( elem.addEventListener ) {
elem.addEventListener( type, even tHandle, false ); elem.addEventListener( type, even tHandle, false );
} else if ( elem.attachEvent ) { } else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, ev entHandle ); elem.attachEvent( "on" + type, ev entHandle );
} }
} }
} }
skipping to change at line 4368 skipping to change at line 4932
}, },
// Detach an event or set of events from an element // Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) { remove: function( elem, types, handler, selector, mappedTypes ) {
var j, handleObj, tmp, var j, handleObj, tmp,
origCount, t, events, origCount, t, events,
special, handlers, type, special, handlers, type,
namespaces, origType, namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem ) ; elemData = jQuery.hasData( elem ) && jQuery._data( elem ) ;
if ( !elemData || !(events = elemData.events) ) { if ( !elemData || !( events = elemData.events ) ) {
return; return;
} }
// Once for each type.namespace in types; type may be omitted // Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( rnotwhite ) || [ "" ]; types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length; t = types.length;
while ( t-- ) { while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || []; tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[1]; type = origType = tmp[ 1 ];
namespaces = ( tmp[2] || "" ).split( "." ).sort(); namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element // Unbind all events (on this namespace, if provided) for the element
if ( !type ) { if ( !type ) {
for ( type in events ) { for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
} }
continue; continue;
} }
special = jQuery.event.special[ type ] || {}; special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindTy pe ) || type; type = ( selector ? special.delegateType : special.bindTy pe ) || type;
handlers = events[ type ] || []; handlers = events[ type ] || [];
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join(" tmp = tmp[ 2 ] &&
\\.(?:.*\\.|)") + "(\\.|$)" ); new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.
*\\.|)" ) + "(\\.|$)" );
// Remove matching events // Remove matching events
origCount = j = handlers.length; origCount = j = handlers.length;
while ( j-- ) { while ( j-- ) {
handleObj = handlers[ j ]; handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.orig Type ) && if ( ( mappedTypes || origType === handleObj.orig Type ) &&
( !handler || handler.guid === handleObj. guid ) && ( !handler || handler.guid === handleObj. guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) && ( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.sel ( !selector || selector === handleObj.sel
ector || selector === "**" && handleObj.selector ) ) { ector ||
selector === "**" && handleObj.se
lector ) ) {
handlers.splice( j, 1 ); handlers.splice( j, 1 );
if ( handleObj.selector ) { if ( handleObj.selector ) {
handlers.delegateCount--; handlers.delegateCount--;
} }
if ( special.remove ) { if ( special.remove ) {
special.remove.call( elem, handle Obj ); special.remove.call( elem, handle Obj );
} }
} }
} }
// Remove generic event handler if we removed something a nd no more handlers exist // Remove generic event handler if we removed something a nd no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers) // (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) { if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( if ( !special.teardown ||
elem, namespaces, elemData.handle ) === false ) { special.teardown.call( elem, namespaces,
elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData. handle ); jQuery.removeEvent( elem, type, elemData. handle );
} }
delete events[ type ]; delete events[ type ];
} }
} }
// Remove the expando if it's no longer used // Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) { if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle; delete elemData.handle;
skipping to change at line 4439 skipping to change at line 5007
// so use it instead of delete // so use it instead of delete
jQuery._removeData( elem, "events" ); jQuery._removeData( elem, "events" );
} }
}, },
trigger: function( event, data, elem, onlyHandlers ) { trigger: function( event, data, elem, onlyHandlers ) {
var handle, ontype, cur, var handle, ontype, cur,
bubbleType, special, tmp, i, bubbleType, special, tmp, i,
eventPath = [ elem || document ], eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event, type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.na mespace.split(".") : []; namespaces = hasOwn.call( event, "namespace" ) ? event.na mespace.split( "." ) : [];
cur = tmp = elem = elem || document; cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes // Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return; return;
} }
// focus/blur morphs to focusin/out; ensure we're not firing them right now // focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return; return;
} }
if ( type.indexOf(".") >= 0 ) { if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event typ e in handle() // Namespaced trigger; create a regexp to match event typ e in handle()
namespaces = type.split("."); namespaces = type.split( "." );
type = namespaces.shift(); type = namespaces.shift();
namespaces.sort(); namespaces.sort();
} }
ontype = type.indexOf(":") < 0 && "on" + type; ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an e vent type string // Caller can pass in a jQuery.Event object, Object, or just an e vent type string
event = event[ jQuery.expando ] ? event = event[ jQuery.expando ] ?
event : event :
new jQuery.Event( type, typeof event === "object" && even t ); new jQuery.Event( type, typeof event === "object" && even t );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (alwa ys true) // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (alwa ys true)
event.isTrigger = onlyHandlers ? 2 : 3; event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join("."); event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace ? event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)"
+ "(\\.|$)" ) : ) + "(\\.|$)" ) :
null; null;
// Clean up the event in case it is being reused // Clean up the event in case it is being reused
event.result = undefined; event.result = undefined;
if ( !event.target ) { if ( !event.target ) {
event.target = elem; event.target = elem;
} }
// Clone any incoming data and prepend the event, creating the ha ndler arg list // Clone any incoming data and prepend the event, creating the ha ndler arg list
data = data == null ? data = data == null ?
skipping to change at line 4504 skipping to change at line 5073
bubbleType = special.delegateType || type; bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) { if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode; cur = cur.parentNode;
} }
for ( ; cur; cur = cur.parentNode ) { for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur ); eventPath.push( cur );
tmp = cur; tmp = cur;
} }
// Only add window if we got to document (e.g., not plain obj or detached DOM) // Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === (elem.ownerDocument || document) ) { if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWind ow || window ); eventPath.push( tmp.defaultView || tmp.parentWind ow || window );
} }
} }
// Fire handlers on the event path // Fire handlers on the event path
i = 0; i = 0;
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped () ) {
event.type = i > 1 ? event.type = i > 1 ?
bubbleType : bubbleType :
special.bindType || type; special.bindType || type;
// jQuery handler // jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.t handle = ( jQuery._data( cur, "events" ) || {} )[ event.t
ype ] && jQuery._data( cur, "handle" ); ype ] &&
jQuery._data( cur, "handle" );
if ( handle ) { if ( handle ) {
handle.apply( cur, data ); handle.apply( cur, data );
} }
// Native handler // Native handler
handle = ontype && cur[ ontype ]; handle = ontype && cur[ ontype ];
if ( handle && handle.apply && jQuery.acceptData( cur ) ) { if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data ); event.result = handle.apply( cur, data );
if ( event.result === false ) { if ( event.result === false ) {
event.preventDefault(); event.preventDefault();
} }
} }
} }
event.type = type; event.type = type;
// If nobody prevented the default action, do it now // If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( eventP if (
ath.pop(), data ) === false) && ( !special._default ||
jQuery.acceptData( elem ) ) { special._default.apply( eventPath.pop(), data )
=== false
) && acceptData( elem )
) {
// Call a native DOM method on the target with th e same name name as the event. // Call a native DOM method on the target with th e same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test. // Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's whe re global variables be (#6170) // Don't do default actions on window, that's whe re global variables be (#6170)
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when w e call its FOO() method // Don't re-trigger an onFOO event when w e call its FOO() method
tmp = elem[ ontype ]; tmp = elem[ ontype ];
if ( tmp ) { if ( tmp ) {
elem[ ontype ] = null; elem[ ontype ] = null;
} }
// Prevent re-triggering of the same even t, since we already bubbled it above // Prevent re-triggering of the same even t, since we already bubbled it above
jQuery.event.triggered = type; jQuery.event.triggered = type;
try { try {
elem[ type ](); elem[ type ]();
} catch ( e ) { } catch ( e ) {
// IE<9 dies on focus/blur to hid den element (#1486,#12518) // IE<9 dies on focus/blur to hid den element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode // only reproducible on winXP IE8 native, not IE9 in IE8 mode
} }
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
if ( tmp ) { if ( tmp ) {
elem[ ontype ] = tmp; elem[ ontype ] = tmp;
} }
} }
} }
} }
return event.result; return event.result;
}, },
dispatch: function( event ) { dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object // Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event ); event = jQuery.event.fix( event );
var i, ret, handleObj, matched, j, var i, j, ret, matched, handleObj,
handlerQueue = [], handlerQueue = [],
args = slice.call( arguments ), args = slice.call( arguments ),
handlers = ( jQuery._data( this, "events" ) || {} )[ even t.type ] || [], handlers = ( jQuery._data( this, "events" ) || {} )[ even t.type ] || [],
special = jQuery.event.special[ event.type ] || {}; special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event // Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event; args[ 0 ] = event;
event.delegateTarget = this; event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired // Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return; return;
} }
// Determine handlers // Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers ); handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us // Run delegates first; they may want to stop propagation beneath us
i = 0; i = 0;
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationSt opped() ) { while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagation Stopped() ) {
event.currentTarget = matched.elem; event.currentTarget = matched.elem;
j = 0; j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.i while ( ( handleObj = matched.handlers[ j++ ] ) &&
sImmediatePropagationStopped() ) { !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespa // Triggered event must either 1) have no namespa
ce, or ce, or 2) have namespace(s)
// 2) have namespace(s) a subset or equal to thos // a subset or equal to those in the bound event
e in the bound event (both can have no namespace). (both can have no namespace).
if ( !event.namespace_re || event.namespace_re.te if ( !event.rnamespace || event.rnamespace.test(
st( handleObj.namespace ) ) { handleObj.namespace ) ) {
event.handleObj = handleObj; event.handleObj = handleObj;
event.data = handleObj.data; event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj. ret = ( ( jQuery.event.special[ handleObj
origType ] || {}).handle || handleObj.handler ) .origType ] || {} ).handle ||
.apply( matched.elem, arg handleObj.handler ).apply( matche
s ); d.elem, args );
if ( ret !== undefined ) { if ( ret !== undefined ) {
if ( (event.result = ret) === fal se ) { if ( ( event.result = ret ) === f alse ) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
} }
} }
} }
} }
} }
// Call the postDispatch hook for the mapped type // Call the postDispatch hook for the mapped type
if ( special.postDispatch ) { if ( special.postDispatch ) {
special.postDispatch.call( this, event ); special.postDispatch.call( this, event );
} }
return event.result; return event.result;
}, },
handlers: function( event, handlers ) { handlers: function( event, handlers ) {
var sel, handleObj, matches, i, var i, matches, sel, handleObj,
handlerQueue = [], handlerQueue = [],
delegateCount = handlers.delegateCount, delegateCount = handlers.delegateCount,
cur = event.target; cur = event.target;
// Support (at least): Chrome, IE9
// Find delegate handlers // Find delegate handlers
// Black-hole SVG <use> instance trees (#13180) // Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861) //
if ( delegateCount && cur.nodeType && (!event.button || event.typ // Support: Firefox<=42+
e !== "click") ) { // Avoid non-left-click in FF but don't block IE radio events (#3
861, gh-2343)
if ( delegateCount && cur.nodeType &&
( event.type !== "click" || isNaN( event.button ) || even
t.button < 1 ) ) {
/* jshint eqeqeq: false */ /* jshint eqeqeq: false */
for ( ; cur != this; cur = cur.parentNode || this ) { for ( ; cur != this; cur = cur.parentNode || this ) {
/* jshint eqeqeq: true */ /* jshint eqeqeq: true */
// Don't check non-elements (#13208) // Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#69 11, #8165, #11382, #11764) // Don't process clicks on disabled elements (#69 11, #8165, #11382, #11764)
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { if ( cur.nodeType === 1 && ( cur.disabled !== tru e || event.type !== "click" ) ) {
matches = []; matches = [];
for ( i = 0; i < delegateCount; i++ ) { for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ]; handleObj = handlers[ i ];
// Don't conflict with Object.pro totype properties (#13203) // Don't conflict with Object.pro totype properties (#13203)
sel = handleObj.selector + " "; sel = handleObj.selector + " ";
if ( matches[ sel ] === undefined ) { if ( matches[ sel ] === undefined ) {
matches[ sel ] = handleOb j.needsContext ? matches[ sel ] = handleOb j.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 : jQuery( sel, this ).index( cur ) > -1 :
jQuery.find( sel, this, null, [ cur ] ).length; jQuery.find( sel, this, null, [ cur ] ).length;
} }
if ( matches[ sel ] ) { if ( matches[ sel ] ) {
matches.push( handleObj ) ; matches.push( handleObj ) ;
} }
} }
if ( matches.length ) { if ( matches.length ) {
handlerQueue.push({ elem: cur, ha ndlers: matches }); handlerQueue.push( { elem: cur, h andlers: matches } );
} }
} }
} }
} }
// Add the remaining (directly-bound) handlers // Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) { if ( delegateCount < handlers.length ) {
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); handlerQueue.push( { elem: this, handlers: handlers.slice ( delegateCount ) } );
} }
return handlerQueue; return handlerQueue;
}, },
fix: function( event ) { fix: function( event ) {
if ( event[ jQuery.expando ] ) { if ( event[ jQuery.expando ] ) {
return event; return event;
} }
skipping to change at line 4713 skipping to change at line 5293
prop = copy[ i ]; prop = copy[ i ];
event[ prop ] = originalEvent[ prop ]; event[ prop ] = originalEvent[ prop ];
} }
// Support: IE<9 // Support: IE<9
// Fix target property (#1925) // Fix target property (#1925)
if ( !event.target ) { if ( !event.target ) {
event.target = originalEvent.srcElement || document; event.target = originalEvent.srcElement || document;
} }
// Support: Chrome 23+, Safari? // Support: Safari 6-8+
// Target should not be a text node (#504, #13143) // Target should not be a text node (#504, #13143)
if ( event.target.nodeType === 3 ) { if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode; event.target = event.target.parentNode;
} }
// Support: IE<9 // Support: IE<9
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328) // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
event.metaKey = !!event.metaKey; event.metaKey = !!event.metaKey;
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
}, },
// Includes some event props shared by KeyEvent and MouseEvent // Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKe props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPha
y relatedTarget shiftKey target timeStamp view which".split(" "), se " +
"metaKey relatedTarget shiftKey target timeStamp view which" ).sp
lit( " " ),
fixHooks: {}, fixHooks: {},
keyHooks: { keyHooks: {
props: "char charCode key keyCode".split(" "), props: "char charCode key keyCode".split( " " ),
filter: function( event, original ) { filter: function( event, original ) {
// Add which for key events // Add which for key events
if ( event.which == null ) { if ( event.which == null ) {
event.which = original.charCode != null ? origina l.charCode : original.keyCode; event.which = original.charCode != null ? origina l.charCode : original.keyCode;
} }
return event; return event;
} }
}, },
mouseHooks: { mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offset props: ( "button buttons clientX clientY fromElement offsetX offs
Y pageX pageY screenX screenY toElement".split(" "), etY " +
"pageX pageY screenX screenY toElement" ).split( " " ),
filter: function( event, original ) { filter: function( event, original ) {
var body, eventDoc, doc, var body, eventDoc, doc,
button = original.button, button = original.button,
fromElement = original.fromElement; fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available // Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) { if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document ; eventDoc = event.target.ownerDocument || document ;
doc = eventDoc.documentElement; doc = eventDoc.documentElement;
body = eventDoc.body; body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scr event.pageX = original.clientX +
ollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && b ( doc && doc.scrollLeft || body && body.s
ody.clientLeft || 0 ); crollLeft || 0 ) -
event.pageY = original.clientY + ( doc && doc.scr ( doc && doc.clientLeft || body && body.c
ollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && b lientLeft || 0 );
ody.clientTop || 0 ); event.pageY = original.clientY +
( doc && doc.scrollTop || body && body.s
crollTop || 0 ) -
( doc && doc.clientTop || body && body.c
lientTop || 0 );
} }
// Add relatedTarget, if necessary // Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) { if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.targe event.relatedTarget = fromElement === event.targe
t ? original.toElement : fromElement; t ?
original.toElement :
fromElement;
} }
// Add which for click: 1 === left; 2 === middle; 3 === r ight // Add which for click: 1 === left; 2 === middle; 3 === r ight
// Note: button is not normalized, so don't use it // Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) { if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
} }
return event; return event;
} }
}, },
special: { special: {
load: { load: {
// Prevent triggered image.load events from bubbling to w indow.load // Prevent triggered image.load events from bubbling to w indow.load
noBubble: true noBubble: true
}, },
focus: { focus: {
// Fire native event if possible so blur/focus sequence i s correct // Fire native event if possible so blur/focus sequence i s correct
trigger: function() { trigger: function() {
if ( this !== safeActiveElement() && this.focus ) { if ( this !== safeActiveElement() && this.focus ) {
try { try {
this.focus(); this.focus();
return false; return false;
} catch ( e ) { } catch ( e ) {
// Support: IE<9 // Support: IE<9
// If we error on focus to hidden element (#1486, #12518), // If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handler s // let .trigger() run the handler s
} }
} }
}, },
delegateType: "focusin" delegateType: "focusin"
}, },
blur: { blur: {
trigger: function() { trigger: function() {
if ( this === safeActiveElement() && this.blur ) { if ( this === safeActiveElement() && this.blur ) {
this.blur(); this.blur();
return false; return false;
} }
}, },
delegateType: "focusout" delegateType: "focusout"
}, },
click: { click: {
// For checkbox, fire native event so checked state will be right // For checkbox, fire native event so checked state will be right
trigger: function() { trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.typ e === "checkbox" && this.click ) { if ( jQuery.nodeName( this, "input" ) && this.typ e === "checkbox" && this.click ) {
this.click(); this.click();
return false; return false;
} }
}, },
// For cross-browser consistency, don't fire native .clic k() on links // For cross-browser consistency, don't fire native .clic k() on links
_default: function( event ) { _default: function( event ) {
skipping to change at line 4833 skipping to change at line 5425
// Support: Firefox 20+ // Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set. // Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined && event.original Event ) { if ( event.result !== undefined && event.original Event ) {
event.originalEvent.returnValue = event.r esult; event.originalEvent.returnValue = event.r esult;
} }
} }
} }
}, },
simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one
// Piggyback on a donor event to simulate a different one. simulate: function( type, elem, event ) {
// Fake originalEvent to avoid donor's stopPropagation, but if th
e
// simulated event prevents default then we do the same on the do
nor.
var e = jQuery.extend( var e = jQuery.extend(
new jQuery.Event(), new jQuery.Event(),
event, event,
{ {
type: type, type: type,
isSimulated: true, isSimulated: true
originalEvent: {}
// Previously, `originalEvent: {}` was set here,
so stopPropagation call
// would not be triggered on donor event, since i
n our own
// jQuery.event.stopPropagation function we had a
check for existence of
// originalEvent.stopPropagation method, so, cons
equently it would be a noop.
//
// Guard for simulated events was moved to jQuery
.event.stopPropagation function
// since `originalEvent` should point to the orig
inal event for the
// constancy with other events and for more focus
ed logic
} }
); );
if ( bubble ) {
jQuery.event.trigger( e, null, elem ); jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) { if ( e.isDefaultPrevented() ) {
event.preventDefault(); event.preventDefault();
} }
} }
}; };
jQuery.removeEvent = document.removeEventListener ? jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) { function( elem, type, handle ) {
// This "if" is needed for plain objects
if ( elem.removeEventListener ) { if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false ); elem.removeEventListener( type, handle );
} }
} : } :
function( elem, type, handle ) { function( elem, type, handle ) {
var name = "on" + type; var name = "on" + type;
if ( elem.detachEvent ) { if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom event s in IE6-8 // #8545, #7054, preventing memory leaks for custom event s in IE6-8
// detachEvent needed property on element, by name of tha // detachEvent needed property on element, by name of tha
t event, to properly expose it to GC t event,
if ( typeof elem[ name ] === strundefined ) { // to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null; elem[ name ] = null;
} }
elem.detachEvent( name, handle ); elem.detachEvent( name, handle );
} }
}; };
jQuery.Event = function( src, props ) { jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword // Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) { if ( !( this instanceof jQuery.Event ) ) {
return new jQuery.Event( src, props ); return new jQuery.Event( src, props );
} }
// Event object // Event object
if ( src && src.type ) { if ( src && src.type ) {
this.originalEvent = src; this.originalEvent = src;
this.type = src.type; this.type = src.type;
// Events bubbling up the document may have been marked as preven ted // Events bubbling up the document may have been marked as preven ted
// by a handler lower down the tree; reflect the correct value. // by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = src.defaultPrevented || this.isDefaultPrevented = src.defaultPrevented ||
src.defaultPrevented === undefined && src.defaultPrevented === undefined &&
// Support: IE < 9, Android < 4.0 // Support: IE < 9, Android < 4.0
src.returnValue === false ? src.returnValue === false ?
returnTrue : returnTrue :
returnFalse; returnFalse;
// Event type // Event type
} else { } else {
this.type = src; this.type = src;
} }
skipping to change at line 4918 skipping to change at line 5519
// Create a timestamp if incoming event doesn't have one // Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now(); this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed // Mark it as fixed
this[ jQuery.expando ] = true; this[ jQuery.expando ] = true;
}; };
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // 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 // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding. html
jQuery.Event.prototype = { jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse, isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse, isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse,
preventDefault: function() { preventDefault: function() {
var e = this.originalEvent; var e = this.originalEvent;
this.isDefaultPrevented = returnTrue; this.isDefaultPrevented = returnTrue;
if ( !e ) { if ( !e ) {
return; return;
skipping to change at line 4944 skipping to change at line 5546
// Support: IE // Support: IE
// Otherwise set the returnValue property of the original event t o false // Otherwise set the returnValue property of the original event t o false
} else { } else {
e.returnValue = false; e.returnValue = false;
} }
}, },
stopPropagation: function() { stopPropagation: function() {
var e = this.originalEvent; var e = this.originalEvent;
this.isPropagationStopped = returnTrue; this.isPropagationStopped = returnTrue;
if ( !e ) {
if ( !e || this.isSimulated ) {
return; return;
} }
// If stopPropagation exists, run it on the original event // If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) { if ( e.stopPropagation ) {
e.stopPropagation(); e.stopPropagation();
} }
// Support: IE // Support: IE
// Set the cancelBubble property of the original event to true // Set the cancelBubble property of the original event to true
e.cancelBubble = true; e.cancelBubble = true;
}, },
stopImmediatePropagation: function() { stopImmediatePropagation: function() {
skipping to change at line 4970 skipping to change at line 5574
if ( e && e.stopImmediatePropagation ) { if ( e && e.stopImmediatePropagation ) {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
} }
this.stopPropagation(); this.stopPropagation();
} }
}; };
// Create mouseenter/leave events using mouseover/out and event-time checks // Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({ // so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://code.google.com/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
mouseenter: "mouseover", mouseenter: "mouseover",
mouseleave: "mouseout", mouseleave: "mouseout",
pointerenter: "pointerover", pointerenter: "pointerover",
pointerleave: "pointerout" pointerleave: "pointerout"
}, function( orig, fix ) { }, function( orig, fix ) {
jQuery.event.special[ orig ] = { jQuery.event.special[ orig ] = {
delegateType: fix, delegateType: fix,
bindType: fix, bindType: fix,
handle: function( event ) { handle: function( event ) {
var ret, var ret,
target = this, target = this,
related = event.relatedTarget, related = event.relatedTarget,
handleObj = event.handleObj; handleObj = event.handleObj;
// For mousenter/leave call the handler if related is out side the target. // For mouseenter/leave call the handler if related is ou tside the target.
// NB: No relatedTarget if the mouse left/entered the bro wser window // NB: No relatedTarget if the mouse left/entered the bro wser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) { if ( !related || ( related !== target && !jQuery.contains ( target, related ) ) ) {
event.type = handleObj.origType; event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments ); ret = handleObj.handler.apply( this, arguments );
event.type = fix; event.type = fix;
} }
return ret; return ret;
} }
}; };
}); } );
// IE submit delegation // IE submit delegation
if ( !support.submitBubbles ) { if ( !support.submit ) {
jQuery.event.special.submit = { jQuery.event.special.submit = {
setup: function() { setup: function() {
// Only need this for delegated form submit events // Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) { if ( jQuery.nodeName( this, "form" ) ) {
return false; return false;
} }
// Lazy-add a submit handler when a descendant form may p otentially be submitted // Lazy-add a submit handler when a descendant form may p otentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) { jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807) // Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target, var elem = e.target,
form = jQuery.nodeName( elem, "input" ) | form = jQuery.nodeName( elem, "input" ) |
| jQuery.nodeName( elem, "button" ) ? elem.form : undefined; | jQuery.nodeName( elem, "button" ) ?
if ( form && !jQuery._data( form, "submitBubbles"
) ) { // Support: IE <=8
// We use jQuery.prop instead of
elem.form
// to allow fixing the IE8 delega
ted submit issue (gh-2332)
// by 3rd party polyfills/workaro
unds.
jQuery.prop( elem, "form" ) :
undefined;
if ( form && !jQuery._data( form, "submit" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) { jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true; event._submitBubble = true;
}); } );
jQuery._data( form, "submitBubbles", true jQuery._data( form, "submit", true );
);
} }
}); } );
// return undefined since we don't need an event listener // return undefined since we don't need an event listener
}, },
postDispatch: function( event ) { postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree // If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) { if ( event._submitBubble ) {
delete event._submit_bubble; delete event._submitBubble;
if ( this.parentNode && !event.isTrigger ) { if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.par entNode, event, true ); jQuery.event.simulate( "submit", this.par entNode, event );
} }
} }
}, },
teardown: function() { teardown: function() {
// Only need this for delegated form submit events // Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) { if ( jQuery.nodeName( this, "form" ) ) {
return false; return false;
} }
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" ); jQuery.event.remove( this, "._submit" );
} }
}; };
} }
// IE change delegation and checkbox/radio fix // IE change delegation and checkbox/radio fix
if ( !support.changeBubbles ) { if ( !support.change ) {
jQuery.event.special.change = { jQuery.event.special.change = {
setup: function() { setup: function() {
if ( rformElems.test( this.nodeName ) ) { if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click // 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. // after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for ch eck/radio after blur. // This still fires onchange a second time for ch eck/radio after blur.
if ( this.type === "checkbox" || this.type === "r adio" ) { if ( this.type === "checkbox" || this.type === "r adio" ) {
jQuery.event.add( this, "propertychange._ change", function( event ) { jQuery.event.add( this, "propertychange._ change", function( event ) {
if ( event.originalEvent.property Name === "checked" ) { if ( event.originalEvent.property Name === "checked" ) {
this._just_changed = true ; this._justChanged = true;
} }
}); } );
jQuery.event.add( this, "click._change", function( event ) { jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event if ( this._justChanged && !event.
.isTrigger ) { isTrigger ) {
this._just_changed = fals this._justChanged = false
e; ;
} }
// Allow triggered, simulated cha nge events (#11500) // Allow triggered, simulated cha nge events (#11500)
jQuery.event.simulate( "change", jQuery.event.simulate( "change",
this, event, true ); this, event );
}); } );
} }
return false; return false;
} }
// Delegated event; lazy-add a change handler on descenda nt inputs // Delegated event; lazy-add a change handler on descenda nt inputs
jQuery.event.add( this, "beforeactivate._change", functio n( e ) { jQuery.event.add( this, "beforeactivate._change", functio n( e ) {
var elem = e.target; var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery. _data( elem, "changeBubbles" ) ) { if ( rformElems.test( elem.nodeName ) && !jQuery. _data( elem, "change" ) ) {
jQuery.event.add( elem, "change._change", function( event ) { jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.is Simulated && !event.isTrigger ) { if ( this.parentNode && !event.is Simulated && !event.isTrigger ) {
jQuery.event.simulate( "c hange", this.parentNode, event, true ); jQuery.event.simulate( "c hange", this.parentNode, event );
} }
}); } );
jQuery._data( elem, "changeBubbles", true jQuery._data( elem, "change", true );
);
} }
}); } );
}, },
handle: function( event ) { handle: function( event ) {
var elem = event.target; var elem = event.target;
// Swallow native change events from checkbox/radio, we a lready triggered them above // Swallow native change events from checkbox/radio, we a lready triggered them above
if ( this !== elem || event.isSimulated || event.isTrigge if ( this !== elem || event.isSimulated || event.isTrigge
r || (elem.type !== "radio" && elem.type !== "checkbox") ) { r ||
( elem.type !== "radio" && elem.type !== "checkbo
x" ) ) {
return event.handleObj.handler.apply( this, argum ents ); return event.handleObj.handler.apply( this, argum ents );
} }
}, },
teardown: function() { teardown: function() {
jQuery.event.remove( this, "._change" ); jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName ); return !rformElems.test( this.nodeName );
} }
}; };
} }
// Create "bubbling" focus and blur events // Support: Firefox
if ( !support.focusinBubbles ) { // Firefox doesn't have focus(in | out) events
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
{ //
// Support: Chrome, Safari
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-foc
usevent-event-order
// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix
) {
// Attach a single capturing handler on the document while someon e wants focusin/focusout // Attach a single capturing handler on the document while someon e wants focusin/focusout
var handler = function( event ) { var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery. jQuery.event.simulate( fix, event.target, jQuery.event.fi
event.fix( event ), true ); x( event ) );
}; };
jQuery.event.special[ fix ] = { jQuery.event.special[ fix ] = {
setup: function() { setup: function() {
var doc = this.ownerDocument || this, var doc = this.ownerDocument || this,
attaches = jQuery._data( doc, fix ); attaches = jQuery._data( doc, fix );
if ( !attaches ) { if ( !attaches ) {
doc.addEventListener( orig, handler, true ); doc.addEventListener( orig, handler, true );
} }
jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); jQuery._data( doc, fix, ( attaches || 0 ) + 1 );
skipping to change at line 5135 skipping to change at line 5771
attaches = jQuery._data( doc, fix ) - 1; attaches = jQuery._data( doc, fix ) - 1;
if ( !attaches ) { if ( !attaches ) {
doc.removeEventListener( orig, handler, t rue ); doc.removeEventListener( orig, handler, t rue );
jQuery._removeData( doc, fix ); jQuery._removeData( doc, fix );
} else { } else {
jQuery._data( doc, fix, attaches ); jQuery._data( doc, fix, attaches );
} }
} }
}; };
}); } );
} }
jQuery.fn.extend({ jQuery.fn.extend( {
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var type, origFn;
// Types can be a map of types/handlers on: function( types, selector, data, fn ) {
if ( typeof types === "object" ) { return on( this, types, selector, data, fn );
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one
);
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the
info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
}, },
one: function( types, selector, data, fn ) { one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 ); return on( this, types, selector, data, fn, 1 );
}, },
off: function( types, selector, fn ) { off: function( types, selector, fn ) {
var handleObj, type; var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) { if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event // ( event ) dispatched jQuery.Event
handleObj = types.handleObj; handleObj = types.handleObj;
jQuery( types.delegateTarget ).off( jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace ?
handleObj.namespace : handleObj.origType, handleObj.origType + "." + handleObj.name
space :
handleObj.origType,
handleObj.selector, handleObj.selector,
handleObj.handler handleObj.handler
); );
return this; return this;
} }
if ( typeof types === "object" ) { if ( typeof types === "object" ) {
// ( types-object [, selector] ) // ( types-object [, selector] )
for ( type in types ) { for ( type in types ) {
this.off( type, selector, types[ type ] ); this.off( type, selector, types[ type ] );
} }
return this; return this;
} }
if ( selector === false || typeof selector === "function" ) { if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] ) // ( types [, fn] )
fn = selector; fn = selector;
selector = undefined; selector = undefined;
} }
if ( fn === false ) { if ( fn === false ) {
fn = returnFalse; fn = returnFalse;
} }
return this.each(function() { return this.each( function() {
jQuery.event.remove( this, types, fn, selector ); jQuery.event.remove( this, types, fn, selector );
}); } );
}, },
trigger: function( type, data ) { trigger: function( type, data ) {
return this.each(function() { return this.each( function() {
jQuery.event.trigger( type, data, this ); jQuery.event.trigger( type, data, this );
}); } );
}, },
triggerHandler: function( type, data ) { triggerHandler: function( type, data ) {
var elem = this[0]; var elem = this[ 0 ];
if ( elem ) { if ( elem ) {
return jQuery.event.trigger( type, data, elem, true ); return jQuery.event.trigger( type, data, elem, true );
} }
} }
}); } );
function createSafeFragment( document ) { var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
var list = nodeNames.split( "|" ), rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
safeFrag = document.createDocumentFragment(); rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+
)[^>]*)\/>/gi,
// Support: IE 10-11, Edge 10240+
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
ption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|tim
e|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)
[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
// checked="checked" or checked // checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
rscriptTypeMasked = /^true\/(.*)/, rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
// We have to close these tags to support XHTML (#13200)
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
area: [ 1, "<map>", "</map>" ],
param: [ 1, "<object>", "</object>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table
>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
// IE6-8 can't serialize link, script, style, or any html5 (NoSco
pe) tags,
// unless wrapped in a div with non-breaking characters in front
of it.
_default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>",
"</div>" ]
},
safeFragment = createSafeFragment( document ), safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") ); fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) )
;
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.the
ad;
wrapMap.th = wrapMap.td;
function getAll( context, tag ) {
var elems, elem,
i = 0,
found = typeof context.getElementsByTagName !== strundefined ? co
ntext.getElementsByTagName( tag || "*" ) :
typeof context.querySelectorAll !== strundefined ? contex
t.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem =
elems[i]) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
jQuery.merge( found, getAll( elem, tag ) );
}
}
}
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
jQuery.merge( [ context ], found ) :
found;
}
// Used in buildFragment, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
// Support: IE<8 // Support: IE<8
// Manipulating tables requires a tbody // Manipulating tables requires a tbody
function manipulationTarget( elem, content ) { function manipulationTarget( elem, content ) {
return jQuery.nodeName( elem, "table" ) && return jQuery.nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firs tChild, "tr" ) ? jQuery.nodeName( content.nodeType !== 11 ? content : content.firs tChild, "tr" ) ?
elem.getElementsByTagName("tbody")[0] || elem.getElementsByTagName( "tbody" )[ 0 ] ||
elem.appendChild( elem.ownerDocument.createElement("tbody elem.appendChild( elem.ownerDocument.createElement( "tbod
") ) : y" ) ) :
elem; elem;
} }
// Replace/restore the type attribute of script elements for safe DOM manipulati on // Replace/restore the type attribute of script elements for safe DOM manipulati on
function disableScript( elem ) { function disableScript( elem ) {
elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type ; elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.ty pe;
return elem; return elem;
} }
function restoreScript( elem ) { function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type ); var match = rscriptTypeMasked.exec( elem.type );
if ( match ) { if ( match ) {
elem.type = match[1]; elem.type = match[ 1 ];
} else { } else {
elem.removeAttribute("type"); elem.removeAttribute( "type" );
} }
return elem; return elem;
} }
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( r
efElements[i], "globalEval" ) );
}
}
function cloneCopyEvent( src, dest ) { function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return; return;
} }
var type, i, l, var type, i, l,
oldData = jQuery._data( src ), oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ), curData = jQuery._data( dest, oldData ),
events = oldData.events; events = oldData.events;
if ( events ) { if ( events ) {
skipping to change at line 5423 skipping to change at line 5939
// IE10 throws NoModificationAllowedError if parent is null, #12132. // IE10 throws NoModificationAllowedError if parent is null, #12132.
} else if ( nodeName === "object" ) { } else if ( nodeName === "object" ) {
if ( dest.parentNode ) { if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML; dest.outerHTML = src.outerHTML;
} }
// This path appears unavoidable for IE9. When cloning an object // This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient . // element in IE9, the outerHTML strategy above is not sufficient .
// If the src has innerHTML and the destination does not, // If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324 // copy the src.innerHTML into the dest.innerHTML. #10324
if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.i nnerHTML) ) ) { if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest. innerHTML ) ) ) {
dest.innerHTML = src.innerHTML; dest.innerHTML = src.innerHTML;
} }
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox // IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element // or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also se t // a checked appearance if the defaultChecked value isn't also se t
dest.defaultChecked = dest.checked = src.checked; dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned // IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on" // checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) { if ( dest.value !== src.value ) {
dest.value = src.value; dest.value = src.value;
skipping to change at line 5452 skipping to change at line 5969
} else if ( nodeName === "option" ) { } else if ( nodeName === "option" ) {
dest.defaultSelected = dest.selected = src.defaultSelected; dest.defaultSelected = dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when // IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields // cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) { } else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue; dest.defaultValue = src.defaultValue;
} }
} }
jQuery.extend({ function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
args = concat.apply( [], args );
var first, node, hasScripts,
scripts, doc, fragment,
i = 0,
l = collection.length,
iNoClone = l - 1,
value = args[ 0 ],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) )
{
return collection.each( function( index ) {
var self = collection.eq( index );
if ( isFunction ) {
args[ 0 ] = value.call( this, index, self.html()
);
}
domManip( self, args, callback, ignored );
} );
}
if ( l ) {
fragment = buildFragment( args, collection[ 0 ].ownerDocument, fa
lse, collection, ignored );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
// Require either new content or an interest in ignored elements
to invoke the callback
if ( first || ignored ) {
scripts = jQuery.map( getAll( fragment, "script" ), disab
leScript );
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070
).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for
later restoration
if ( hasScripts ) {
// Support: Android<4.1, PhantomJ
S<2
// push.apply(_, arraylike) throw
s on ancient WebKit
jQuery.merge( scripts, getAll( no
de, "script" ) );
}
}
callback.call( collection[ i ], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument
;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document
insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" )
&&
!jQuery._data( node, "globalEval"
) &&
jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Optional AJAX dependen
cy, but won't run scripts if not present
if ( jQuery._evalUrl ) {
jQuery._evalUrl(
node.src );
}
} else {
jQuery.globalEval(
( node.text || no
de.textContent || node.innerHTML || "" )
.replace(
rcleanScript, "" )
);
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return collection;
}
function remove( elem, selector, keepData ) {
var node,
elems = selector ? jQuery.filter( selector, elem ) : elem,
i = 0;
for ( ; ( node = elems[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
}
if ( node.parentNode ) {
if ( keepData && jQuery.contains( node.ownerDocument, nod
e ) ) {
setGlobalEval( getAll( node, "script" ) );
}
node.parentNode.removeChild( node );
}
}
return elem;
}
jQuery.extend( {
htmlPrefilter: function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
},
clone: function( elem, dataAndEvents, deepDataAndEvents ) { clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements, var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem ); inPage = jQuery.contains( elem.ownerDocument, elem );
if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache if ( support.html5Clone || jQuery.isXMLDoc( elem ) ||
.test( "<" + elem.nodeName + ">" ) ) { !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true ); clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes // IE<=8 does not properly clone detached, unknown element nodes
} else { } else {
fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild ) ; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ) ;
} }
if ( (!support.noCloneEvent || !support.noCloneChecked) && if ( ( !support.noCloneEvent || !support.noCloneChecked ) &&
(elem.nodeType === 1 || elem.nodeType === 11) && ( elem.nodeType === 1 || elem.nodeType === 11 ) &
!jQuery.isXMLDoc(elem) ) { & !jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: http:// jsperf.com/getall-vs-sizzle/2 // We eschew Sizzle here for performance reasons: http:// jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone ); destElements = getAll( clone );
srcElements = getAll( elem ); srcElements = getAll( elem );
// Fix all IE cloning issues // Fix all IE cloning issues
for ( i = 0; (node = srcElements[i]) != null; ++i ) { for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) {
// Ensure that the destination node is not null; Fixes #9587 // Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) { if ( destElements[ i ] ) {
fixCloneNodeIssues( node, destElements[i] fixCloneNodeIssues( node, destElements[ i
); ] );
} }
} }
} }
// Copy the events from the original to the clone // Copy the events from the original to the clone
if ( dataAndEvents ) { if ( dataAndEvents ) {
if ( deepDataAndEvents ) { if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem ); srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone ); destElements = destElements || getAll( clone );
for ( i = 0; (node = srcElements[i]) != null; i++ for ( i = 0; ( node = srcElements[ i ] ) != null;
) { i++ ) {
cloneCopyEvent( node, destElements[i] ); cloneCopyEvent( node, destElements[ i ] )
;
} }
} else { } else {
cloneCopyEvent( elem, clone ); cloneCopyEvent( elem, clone );
} }
} }
// Preserve script evaluation history // Preserve script evaluation history
destElements = getAll( clone, "script" ); destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) { if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "sc ript" ) ); setGlobalEval( destElements, !inPage && getAll( elem, "sc ript" ) );
} }
destElements = srcElements = node = null; destElements = srcElements = node = null;
// Return the cloned set // Return the cloned set
return clone; return clone;
}, },
buildFragment: function( elems, context, scripts, selection ) { cleanData: function( elems, /* internal */ forceAcceptData ) {
var j, elem, contains,
tmp, tag, tbody, wrap,
l = elems.length,
// Ensure a safe fragment
safe = createSafeFragment( context ),
nodes = [],
i = 0;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
jQuery.merge( nodes, elem.nodeType ? [ el
em ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem
) );
// Convert html into DOM nodes
} else {
tmp = tmp || safe.appendChild( context.cr
eateElement("div") );
// Deserialize a standard representation
tag = (rtagName.exec( elem ) || [ "", ""
])[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default
;
tmp.innerHTML = wrap[1] + elem.replace( r
xhtmlTag, "<$1></$2>" ) + wrap[2];
// Descend through wrappers to the right
content
j = wrap[0];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace remove
d by IE
if ( !support.leadingWhitespace && rleadi
ngWhitespace.test( elem ) ) {
nodes.push( context.createTextNod
e( rleadingWhitespace.exec( elem )[0] ) );
}
// Remove IE's autoinserted <tbody> from
table fragments
if ( !support.tbody ) {
// String was a <table>, *may* ha
ve spurious <tbody>
elem = tag === "table" && !rtbody
.test( elem ) ?
tmp.firstChild :
// String was a bare <the
ad> or <tfoot>
wrap[1] === "<table>" &&
!rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.lengt
h;
while ( j-- ) {
if ( jQuery.nodeName( (tb
ody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild(
tbody );
}
}
}
jQuery.merge( nodes, tmp.childNodes );
// Fix #12392 for WebKit and IE > 9
tmp.textContent = "";
// Fix #12392 for oldIE
while ( tmp.firstChild ) {
tmp.removeChild( tmp.firstChild )
;
}
// Remember the top-level container for p
roper cleanup
tmp = safe.lastChild;
}
}
}
// Fix #11356: Clear elements from fragment
if ( tmp ) {
safe.removeChild( tmp );
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !support.appendChecked ) {
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked
);
}
i = 0;
while ( (elem = nodes[ i++ ]) ) {
// #4087 - If origin and destination elements are the sam
e, and this is
// that element, do not do anything
if ( selection && jQuery.inArray( elem, selection ) !== -
1 ) {
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( safe.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( (elem = tmp[ j++ ]) ) {
if ( rscriptType.test( elem.type || "" )
) {
scripts.push( elem );
}
}
}
}
tmp = null;
return safe;
},
cleanData: function( elems, /* internal */ acceptData ) {
var elem, type, id, data, var elem, type, id, data,
i = 0, i = 0,
internalKey = jQuery.expando, internalKey = jQuery.expando,
cache = jQuery.cache, cache = jQuery.cache,
deleteExpando = support.deleteExpando, attributes = support.attributes,
special = jQuery.event.special; special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) { for ( ; ( elem = elems[ i ] ) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) { if ( forceAcceptData || acceptData( elem ) ) {
id = elem[ internalKey ]; id = elem[ internalKey ];
data = id && cache[ id ]; data = id && cache[ id ];
if ( data ) { if ( data ) {
if ( data.events ) { if ( data.events ) {
for ( type in data.events ) { for ( type in data.events ) {
if ( special[ type ] ) { if ( special[ type ] ) {
jQuery.event.remo ve( elem, type ); jQuery.event.remo ve( elem, type );
skipping to change at line 5667 skipping to change at line 6183
jQuery.removeEven t( elem, type, data.handle ); jQuery.removeEven t( elem, type, data.handle );
} }
} }
} }
// Remove cache only if it was not alread y removed by jQuery.event.remove // Remove cache only if it was not alread y removed by jQuery.event.remove
if ( cache[ id ] ) { if ( cache[ id ] ) {
delete cache[ id ]; delete cache[ id ];
// IE does not allow us to delete // Support: IE<9
expando properties from nodes, // IE does not allow us to delete
// nor does it have a removeAttri expando properties from nodes
bute function on Document nodes; // IE creates expando attributes
// we must handle all of these ca along with the property
ses // IE does not have a removeAttri
if ( deleteExpando ) { bute function on Document nodes
delete elem[ internalKey if ( !attributes && typeof elem.r
]; emoveAttribute !== "undefined" ) {
} else if ( typeof elem.removeAtt
ribute !== strundefined ) {
elem.removeAttribute( int ernalKey ); elem.removeAttribute( int ernalKey );
// Webkit & Blink performance suf
fers when deleting properties
// from DOM nodes, so set to unde
fined instead
// https://code.google.com/p/chro
mium/issues/detail?id=378607
} else { } else {
elem[ internalKey ] = nul l; elem[ internalKey ] = und efined;
} }
deletedIds.push( id ); deletedIds.push( id );
} }
} }
} }
} }
} }
}); } );
jQuery.fn.extend( {
// Keep domManip exposed until 3.0 (gh-2225)
domManip: domManip,
detach: function( selector ) {
return remove( this, selector, true );
},
remove: function( selector ) {
return remove( this, selector );
},
jQuery.fn.extend({
text: function( value ) { text: function( value ) {
return access( this, function( value ) { return access( this, function( value ) {
return value === undefined ? return value === undefined ?
jQuery.text( this ) : jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDo this.empty().append(
cument || document ).createTextNode( value ) ); ( this[ 0 ] && this[ 0 ].ownerDocument ||
document ).createTextNode( value )
);
}, null, value, arguments.length ); }, null, value, arguments.length );
}, },
append: function() { append: function() {
return this.domManip( arguments, function( elem ) { return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this. nodeType === 9 ) { if ( this.nodeType === 1 || this.nodeType === 11 || this. nodeType === 9 ) {
var target = manipulationTarget( this, elem ); var target = manipulationTarget( this, elem );
target.appendChild( elem ); target.appendChild( elem );
} }
}); } );
}, },
prepend: function() { prepend: function() {
return this.domManip( arguments, function( elem ) { return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this. nodeType === 9 ) { if ( this.nodeType === 1 || this.nodeType === 11 || this. nodeType === 9 ) {
var target = manipulationTarget( this, elem ); var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild ); target.insertBefore( elem, target.firstChild );
} }
}); } );
}, },
before: function() { before: function() {
return this.domManip( arguments, function( elem ) { return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) { if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this ); this.parentNode.insertBefore( elem, this );
} }
}); } );
}, },
after: function() { after: function() {
return this.domManip( arguments, function( elem ) { return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) { if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibl ing ); this.parentNode.insertBefore( elem, this.nextSibl ing );
} }
}); } );
},
remove: function( selector, keepData /* Internal Use Only */ ) {
var elem,
elems = selector ? jQuery.filter( selector, this ) : this
,
i = 0;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
}
if ( elem.parentNode ) {
if ( keepData && jQuery.contains( elem.ownerDocum
ent, elem ) ) {
setGlobalEval( getAll( elem, "script" ) )
;
}
elem.parentNode.removeChild( elem );
}
}
return this;
}, },
empty: function() { empty: function() {
var elem, var elem,
i = 0; i = 0;
for ( ; (elem = this[i]) != null; i++ ) { for ( ; ( elem = this[ i ] ) != null; i++ ) {
// Remove element nodes and prevent memory leaks // Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) ); jQuery.cleanData( getAll( elem, false ) );
} }
// Remove any remaining nodes // Remove any remaining nodes
while ( elem.firstChild ) { while ( elem.firstChild ) {
elem.removeChild( elem.firstChild ); elem.removeChild( elem.firstChild );
} }
skipping to change at line 5782 skipping to change at line 6292
} }
} }
return this; return this;
}, },
clone: function( dataAndEvents, deepDataAndEvents ) { clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents; dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : d eepDataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : d eepDataAndEvents;
return this.map(function() { return this.map( function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEven ts ); return jQuery.clone( this, dataAndEvents, deepDataAndEven ts );
}); } );
}, },
html: function( value ) { html: function( value ) {
return access( this, function( value ) { return access( this, function( value ) {
var elem = this[ 0 ] || {}, var elem = this[ 0 ] || {},
i = 0, i = 0,
l = this.length; l = this.length;
if ( value === undefined ) { if ( value === undefined ) {
return elem.nodeType === 1 ? return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) : elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined; undefined;
} }
// See if we can take a shortcut and just use innerHTML // See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( val ue ) && if ( typeof value === "string" && !rnoInnerhtml.test( val ue ) &&
( support.htmlSerialize || !rnoshimcache.test( va lue ) ) && ( support.htmlSerialize || !rnoshimcache.test( va lue ) ) &&
( support.leadingWhitespace || !rleadingWhitespac e.test( value ) ) && ( support.leadingWhitespace || !rleadingWhitespac e.test( value ) ) &&
!wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" ); value = jQuery.htmlPrefilter( value );
try { try {
for (; i < l; i++ ) { for ( ; i < l; i++ ) {
// Remove element nodes and preve nt memory leaks // Remove element nodes and preve nt memory leaks
elem = this[i] || {}; elem = this[ i ] || {};
if ( elem.nodeType === 1 ) { if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) ); jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value; elem.innerHTML = value;
} }
} }
elem = 0; elem = 0;
// If using innerHTML throws an exception, use th e fallback method // If using innerHTML throws an exception, use th e fallback method
} catch(e) {} } catch ( e ) {}
} }
if ( elem ) { if ( elem ) {
this.empty().append( value ); this.empty().append( value );
} }
}, null, value, arguments.length ); }, null, value, arguments.length );
}, },
replaceWith: function() { replaceWith: function() {
var arg = arguments[ 0 ]; var ignored = [];
// Make the changes, replacing each context element with the new
content
this.domManip( arguments, function( elem ) {
arg = this.parentNode;
jQuery.cleanData( getAll( this ) );
if ( arg ) {
arg.replaceChild( elem, this );
}
});
// Force removal if there was no new content (e.g., from empty ar
guments)
return arg && (arg.length || arg.nodeType) ? this : this.remove()
;
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, callback ) { // Make the changes, replacing each non-ignored context element w
ith the new content
return domManip( this, arguments, function( elem ) {
var parent = this.parentNode;
// Flatten any nested arrays if ( jQuery.inArray( this, ignored ) < 0 ) {
args = concat.apply( [], args ); jQuery.cleanData( getAll( this ) );
if ( parent ) {
var first, node, hasScripts, parent.replaceChild( elem, this );
scripts, doc, fragment,
i = 0,
l = this.length,
set = this,
iNoClone = l - 1,
value = args[0],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( val
ue ) ) ) {
return this.each(function( index ) {
var self = set.eq( index );
if ( isFunction ) {
args[0] = value.call( this, index, self.h
tml() );
} }
self.domManip( args, callback );
});
}
if ( l ) {
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDoc
ument, false, this );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
} }
if ( first ) { // Force callback invocation
scripts = jQuery.map( getAll( fragment, "script" }, ignored );
), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item in
stead of the first because it can end up
// being emptied incorrectly in certain situation
s (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true,
true );
// Keep references to cloned scri
pts for later restoration
if ( hasScripts ) {
jQuery.merge( scripts, ge
tAll( node, "script" ) );
}
}
callback.call( this[i], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].owner
Document;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first d
ocument insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type
|| "" ) &&
!jQuery._data( node, "glo
balEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Optional AJAX
dependency, but won't run scripts if not present
if ( jQuery._eval
Url ) {
jQuery._e
valUrl( node.src );
}
} else {
jQuery.globalEval
( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScrip
t, "" ) );
}
}
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
}
}
return this;
} }
}); } );
jQuery.each({ jQuery.each( {
appendTo: "append", appendTo: "append",
prependTo: "prepend", prependTo: "prepend",
insertBefore: "before", insertBefore: "before",
insertAfter: "after", insertAfter: "after",
replaceAll: "replaceWith" replaceAll: "replaceWith"
}, function( name, original ) { }, function( name, original ) {
jQuery.fn[ name ] = function( selector ) { jQuery.fn[ name ] = function( selector ) {
var elems, var elems,
i = 0, i = 0,
ret = [], ret = [],
insert = jQuery( selector ), insert = jQuery( selector ),
last = insert.length - 1; last = insert.length - 1;
for ( ; i <= last; i++ ) { for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone(true); elems = i === last ? this : this.clone( true );
jQuery( insert[i] )[ original ]( elems ); jQuery( insert[ i ] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays , but oldIE needs a .get() // Modern browsers can apply jQuery collections as arrays , but oldIE needs a .get()
push.apply( ret, elems.get() ); push.apply( ret, elems.get() );
} }
return this.pushStack( ret ); return this.pushStack( ret );
}; };
}); } );
var iframe, var iframe,
elemdisplay = {}; elemdisplay = {
// Support: Firefox
// We have to pre-define these values for FF (#10227)
HTML: "block",
BODY: "block"
};
/** /**
* Retrieve the actual display of a element * Retrieve the actual display of a element
* @param {String} name nodeName of the element * @param {String} name nodeName of the element
* @param {Object} doc Document object * @param {Object} doc Document object
*/ */
// Called only from within defaultDisplay // Called only from within defaultDisplay
function actualDisplay( name, doc ) { function actualDisplay( name, doc ) {
var style, var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
// getDefaultComputedStyle might be reliably used only on attache
d element
display = window.getDefaultComputedStyle && ( style = window.getD
efaultComputedStyle( elem[ 0 ] ) ) ?
// Use of this method is a temporary fix (more like optmi display = jQuery.css( elem[ 0 ], "display" );
zation) until something better comes along,
// since it was removed from specification and supported
only in FF
style.display : jQuery.css( elem[ 0 ], "display" );
// We don't have any data stored on the element, // We don't have any data stored on the element,
// so use "detach" method as fast way to get rid of the element // so use "detach" method as fast way to get rid of the element
elem.detach(); elem.detach();
return display; return display;
} }
/** /**
* Try to determine the default display value of an element * Try to determine the default display value of an element
skipping to change at line 6008 skipping to change at line 6428
var doc = document, var doc = document,
display = elemdisplay[ nodeName ]; display = elemdisplay[ nodeName ];
if ( !display ) { if ( !display ) {
display = actualDisplay( nodeName, doc ); display = actualDisplay( nodeName, doc );
// If the simple way fails, read from inside an iframe // If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) { if ( display === "none" || !display ) {
// Use the already-created iframe if possible // Use the already-created iframe if possible
iframe = (iframe || jQuery( "<iframe frameborder='0' widt iframe = ( iframe || jQuery( "<iframe frameborder='0' wid
h='0' height='0'/>" )).appendTo( doc.documentElement ); th='0' height='0'/>" ) )
.appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentD ocument ).document; doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentD ocument ).document;
// Support: IE // Support: IE
doc.write(); doc.write();
doc.close(); doc.close();
display = actualDisplay( nodeName, doc ); display = actualDisplay( nodeName, doc );
iframe.detach(); iframe.detach();
} }
// Store the correct default display // Store the correct default display
elemdisplay[ nodeName ] = display; elemdisplay[ nodeName ] = display;
} }
return display; return display;
} }
var rmargin = ( /^margin/ );
(function() { var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
var shrinkWrapBlocksVal;
support.shrinkWrapBlocks = function() { var swap = function( elem, options, callback, args ) {
if ( shrinkWrapBlocksVal != null ) { var ret, name,
return shrinkWrapBlocksVal; old = {};
}
// Will be changed later if needed. // Remember the old values, and insert the new ones
shrinkWrapBlocksVal = false; for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
// Minified: var b,c,d ret = callback.apply( elem, args || [] );
var div, body, container;
body = document.getElementsByTagName( "body" )[ 0 ]; // Revert the old values
if ( !body || !body.style ) { for ( name in options ) {
// Test fired too early or in an unsupported environment, elem.style[ name ] = old[ name ];
exit. }
return;
return ret;
};
var documentElement = document.documentElement;
( function() {
var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginL
eftVal,
container = document.createElement( "div" ),
div = document.createElement( "div" );
// Finish early in limited (non-browser) environments
if ( !div.style ) {
return;
}
div.style.cssText = "float:left;opacity:.5";
// Support: IE<9
// Make sure that element opacity exists (as opposed to filter)
support.opacity = div.style.opacity === "0.5";
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!div.style.cssFloat;
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container = document.createElement( "div" );
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px
;" +
"padding:0;margin-top:1px;position:absolute";
div.innerHTML = "";
container.appendChild( div );
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing
=== "" ||
div.style.WebkitBoxSizing === "";
jQuery.extend( support, {
reliableHiddenOffsets: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableHiddenOffsetsVal;
},
boxSizingReliable: function() {
// We're checking for pixelPositionVal here instead of bo
xSizingReliableVal
// since that compresses better and they're computed toge
ther anyway.
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return boxSizingReliableVal;
},
pixelMarginRight: function() {
// Support: Android 4.0-4.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelMarginRightVal;
},
pixelPosition: function() {
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return pixelPositionVal;
},
reliableMarginRight: function() {
// Support: Android 2.3
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginRightVal;
},
reliableMarginLeft: function() {
// Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox
<=3 - 37
if ( pixelPositionVal == null ) {
computeStyleTests();
}
return reliableMarginLeftVal;
} }
} );
function computeStyleTests() {
var contents, divStyle,
documentElement = document.documentElement;
// Setup // Setup
div = document.createElement( "div" ); documentElement.appendChild( container );
container = document.createElement( "div" );
container.style.cssText = "position:absolute;border:0;width:0;hei
ght:0;top:0;left:-9999px";
body.appendChild( container ).appendChild( div );
// Support: IE6 div.style.cssText =
// Check if elements with layout shrink-wrap their children
if ( typeof div.style.zoom !== strundefined ) { // Support: Android 2.3
// Reset CSS: box-sizing; display; margin; border // Vendor-prefix box-sizing
div.style.cssText = "-webkit-box-sizing:border-box;box-sizing:border-box;" +
// Support: Firefox<29, Android 2.3 "position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
// Support: IE<9
// Assume reasonable values in the absence of getComputedStyle
pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal =
false;
pixelMarginRightVal = reliableMarginRightVal = true;
// Check for getComputedStyle so that this code is not run in IE<
9.
if ( window.getComputedStyle ) {
divStyle = window.getComputedStyle( div );
pixelPositionVal = ( divStyle || {} ).top !== "1%";
reliableMarginLeftVal = ( divStyle || {} ).marginLeft ===
"2px";
boxSizingReliableVal = ( divStyle || { width: "4px" } ).w
idth === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even tho
ugh they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = ( divStyle || { marginRight: "4px"
} ).marginRight === "4px";
// Support: Android 2.3 only
// Div with explicit width and no margin-right incorrectl
y
// gets computed margin-right based on width of container
(#3333)
// WebKit Bug 13343 - getComputedStyle returns wrong valu
e for margin-right
contents = div.appendChild( document.createElement( "div"
) );
// Reset CSS: box-sizing; display; margin; border; paddin
g
contents.style.cssText = div.style.cssText =
// Support: Android 2.3
// Vendor-prefix box-sizing // Vendor-prefix box-sizing
"-webkit-box-sizing:content-box;-moz-box-sizing:c ontent-box;" + "-webkit-box-sizing:content-box;-moz-box-sizing:c ontent-box;" +
"box-sizing:content-box;display:block;margin:0;bo "box-sizing:content-box;display:block;margin:0;bo
rder:0;" + rder:0;padding:0";
"padding:1px;width:1px;zoom:1"; contents.style.marginRight = contents.style.width = "0";
div.appendChild( document.createElement( "div" ) ).style. div.style.width = "1px";
width = "5px";
shrinkWrapBlocksVal = div.offsetWidth !== 3;
}
body.removeChild( container ); reliableMarginRightVal =
!parseFloat( ( window.getComputedStyle( contents
) || {} ).marginRight );
return shrinkWrapBlocksVal; div.removeChild( contents );
}; }
})(); // Support: IE6-8
var rmargin = (/^margin/); // First check that getClientRects works as expected
// Check if table cells still have offsetWidth/Height when they a
re 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 elem
ent is
// hidden; don safety goggles and see bug #4512 for more informat
ion).
div.style.display = "none";
reliableHiddenOffsetsVal = div.getClientRects().length === 0;
if ( reliableHiddenOffsetsVal ) {
div.style.display = "";
div.innerHTML = "<table><tr><td></td><td>t</td></tr></tab
le>";
div.childNodes[ 0 ].style.borderCollapse = "separate";
contents = div.getElementsByTagName( "td" );
contents[ 0 ].style.cssText = "margin:0;border:0;padding:
0;display:none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight ===
0;
if ( reliableHiddenOffsetsVal ) {
contents[ 0 ].style.display = "";
contents[ 1 ].style.display = "none";
reliableHiddenOffsetsVal = contents[ 0 ].offsetHe
ight === 0;
}
}
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); // Teardown
documentElement.removeChild( container );
}
} )();
var getStyles, curCSS, var getStyles, curCSS,
rposition = /^(top|right|bottom|left)$/; rposition = /^(top|right|bottom|left)$/;
if ( window.getComputedStyle ) { if ( window.getComputedStyle ) {
getStyles = function( elem ) { getStyles = function( elem ) {
return elem.ownerDocument.defaultView.getComputedStyle( elem, nul
l ); // Support: IE<=11+, Firefox<=30+ (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.get
ComputedStyle"
var view = elem.ownerDocument.defaultView;
if ( !view || !view.opener ) {
view = window;
}
return view.getComputedStyle( elem );
}; };
curCSS = function( elem, name, computed ) { curCSS = function( elem, name, computed ) {
var width, minWidth, maxWidth, ret, var width, minWidth, maxWidth, ret,
style = elem.style; style = elem.style;
computed = computed || getStyles( elem ); computed = computed || getStyles( elem );
// getPropertyValue is only needed for .css('filter') in IE9, see #12537 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed ? computed.getPropertyValue( name ) || computed[ n ame ] : undefined; ret = computed ? computed.getPropertyValue( name ) || computed[ n ame ] : undefined;
if ( computed ) { // Support: Opera 12.1x only
// Fall back to style even without computed
// computed is undefined for elems on document fragments
if ( ( ret === "" || ret === undefined ) && !jQuery.contains( ele
m.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
if ( ret === "" && !jQuery.contains( elem.ownerDocument, if ( computed ) {
elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards" // A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" inste // Chrome < 17 and Safari 5.0 uses "computed value"
ad of "used value" for margin-right // instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a large // Safari 5.1.7 (at least) returns percentage for a large
r set of values, but width seems to be reliably pixels r set of values,
// this is against the CSSOM draft spec: http://dev.w3.or // but width seems to be reliably pixels
g/csswg/cssom/#resolved-values // this is against the CSSOM draft spec:
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { // http://dev.w3.org/csswg/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret )
&& rmargin.test( name ) ) {
// Remember the original values // Remember the original values
width = style.width; width = style.width;
minWidth = style.minWidth; minWidth = style.minWidth;
maxWidth = style.maxWidth; maxWidth = style.maxWidth;
// Put in the new values to get a computed value out // Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = r et; style.minWidth = style.maxWidth = style.width = r et;
ret = computed.width; ret = computed.width;
skipping to change at line 6129 skipping to change at line 6715
style.maxWidth = maxWidth; style.maxWidth = maxWidth;
} }
} }
// Support: IE // Support: IE
// IE returns zIndex value as an integer. // IE returns zIndex value as an integer.
return ret === undefined ? return ret === undefined ?
ret : ret :
ret + ""; ret + "";
}; };
} else if ( document.documentElement.currentStyle ) { } else if ( documentElement.currentStyle ) {
getStyles = function( elem ) { getStyles = function( elem ) {
return elem.currentStyle; return elem.currentStyle;
}; };
curCSS = function( elem, name, computed ) { curCSS = function( elem, name, computed ) {
var left, rs, rsLeft, ret, var left, rs, rsLeft, ret,
style = elem.style; style = elem.style;
computed = computed || getStyles( elem ); computed = computed || getStyles( elem );
ret = computed ? computed[ name ] : undefined; ret = computed ? computed[ name ] : undefined;
skipping to change at line 6152 skipping to change at line 6738
// so we don't default to auto // so we don't default to auto
if ( ret == null && style && style[ name ] ) { if ( ret == null && style && style[ name ] ) {
ret = style[ name ]; ret = style[ name ];
} }
// From the awesome hack by Dean Edwards // From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022 91 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-1022 91
// If we're not dealing with a regular pixel number // If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels // but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to // but not position css attributes, as those are
the parent element instead // proportional to the parent element instead
// and we can't measure the parent instead because it might trigg // and we can't measure the parent instead because it
er a "stacking dolls" problem // might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values // Remember the original values
left = style.left; left = style.left;
rs = elem.runtimeStyle; rs = elem.runtimeStyle;
rsLeft = rs && rs.left; rsLeft = rs && rs.left;
// Put in the new values to get a computed value out // Put in the new values to get a computed value out
if ( rsLeft ) { if ( rsLeft ) {
rs.left = elem.currentStyle.left; rs.left = elem.currentStyle.left;
skipping to change at line 6184 skipping to change at line 6772
// Support: IE // Support: IE
// IE returns zIndex value as an integer. // IE returns zIndex value as an integer.
return ret === undefined ? return ret === undefined ?
ret : ret :
ret + "" || "auto"; ret + "" || "auto";
}; };
} }
function addGetHookIf( conditionFn, hookFn ) { function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed. // Define the hook, we'll check on the first run if it's really needed.
return { return {
get: function() { get: function() {
var condition = conditionFn(); if ( conditionFn() ) {
if ( condition == null ) {
// The test was not ready at this point; screw th
e hook this time
// but check again when needed next time.
return;
}
if ( condition ) { // Hook not needed (or it's not possible to use i
// Hook not needed (or it's not possible to use i t due
t due to missing dependency), // to missing dependency), remove it.
// remove it.
// Since there are no other hooks for marginRight
, remove the whole object.
delete this.get; delete this.get;
return; return;
} }
// Hook needed; redefine it so that the support test is n ot executed again. // Hook needed; redefine it so that the support test is n ot executed again.
return ( this.get = hookFn ).apply( this, arguments );
return (this.get = hookFn).apply( this, arguments );
} }
}; };
} }
(function() {
// Minified: var b,c,d,e,f,g, h,i
var div, style, a, pixelPositionVal, boxSizingReliableVal,
reliableHiddenOffsetsVal, reliableMarginRightVal;
// Setup
div = document.createElement( "div" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='c
heckbox'/>";
a = div.getElementsByTagName( "a" )[ 0 ];
style = a && a.style;
// Finish early in limited (non-browser) environments
if ( !style ) {
return;
}
style.cssText = "float:left;opacity:.5";
// Support: IE<9
// Make sure that element opacity exists (as opposed to filter)
support.opacity = style.opacity === "0.5";
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
support.cssFloat = !!style.cssFloat;
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Support: Firefox<29, Android 2.3
// Vendor-prefix box-sizing
support.boxSizing = style.boxSizing === "" || style.MozBoxSizing === "" |
|
style.WebkitBoxSizing === "";