aboutsummaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
Diffstat (limited to 'test/data')
-rw-r--r--test/data/jquery-1.9.1.js1852
-rw-r--r--test/data/readywaitloader.js12
-rw-r--r--test/data/testinit.js41
-rw-r--r--test/data/testrunner.js27
4 files changed, 1113 insertions, 819 deletions
diff --git a/test/data/jquery-1.9.1.js b/test/data/jquery-1.9.1.js
index e2c203fe9..80c97a226 100644
--- a/test/data/jquery-1.9.1.js
+++ b/test/data/jquery-1.9.1.js
@@ -11,7 +11,7 @@
*
* Date: 2013-2-4
*/
-(function( window, undefined ) {
+( function( window, undefined ) {
// Can't do this because several apps including ASP.NET trace
// the stack via arguments.caller.callee and Firefox dies if
@@ -19,6 +19,7 @@
// Support: Firefox 18+
//"use strict";
var
+
// The deferred used on DOM ready
readyList,
@@ -58,6 +59,7 @@ var
// Define a local copy of jQuery
jQuery = function( selector, context ) {
+
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
@@ -103,6 +105,7 @@ var
jQuery.ready();
}
},
+
// Clean-up method for dom ready events
detach = function() {
if ( document.addEventListener ) {
@@ -116,6 +119,7 @@ var
};
jQuery.fn = jQuery.prototype = {
+
// The current version of jQuery being used
jquery: core_version,
@@ -130,7 +134,8 @@ jQuery.fn = jQuery.prototype = {
// Handle HTML strings
if ( typeof selector === "string" ) {
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ if ( selector.charAt( 0 ) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
@@ -139,22 +144,23 @@ jQuery.fn = jQuery.prototype = {
}
// Match html or make sure no context is specified for #id
- if ( match && (match[1] || !context) ) {
+ if ( match && ( match[ 1 ] || !context ) ) {
// HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
+ if ( match[ 1 ] ) {
+ context = context instanceof jQuery ? context[ 0 ] : context;
// scripts is true for back-compat
jQuery.merge( this, jQuery.parseHTML(
- match[1],
+ match[ 1 ],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
- if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
+
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
@@ -170,20 +176,21 @@ jQuery.fn = jQuery.prototype = {
// HANDLE: $(#id)
} else {
- elem = document.getElementById( match[2] );
+ elem = document.getElementById( match[ 2 ] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
+
// Handle the case where IE and Opera return items
// by name instead of ID
- if ( elem.id !== match[2] ) {
+ if ( elem.id !== match[ 2 ] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
- this[0] = elem;
+ this[ 0 ] = elem;
}
this.context = document;
@@ -203,7 +210,7 @@ jQuery.fn = jQuery.prototype = {
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
- this.context = this[0] = selector;
+ this.context = this[ 0 ] = selector;
this.length = 1;
return this;
@@ -271,6 +278,7 @@ jQuery.fn = jQuery.prototype = {
},
ready: function( fn ) {
+
// Add the callback
jQuery.ready.promise().done( fn );
@@ -292,17 +300,17 @@ jQuery.fn = jQuery.prototype = {
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
- return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
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 );
- }));
+ } ) );
},
end: function() {
- return this.prevObject || this.constructor(null);
+ return this.prevObject || this.constructor( null );
},
// For internal use only.
@@ -317,7 +325,7 @@ jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var src, copyIsArray, copy, name, options, clone,
- target = arguments[0] || {},
+ target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
@@ -325,13 +333,14 @@ jQuery.extend = jQuery.fn.extend = function() {
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
- target = arguments[1] || {};
+ target = arguments[ 1 ] || {};
+
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {};
}
@@ -342,8 +351,10 @@ jQuery.extend = jQuery.fn.extend = function() {
}
for ( ; i < length; i++ ) {
+
// Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
+ if ( ( options = arguments[ i ] ) != null ) {
+
// Extend the base object
for ( name in options ) {
src = target[ name ];
@@ -355,13 +366,13 @@ jQuery.extend = jQuery.fn.extend = function() {
}
// Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( deep && copy && ( jQuery.isPlainObject( copy ) || ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
+ clone = src && jQuery.isArray( src ) ? src : [];
} else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
+ clone = src && jQuery.isPlainObject( src ) ? src : {};
}
// Never move original objects, clone them
@@ -379,7 +390,7 @@ jQuery.extend = jQuery.fn.extend = function() {
return target;
};
-jQuery.extend({
+jQuery.extend( {
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
@@ -434,7 +445,7 @@ jQuery.extend({
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger("ready").off("ready");
+ jQuery( document ).trigger( "ready" ).off( "ready" );
}
},
@@ -442,11 +453,11 @@ jQuery.extend({
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
+ return jQuery.type( obj ) === "function";
},
isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
+ return jQuery.type( obj ) === "array";
},
isWindow: function( obj ) {
@@ -454,7 +465,7 @@ jQuery.extend({
},
isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ return !isNaN( parseFloat( obj ) ) && isFinite( obj );
},
type: function( obj ) {
@@ -462,26 +473,29 @@ jQuery.extend({
return String( obj );
}
return typeof obj === "object" || typeof obj === "function" ?
- class2type[ core_toString.call(obj) ] || "object" :
+ class2type[ core_toString.call( obj ) ] || "object" :
typeof obj;
},
isPlainObject: function( obj ) {
+
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
+
// Not own constructor property must be Object
if ( obj.constructor &&
- !core_hasOwn.call(obj, "constructor") &&
- !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ !core_hasOwn.call( obj, "constructor" ) &&
+ !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
} catch ( e ) {
+
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
@@ -525,7 +539,7 @@ jQuery.extend({
// Single tag
if ( parsed ) {
- return [ context.createElement( parsed[1] ) ];
+ return [ context.createElement( parsed[ 1 ] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts );
@@ -536,6 +550,7 @@ jQuery.extend({
},
parseJSON: function( data ) {
+
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
@@ -551,11 +566,12 @@ jQuery.extend({
data = jQuery.trim( data );
if ( data ) {
+
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
+ .replace( rvalidbraces, "" ) ) ) {
return ( new Function( "return " + data ) )();
}
@@ -574,13 +590,13 @@ jQuery.extend({
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
+ xml = tmp.parseFromString( data, "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
- } catch( e ) {
+ } catch ( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
@@ -596,6 +612,7 @@ jQuery.extend({
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && jQuery.trim( data ) ) {
+
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
@@ -666,7 +683,7 @@ jQuery.extend({
},
// Use native String.trim function wherever possible
- trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ trim: core_trim && !core_trim.call( "\uFEFF\xA0" ) ?
function( text ) {
return text == null ?
"" :
@@ -685,7 +702,7 @@ jQuery.extend({
var ret = results || [];
if ( arr != null ) {
- if ( isArraylike( Object(arr) ) ) {
+ if ( isArraylike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
@@ -710,6 +727,7 @@ jQuery.extend({
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
+
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
@@ -730,7 +748,7 @@ jQuery.extend({
first[ i++ ] = second[ j ];
}
} else {
- while ( second[j] !== undefined ) {
+ while ( second[ j ] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
@@ -835,7 +853,7 @@ jQuery.extend({
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
- jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ jQuery.access( elems, fn, i, key[ i ], true, emptyGet, raw );
}
// Sets one value
@@ -847,6 +865,7 @@ jQuery.extend({
}
if ( bulk ) {
+
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
@@ -863,7 +882,7 @@ jQuery.extend({
if ( fn ) {
for ( ; i < length; i++ ) {
- fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ fn( elems[ i ], key, raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) );
}
}
}
@@ -874,13 +893,13 @@ jQuery.extend({
// Gets
bulk ?
fn.call( elems ) :
- length ? fn( elems[0], key ) : emptyGet;
+ length ? fn( elems[ 0 ], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
-});
+} );
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
@@ -891,11 +910,13 @@ jQuery.ready.promise = function( obj ) {
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
+
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
+
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed, false );
@@ -904,6 +925,7 @@ jQuery.ready.promise = function( obj ) {
// If IE event model is used
} else {
+
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", completed );
@@ -916,17 +938,18 @@ jQuery.ready.promise = function( obj ) {
try {
top = window.frameElement == null && document.documentElement;
- } catch(e) {}
+ } catch ( e ) {}
if ( top && top.doScroll ) {
- (function doScrollCheck() {
+ ( function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
+
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
- top.doScroll("left");
- } catch(e) {
+ top.doScroll( "left" );
+ } catch ( e ) {
return setTimeout( doScrollCheck, 50 );
}
@@ -936,7 +959,7 @@ jQuery.ready.promise = function( obj ) {
// and execute any waiting functions
jQuery.ready();
}
- })();
+ } )();
}
}
}
@@ -944,9 +967,9 @@ jQuery.ready.promise = function( obj ) {
};
// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+jQuery.each( "Boolean Number String Function Array Date RegExp Object Error".split( " " ), function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
+} );
function isArraylike( obj ) {
var length = obj.length,
@@ -966,7 +989,8 @@ function isArraylike( obj ) {
}
// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
+rootjQuery = jQuery( document );
+
// String to Object options format cache
var optionsCache = {};
@@ -975,7 +999,7 @@ function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
object[ flag ] = true;
- });
+ } );
return object;
}
@@ -1011,20 +1035,28 @@ jQuery.Callbacks = function( options ) {
var // Flag to know if list is currently firing
firing,
+
// Last fire value (for non-forgettable lists)
memory,
+
// Flag to know if list was already fired
fired,
+
// End of the loop when firing
firingLength,
+
// Index of currently firing callback (modified by remove if needed)
firingIndex,
+
// First callback to fire (used internally by add and fireWith)
firingStart,
+
// Actual callback list
list = [],
+
// Stack of fire calls for repeatable lists
stack = !options.once && [],
+
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
@@ -1052,14 +1084,17 @@ jQuery.Callbacks = function( options ) {
}
}
},
+
// Actual Callbacks object
self = {
+
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
+
// First, we save the current length
var start = list.length;
- (function add( args ) {
+ ( function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
@@ -1067,15 +1102,18 @@ jQuery.Callbacks = function( options ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
+
// Inspect recursively
add( arg );
}
- });
- })( arguments );
+ } );
+ } )( arguments );
+
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
+
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
@@ -1085,13 +1123,15 @@ jQuery.Callbacks = function( options ) {
}
return this;
},
+
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
- while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
+
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
@@ -1102,29 +1142,34 @@ jQuery.Callbacks = function( options ) {
}
}
}
- });
+ } );
}
return this;
},
+
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
},
+
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
+
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
+
// Is it disabled?
disabled: function() {
return !list;
},
+
// Lock the list in its current state
lock: function() {
stack = undefined;
@@ -1133,10 +1178,12 @@ jQuery.Callbacks = function( options ) {
}
return this;
},
+
// Is it locked?
locked: function() {
return !stack;
},
+
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
@@ -1150,11 +1197,13 @@ jQuery.Callbacks = function( options ) {
}
return this;
},
+
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
+
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
@@ -1163,14 +1212,15 @@ jQuery.Callbacks = function( options ) {
return self;
};
-jQuery.extend({
+jQuery.extend( {
Deferred: function( func ) {
var tuples = [
+
// action, add listener, listener list, final state
- [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
- [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
- [ "notify", "progress", jQuery.Callbacks("memory") ]
+ [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks( "memory" ) ]
],
state = "pending",
promise = {
@@ -1183,12 +1233,13 @@ jQuery.extend({
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
- return jQuery.Deferred(function( newDefer ) {
+ return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+
// deferred[ done | fail | progress ] for forwarding actions to newDefer
- deferred[ tuple[1] ](function() {
+ deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
@@ -1198,11 +1249,12 @@ jQuery.extend({
} else {
newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
}
- });
- });
+ } );
+ } );
fns = null;
- }).promise();
+ } ).promise();
},
+
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
@@ -1220,11 +1272,12 @@ jQuery.extend({
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
- promise[ tuple[1] ] = list.add;
+ promise[ tuple[ 1 ] ] = list.add;
// Handle state
if ( stateString ) {
- list.add(function() {
+ list.add( function() {
+
// state = [ resolved | rejected ]
state = stateString;
@@ -1233,12 +1286,12 @@ jQuery.extend({
}
// deferred[ resolve | reject | notify ]
- deferred[ tuple[0] ] = function() {
- deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ deferred[ tuple[ 0 ] ] = function() {
+ deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments );
return this;
};
- deferred[ tuple[0] + "With" ] = list.fireWith;
- });
+ deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
+ } );
// Make the deferred a promise
promise.promise( deferred );
@@ -1269,7 +1322,7 @@ jQuery.extend({
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
- if( values === progressValues ) {
+ if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
@@ -1303,32 +1356,33 @@ jQuery.extend({
return deferred.promise();
}
-});
-jQuery.support = (function() {
+} );
+jQuery.support = ( function() {
var support, all, a,
input, select, fragment,
opt, eventName, isSupported, i,
- div = document.createElement("div");
+ div = document.createElement( "div" );
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
- all = div.getElementsByTagName("*");
- a = div.getElementsByTagName("a")[ 0 ];
+ all = div.getElementsByTagName( "*" );
+ a = div.getElementsByTagName( "a" )[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
- select = document.createElement("select");
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName("input")[ 0 ];
+ select = document.createElement( "select" );
+ opt = select.appendChild( document.createElement( "option" ) );
+ input = div.getElementsByTagName( "input" )[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
+
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
@@ -1337,19 +1391,19 @@ jQuery.support = (function() {
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
+ tbody: !div.getElementsByTagName( "tbody" ).length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
+ htmlSerialize: !!div.getElementsByTagName( "link" ).length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
+ style: /top/.test( a.getAttribute( "style" ) ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
- hrefNormalized: a.getAttribute("href") === "/a",
+ hrefNormalized: a.getAttribute( "href" ) === "/a",
// Make sure that element opacity exists
// (IE uses filter instead)
@@ -1368,11 +1422,11 @@ jQuery.support = (function() {
optSelected: opt.selected,
// Tests for enctype support on a form (#6743)
- enctype: !!document.createElement("form").enctype,
+ enctype: !!document.createElement( "form" ).enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+ html5Clone: document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: document.compatMode === "CSS1Compat",
@@ -1399,12 +1453,12 @@ jQuery.support = (function() {
// Support: IE<9
try {
delete div.test;
- } catch( e ) {
+ } catch ( e ) {
support.deleteExpando = false;
}
// Check if we can trust getAttribute("value")
- input = document.createElement("input");
+ input = document.createElement( "input" );
input.setAttribute( "value", "" );
support.input = input.getAttribute( "value" ) === "";
@@ -1433,14 +1487,14 @@ jQuery.support = (function() {
if ( div.attachEvent ) {
div.attachEvent( "onclick", function() {
support.noCloneEvent = false;
- });
+ } );
div.cloneNode( true ).click();
}
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
- for ( i in { submit: true, change: true, focusin: true }) {
+ for ( i in { submit: true, change: true, focusin: true } ) {
div.setAttribute( eventName = "on" + i, "t" );
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
@@ -1451,17 +1505,18 @@ jQuery.support = (function() {
support.clearCloneStyle = div.style.backgroundClip === "content-box";
// Run tests that need a body at doc ready
- jQuery(function() {
+ jQuery( function() {
var container, marginDiv, tds,
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
- body = document.getElementsByTagName("body")[0];
+ body = document.getElementsByTagName( "body" )[ 0 ];
if ( !body ) {
+
// Return for frameset docs that don't have a body
return;
}
- container = document.createElement("div");
+ container = document.createElement( "div" );
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
body.appendChild( container ).appendChild( div );
@@ -1474,7 +1529,7 @@ jQuery.support = (function() {
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName("td");
+ tds = div.getElementsByTagName( "td" );
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
@@ -1500,7 +1555,7 @@ jQuery.support = (function() {
// gets computed margin-right based on width of container. (#3333)
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv = div.appendChild( document.createElement( "div" ) );
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
@@ -1510,6 +1565,7 @@ jQuery.support = (function() {
}
if ( typeof div.style.zoom !== core_strundefined ) {
+
// Support: IE<8
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
@@ -1526,6 +1582,7 @@ jQuery.support = (function() {
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
if ( support.inlineBlockNeedsLayout ) {
+
// Prevent IE 6 from affecting layout for positioned elements #11048
// Prevent IE from shrinking the body in IE 7 mode #12869
// Support: IE<8
@@ -1537,18 +1594,18 @@ jQuery.support = (function() {
// Null elements to avoid leaks in IE
container = div = tds = marginDiv = null;
- });
+ } );
// Null elements to avoid leaks in IE
all = select = fragment = opt = a = input = null;
return support;
-})();
+} )();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
-function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
@@ -1571,11 +1628,12 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
- if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) && getByName && data === undefined ) {
return;
}
if ( !id ) {
+
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
@@ -1679,10 +1737,11 @@ function internalRemoveData( elem, name, pvt ) {
if ( name in thisCache ) {
name = [ name ];
} else {
- name = name.split(" ");
+ name = name.split( " " );
}
}
} else {
+
// If "name" is an array of keys...
// When data is initially created, via ("key", "val") signature,
// keys will be converted to camelCase.
@@ -1693,7 +1752,7 @@ function internalRemoveData( elem, name, pvt ) {
}
for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
+ delete thisCache[ name[ i ] ];
}
// If there is no data left in the cache, we want to continue
@@ -1729,7 +1788,7 @@ function internalRemoveData( elem, name, pvt ) {
}
}
-jQuery.extend({
+jQuery.extend( {
cache: {},
// Unique for each copy of jQuery on the page
@@ -1740,13 +1799,14 @@ jQuery.extend({
// attempt to add expando properties to them.
noData: {
"embed": true,
+
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
@@ -1769,6 +1829,7 @@ jQuery.extend({
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
+
// Do not set data on non-element because it will not be cleared (#8335).
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
return false;
@@ -1777,14 +1838,14 @@ jQuery.extend({
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
- return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ return !noData || noData !== true && elem.getAttribute( "classid" ) === noData;
}
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
data: function( key, value ) {
var attrs, name,
- elem = this[0],
+ elem = this[ 0 ],
i = 0,
data = null;
@@ -1796,10 +1857,10 @@ jQuery.fn.extend({
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attrs = elem.attributes;
for ( ; i < attrs.length; i++ ) {
- name = attrs[i].name;
+ name = attrs[ i ].name;
if ( !name.indexOf( "data-" ) ) {
- name = jQuery.camelCase( name.slice(5) );
+ name = jQuery.camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
}
@@ -1813,32 +1874,34 @@ jQuery.fn.extend({
// Sets multiple values
if ( typeof key === "object" ) {
- return this.each(function() {
+ return this.each( function() {
jQuery.data( this, key );
- });
+ } );
}
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
+
// Try to fetch any internally stored data first
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
- this.each(function() {
+ this.each( function() {
jQuery.data( this, key, value );
- });
+ } );
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
- return this.each(function() {
+ return this.each( function() {
jQuery.removeData( this, key );
- });
+ } );
}
-});
+} );
function dataAttr( elem, key, data ) {
+
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
@@ -1852,11 +1915,12 @@ function dataAttr( elem, key, data ) {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
+
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
- } catch( e ) {}
+ } catch ( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
@@ -1875,7 +1939,7 @@ function isEmptyDataObject( obj ) {
for ( name in obj ) {
// 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;
}
if ( name !== "toJSON" ) {
@@ -1885,7 +1949,7 @@ function isEmptyDataObject( obj ) {
return true;
}
-jQuery.extend({
+jQuery.extend( {
queue: function( elem, type, data ) {
var queue;
@@ -1895,8 +1959,8 @@ jQuery.extend({
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
- if ( !queue || jQuery.isArray(data) ) {
- queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ if ( !queue || jQuery.isArray( data ) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
}
@@ -1945,15 +2009,15 @@ jQuery.extend({
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
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, key );
- })
- });
+ } )
+ } );
}
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
queue: function( type, data ) {
var setter = 2;
@@ -1964,27 +2028,28 @@ jQuery.fn.extend({
}
if ( arguments.length < setter ) {
- return jQuery.queue( this[0], type );
+ return jQuery.queue( this[ 0 ], type );
}
return data === undefined ?
this :
- this.each(function() {
+ this.each( function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
- if ( type === "fx" && queue[0] !== "inprogress" ) {
+ if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
- });
+ } );
},
dequeue: function( type ) {
- return this.each(function() {
+ return this.each( function() {
jQuery.dequeue( this, type );
- });
+ } );
},
+
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
@@ -1996,11 +2061,12 @@ jQuery.fn.extend({
hooks.stop = function() {
clearTimeout( timeout );
};
- });
+ } );
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
+
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
@@ -2021,7 +2087,7 @@ jQuery.fn.extend({
}
type = type || "fx";
- while( i-- ) {
+ while ( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
@@ -2031,7 +2097,7 @@ jQuery.fn.extend({
resolve();
return defer.promise( obj );
}
-});
+} );
var nodeHook, boolHook,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
@@ -2042,15 +2108,15 @@ var nodeHook, boolHook,
getSetAttribute = jQuery.support.getSetAttribute,
getSetInput = jQuery.support.input;
-jQuery.fn.extend({
+jQuery.fn.extend( {
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
- return this.each(function() {
+ return this.each( function() {
jQuery.removeAttr( this, name );
- });
+ } );
},
prop: function( name, value ) {
@@ -2059,13 +2125,14 @@ jQuery.fn.extend({
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
- return this.each(function() {
+ return this.each( function() {
+
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
- } catch( e ) {}
- });
+ } catch ( e ) {}
+ } );
},
addClass: function( value ) {
@@ -2075,12 +2142,13 @@ jQuery.fn.extend({
proceed = typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
+ return this.each( function( j ) {
jQuery( this ).addClass( value.call( this, j, this.className ) );
- });
+ } );
}
if ( proceed ) {
+
// The disjunction here is for better compressibility (see removeClass)
classes = ( value || "" ).match( core_rnotwhite ) || [];
@@ -2093,7 +2161,7 @@ jQuery.fn.extend({
if ( cur ) {
j = 0;
- while ( (clazz = classes[j++]) ) {
+ while ( ( clazz = classes[ j++ ] ) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
@@ -2114,15 +2182,16 @@ jQuery.fn.extend({
proceed = arguments.length === 0 || typeof value === "string" && value;
if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
+ return this.each( function( j ) {
jQuery( this ).removeClass( value.call( this, j, this.className ) );
- });
+ } );
}
if ( proceed ) {
classes = ( value || "" ).match( core_rnotwhite ) || [];
for ( ; i < len; i++ ) {
elem = this[ i ];
+
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
@@ -2131,7 +2200,8 @@ jQuery.fn.extend({
if ( cur ) {
j = 0;
- while ( (clazz = classes[j++]) ) {
+ while ( ( clazz = classes[ j++ ] ) ) {
+
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
cur = cur.replace( " " + clazz + " ", " " );
@@ -2150,13 +2220,14 @@ jQuery.fn.extend({
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
+ return this.each( function( i ) {
+ jQuery( this ).toggleClass( value.call( this, i, this.className, stateVal ), stateVal );
+ } );
}
- return this.each(function() {
+ return this.each( function() {
if ( type === "string" ) {
+
// toggle individual class names
var className,
i = 0,
@@ -2164,7 +2235,8 @@ jQuery.fn.extend({
state = stateVal,
classNames = value.match( core_rnotwhite ) || [];
- while ( (className = classNames[ i++ ]) ) {
+ while ( ( className = classNames[ i++ ] ) ) {
+
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
@@ -2173,6 +2245,7 @@ jQuery.fn.extend({
// Toggle whole class name
} else if ( type === core_strundefined || type === "boolean" ) {
if ( this.className ) {
+
// store className if set
jQuery._data( this, "__className__", this.className );
}
@@ -2183,7 +2256,7 @@ jQuery.fn.extend({
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
- });
+ } );
},
hasClass: function( selector ) {
@@ -2191,7 +2264,7 @@ jQuery.fn.extend({
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ if ( this[ i ].nodeType === 1 && ( " " + this[ i ].className + " " ).replace( rclass, " " ).indexOf( className ) >= 0 ) {
return true;
}
}
@@ -2201,21 +2274,23 @@ jQuery.fn.extend({
val: function( value ) {
var ret, hooks, isFunction,
- elem = this[0];
+ elem = this[ 0 ];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, "value" ) ) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
+
// handle most common string cases
- ret.replace(rreturn, "") :
+ ret.replace( rreturn, "" ) :
+
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
@@ -2225,9 +2300,9 @@ jQuery.fn.extend({
isFunction = jQuery.isFunction( value );
- return this.each(function( i ) {
+ return this.each( function( i ) {
var val,
- self = jQuery(this);
+ self = jQuery( this );
if ( this.nodeType !== 1 ) {
return;
@@ -2245,25 +2320,26 @@ jQuery.fn.extend({
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
+ val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
- });
+ } );
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
- });
+ } );
}
-});
+} );
-jQuery.extend({
+jQuery.extend( {
valHooks: {
option: {
get: function( elem ) {
+
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
@@ -2288,8 +2364,9 @@ jQuery.extend({
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
+
// Don't return options that are disabled or in a disabled optgroup
- ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
@@ -2311,9 +2388,9 @@ jQuery.extend({
set: function( elem, value ) {
var values = jQuery.makeArray( value );
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
+ jQuery( elem ).find( "option" ).each( function() {
+ this.selected = jQuery.inArray( jQuery( this ).val(), values ) >= 0;
+ } );
if ( !values.length ) {
elem.selectedIndex = -1;
@@ -2351,7 +2428,7 @@ jQuery.extend({
if ( value === null ) {
jQuery.removeAttr( elem, name );
- } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ } else if ( hooks && notxml && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
} else {
@@ -2359,7 +2436,7 @@ jQuery.extend({
return value;
}
- } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ } else if ( hooks && notxml && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
} else {
@@ -2383,11 +2460,12 @@ jQuery.extend({
attrNames = value && value.match( core_rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
- while ( (name = attrNames[i++]) ) {
+ while ( ( name = attrNames[ i++ ] ) ) {
propName = jQuery.propFix[ name ] || name;
// Boolean attributes get special treatment (#10870)
if ( rboolean.test( name ) ) {
+
// Set corresponding property to false for boolean attributes
// Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
if ( !getSetAttribute && ruseDefault.test( name ) ) {
@@ -2410,7 +2488,8 @@ jQuery.extend({
attrHooks: {
type: {
set: function( elem, value ) {
- if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName( elem, "input" ) ) {
+
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to default in case type is set after value during creation
var val = elem.value;
@@ -2451,13 +2530,14 @@ jQuery.extend({
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
+
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ if ( hooks && "set" in hooks && ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
} else {
@@ -2465,7 +2545,7 @@ jQuery.extend({
}
} else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
} else {
@@ -2477,9 +2557,10 @@ jQuery.extend({
propHooks: {
tabIndex: {
get: function( elem ) {
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
+ var attributeNode = elem.getAttributeNode( "tabindex" );
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
@@ -2489,12 +2570,13 @@ jQuery.extend({
}
}
}
-});
+} );
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
var
+
// Use .prop to determine if this attribute is understood as boolean
prop = jQuery.prop( elem, name ),
@@ -2504,6 +2586,7 @@ boolHook = {
getSetInput && getSetAttribute ?
attr != null :
+
// oldIE fabricates an empty string for missing boolean attributes
// and conflates checked/selected into attroperties
ruseDefault.test( name ) ?
@@ -2519,9 +2602,11 @@ boolHook = {
},
set: function( elem, value, name ) {
if ( value === false ) {
+
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+
// IE<8 needs the *property* name
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
@@ -2548,9 +2633,11 @@ if ( !getSetInput || !getSetAttribute ) {
},
set: function( elem, value, name ) {
if ( jQuery.nodeName( elem, "input" ) ) {
+
// Does not return so that setAttribute is also used
elem.defaultValue = value;
} else {
+
// Use nodeHook if defined (#1954); otherwise setAttribute is fine
return nodeHook && nodeHook.set( elem, value, name );
}
@@ -2571,11 +2658,12 @@ if ( !getSetAttribute ) {
undefined;
},
set: function( elem, value, name ) {
+
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
elem.setAttributeNode(
- (ret = elem.ownerDocument.createAttribute( name ))
+ ( ret = elem.ownerDocument.createAttribute( name ) )
);
}
@@ -2599,7 +2687,7 @@ if ( !getSetAttribute ) {
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.each( [ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
@@ -2607,36 +2695,36 @@ if ( !getSetAttribute ) {
return value;
}
}
- });
- });
+ } );
+ } );
}
-
// Some attributes require a special call on IE
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.each( [ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret == null ? undefined : ret;
}
- });
- });
+ } );
+ } );
// href/src property should get the full normalized URL (#10299/#12915)
- jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.each( [ "href", "src" ], function( i, name ) {
jQuery.propHooks[ name ] = {
get: function( elem ) {
return elem.getAttribute( name, 4 );
}
};
- });
+ } );
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
+
// Return undefined in the case of empty string
// Note: IE uppercases css property names, but if we were to .toLowerCase()
// .cssText, that would destroy case senstitivity in URL's, like in "background"
@@ -2665,7 +2753,7 @@ if ( !jQuery.support.optSelected ) {
}
return null;
}
- });
+ } );
}
// IE6/7 call enctype encoding
@@ -2675,24 +2763,25 @@ if ( !jQuery.support.enctype ) {
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
+
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
+ return elem.getAttribute( "value" ) === null ? "on" : elem.value;
}
};
- });
+ } );
}
-jQuery.each([ "radio", "checkbox" ], function() {
+jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) >= 0 );
}
}
- });
-});
+ } );
+} );
var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
@@ -2739,29 +2828,31 @@ jQuery.event = {
}
// Init the element's event structure and main handler, if this is the first
- if ( !(events = elemData.events) ) {
+ if ( !( events = elemData.events ) ) {
events = elemData.events = {};
}
- if ( !(eventHandle = elemData.handle) ) {
+ if ( !( eventHandle = elemData.handle ) ) {
eventHandle = elemData.handle = function( e ) {
+
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
- return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+ return typeof jQuery !== core_strundefined && ( !e || jQuery.event.triggered !== e.type ) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
+
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
- types = ( types || "" ).match( core_rnotwhite ) || [""];
+ types = ( types || "" ).match( core_rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
- tmp = rtypenamespace.exec( types[t] ) || [];
- type = origType = tmp[1];
- namespaces = ( tmp[2] || "" ).split( "." ).sort();
+ tmp = rtypenamespace.exec( types[ t ] ) || [];
+ type = origType = tmp[ 1 ];
+ namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
@@ -2773,7 +2864,7 @@ jQuery.event = {
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
- handleObj = jQuery.extend({
+ handleObj = jQuery.extend( {
type: type,
origType: origType,
data: data,
@@ -2781,16 +2872,17 @@ jQuery.event = {
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
- namespace: namespaces.join(".")
+ namespace: namespaces.join( "." )
}, handleObjIn );
// Init the event handler queue if we're the first
- if ( !(handlers = events[ type ]) ) {
+ if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
@@ -2832,17 +2924,17 @@ jQuery.event = {
namespaces, origType,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
- if ( !elemData || !(events = elemData.events) ) {
+ if ( !elemData || !( events = elemData.events ) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
- types = ( types || "" ).match( core_rnotwhite ) || [""];
+ types = ( types || "" ).match( core_rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
- tmp = rtypenamespace.exec( types[t] ) || [];
- type = origType = tmp[1];
- namespaces = ( tmp[2] || "" ).split( "." ).sort();
+ tmp = rtypenamespace.exec( types[ t ] ) || [];
+ type = origType = tmp[ 1 ];
+ namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
@@ -2855,7 +2947,7 @@ jQuery.event = {
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
- tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+ tmp = tmp[ 2 ] && new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
@@ -2903,7 +2995,7 @@ jQuery.event = {
bubbleType, special, tmp, i,
eventPath = [ elem || document ],
type = core_hasOwn.call( event, "type" ) ? event.type : event,
- namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
@@ -2917,13 +3009,14 @@ jQuery.event = {
return;
}
- if ( type.indexOf(".") >= 0 ) {
+ if ( type.indexOf( "." ) >= 0 ) {
+
// Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
+ namespaces = type.split( "." );
type = namespaces.shift();
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 event type string
event = event[ jQuery.expando ] ?
@@ -2931,9 +3024,9 @@ jQuery.event = {
new jQuery.Event( type, typeof event === "object" && event );
event.isTrigger = true;
- event.namespace = namespaces.join(".");
+ event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace ?
- new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
@@ -2967,14 +3060,14 @@ jQuery.event = {
}
// 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.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
- while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+ while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
@@ -2997,8 +3090,8 @@ jQuery.event = {
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+ if ( ( !special._default || special._default.apply( elem.ownerDocument, data ) === false ) &&
+ !( type === "click" && jQuery.nodeName( elem, "a" ) ) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
@@ -3017,6 +3110,7 @@ jQuery.event = {
try {
elem[ type ]();
} catch ( e ) {
+
// IE<9 dies on focus/blur to hidden element (#1486,#12518)
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
}
@@ -3044,7 +3138,7 @@ jQuery.event = {
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
+ args[ 0 ] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
@@ -3057,11 +3151,11 @@ jQuery.event = {
// Run delegates first; they may want to stop propagation beneath us
i = 0;
- while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
- while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+ while ( ( handleObj = matched.handlers[ j++ ] ) && !event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
@@ -3070,11 +3164,11 @@ jQuery.event = {
event.handleObj = handleObj;
event.data = handleObj.data;
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
- if ( (event.result = ret) === false ) {
+ if ( ( event.result = ret ) === false ) {
event.preventDefault();
event.stopPropagation();
}
@@ -3100,13 +3194,13 @@ jQuery.event = {
// Find delegate handlers
// Black-hole SVG <use> instance trees (#13180)
// Avoid non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+ if ( delegateCount && cur.nodeType && ( !event.button || event.type !== "click" ) ) {
for ( ; cur != this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
- if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+ if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) {
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
@@ -3124,7 +3218,7 @@ jQuery.event = {
}
}
if ( matches.length ) {
- handlerQueue.push({ elem: cur, handlers: matches });
+ handlerQueue.push( { elem: cur, handlers: matches } );
}
}
}
@@ -3132,7 +3226,7 @@ jQuery.event = {
// Add the remaining (directly-bound) handlers
if ( delegateCount < handlers.length ) {
- handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );
}
return handlerQueue;
@@ -3185,12 +3279,12 @@ jQuery.event = {
},
// Includes some event props shared by KeyEvent and MouseEvent
- props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split( " " ),
fixHooks: {},
keyHooks: {
- props: "char charCode key keyCode".split(" "),
+ props: "char charCode key keyCode".split( " " ),
filter: function( event, original ) {
// Add which for key events
@@ -3203,7 +3297,7 @@ jQuery.event = {
},
mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split( " " ),
filter: function( event, original ) {
var body, eventDoc, doc,
button = original.button,
@@ -3236,10 +3330,12 @@ jQuery.event = {
special: {
load: {
+
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
click: {
+
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
@@ -3249,6 +3345,7 @@ jQuery.event = {
}
},
focus: {
+
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== document.activeElement && this.focus ) {
@@ -3256,6 +3353,7 @@ jQuery.event = {
this.focus();
return false;
} catch ( e ) {
+
// Support: IE<9
// If we error on focus to hidden element (#1486, #12518),
// let .trigger() run the handlers
@@ -3286,6 +3384,7 @@ jQuery.event = {
},
simulate: function( type, elem, event, bubble ) {
+
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
@@ -3330,8 +3429,9 @@ jQuery.removeEvent = document.removeEventListener ?
};
jQuery.Event = function( src, props ) {
+
// Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
+ if ( !( this instanceof jQuery.Event ) ) {
return new jQuery.Event( src, props );
}
@@ -3394,6 +3494,7 @@ jQuery.Event.prototype = {
if ( !e ) {
return;
}
+
// If stopPropagation exists, run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
@@ -3410,7 +3511,7 @@ jQuery.Event.prototype = {
};
// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
+jQuery.each( {
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
@@ -3426,7 +3527,7 @@ jQuery.each({
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
@@ -3434,13 +3535,14 @@ jQuery.each({
return ret;
}
};
-});
+} );
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
+
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
@@ -3448,20 +3550,23 @@ if ( !jQuery.support.submitBubbles ) {
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
- });
+ } );
jQuery._data( form, "submitBubbles", true );
}
- });
+ } );
+
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
+
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
@@ -3472,6 +3577,7 @@ if ( !jQuery.support.submitBubbles ) {
},
teardown: function() {
+
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
@@ -3491,6 +3597,7 @@ if ( !jQuery.support.changeBubbles ) {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
+
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
@@ -3499,17 +3606,19 @@ if ( !jQuery.support.changeBubbles ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
- });
+ } );
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
+
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
- });
+ } );
}
return false;
}
+
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
@@ -3519,17 +3628,17 @@ if ( !jQuery.support.changeBubbles ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
- });
+ } );
jQuery._data( elem, "changeBubbles", true );
}
- });
+ } );
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ if ( this !== elem || event.isSimulated || event.isTrigger || ( elem.type !== "radio" && elem.type !== "checkbox" ) ) {
return event.handleObj.handler.apply( this, arguments );
}
},
@@ -3544,7 +3653,7 @@ if ( !jQuery.support.changeBubbles ) {
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+ jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
@@ -3564,18 +3673,20 @@ if ( !jQuery.support.focusinBubbles ) {
}
}
};
- });
+ } );
}
-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
if ( typeof types === "object" ) {
+
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
+
// ( types-Object, data )
data = data || selector;
selector = undefined;
@@ -3587,15 +3698,18 @@ jQuery.fn.extend({
}
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;
@@ -3611,16 +3725,18 @@ jQuery.fn.extend({
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 ) {
return this.on( types, selector, data, fn, 1 );
@@ -3628,6 +3744,7 @@ jQuery.fn.extend({
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
+
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
@@ -3638,6 +3755,7 @@ jQuery.fn.extend({
return this;
}
if ( typeof types === "object" ) {
+
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
@@ -3645,6 +3763,7 @@ jQuery.fn.extend({
return this;
}
if ( selector === false || typeof selector === "function" ) {
+
// ( types [, fn] )
fn = selector;
selector = undefined;
@@ -3652,9 +3771,9 @@ jQuery.fn.extend({
if ( fn === false ) {
fn = returnFalse;
}
- return this.each(function() {
+ return this.each( function() {
jQuery.event.remove( this, types, fn, selector );
- });
+ } );
},
bind: function( types, data, fn ) {
@@ -3668,29 +3787,30 @@ jQuery.fn.extend({
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
+
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
- return this.each(function() {
+ return this.each( function() {
jQuery.event.trigger( type, data, this );
- });
+ } );
},
triggerHandler: function( type, data ) {
- var elem = this[0];
+ var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
-});
+} );
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
-(function( window, undefined ) {
+( function( window, undefined ) {
var i,
cachedruns,
@@ -3713,7 +3833,7 @@ var i,
sortOrder,
// Instance-specific data
- expando = "sizzle" + -(new Date()),
+ expando = "sizzle" + -( new Date() ),
preferredDoc = window.document,
support = {},
dirruns = 0,
@@ -3731,23 +3851,24 @@ var i,
pop = arr.pop,
push = arr.push,
slice = arr.slice,
+
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
- if ( this[i] === elem ) {
+ if ( this[ i ] === elem ) {
return i;
}
}
return -1;
},
-
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
+
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
@@ -3787,6 +3908,7 @@ var i,
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
@@ -3810,24 +3932,27 @@ var i,
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
funescape = function( _, escaped ) {
var high = "0x" + escaped - 0x10000;
+
// NaN means non-codepoint
return high !== high ?
escaped :
+
// BMP codepoint
high < 0 ?
String.fromCharCode( high + 0x10000 ) :
+
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Use a stripped-down slice if we can't use a native one
try {
- slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
+ slice.call( preferredDoc.documentElement.childNodes, 0 )[ 0 ].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
- while ( (elem = this[i++]) ) {
+ while ( ( elem = this[ i++ ] ) ) {
results.push( elem );
}
return results;
@@ -3852,14 +3977,16 @@ function createCache() {
var cache,
keys = [];
- return (cache = function( key, value ) {
+ return ( cache = function( key, value ) {
+
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key += " " ) > Expr.cacheLength ) {
+
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
- return (cache[ key ] = value);
- });
+ return ( cache[ key ] = value );
+ } );
}
/**
@@ -3876,13 +4003,14 @@ function markFunction( fn ) {
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
- var div = document.createElement("div");
+ var div = document.createElement( "div" );
try {
return fn( div );
- } catch (e) {
+ } catch ( e ) {
return false;
} finally {
+
// release memory in IE
div = null;
}
@@ -3890,6 +4018,7 @@ function assert( fn ) {
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
+
// QSA vars
i, groups, old, nid, newContext, newSelector;
@@ -3904,21 +4033,24 @@ function Sizzle( selector, context, results, seed ) {
return results;
}
- if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ if ( ( nodeType = context.nodeType ) !== 1 && nodeType !== 9 ) {
return [];
}
if ( !documentIsXML && !seed ) {
// Shortcuts
- if ( (match = rquickExpr.exec( selector )) ) {
+ if ( ( match = rquickExpr.exec( selector ) ) ) {
+
// Speed-up: Sizzle("#ID")
- if ( (m = match[1]) ) {
+ if ( ( m = match[ 1 ] ) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
+
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
+
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
@@ -3929,8 +4061,9 @@ function Sizzle( selector, context, results, seed ) {
return results;
}
} else {
+
// Context is not a document
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ if ( context.ownerDocument && ( elem = context.ownerDocument.getElementById( m ) ) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
@@ -3938,19 +4071,19 @@ function Sizzle( selector, context, results, seed ) {
}
// Speed-up: Sizzle("TAG")
- } else if ( match[2] ) {
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ } else if ( match[ 2 ] ) {
+ push.apply( results, slice.call( context.getElementsByTagName( selector ), 0 ) );
return results;
// Speed-up: Sizzle(".CLASS")
- } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ } else if ( ( m = match[ 3 ] ) && support.getByClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call( context.getElementsByClassName( m ), 0 ) );
return results;
}
}
// QSA path
- if ( support.qsa && !rbuggyQSA.test(selector) ) {
+ if ( support.qsa && !rbuggyQSA.test( selector ) ) {
old = true;
nid = expando;
newContext = context;
@@ -3963,7 +4096,7 @@ function Sizzle( selector, context, results, seed ) {
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
- if ( (old = context.getAttribute("id")) ) {
+ if ( ( old = context.getAttribute( "id" ) ) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
@@ -3972,10 +4105,10 @@ function Sizzle( selector, context, results, seed ) {
i = groups.length;
while ( i-- ) {
- groups[i] = nid + toSelector( groups[i] );
+ groups[ i ] = nid + toSelector( groups[ i ] );
}
newContext = rsibling.test( selector ) && context.parentNode || context;
- newSelector = groups.join(",");
+ newSelector = groups.join( "," );
}
if ( newSelector ) {
@@ -3984,10 +4117,10 @@ function Sizzle( selector, context, results, seed ) {
newSelector
), 0 ) );
return results;
- } catch(qsaError) {
+ } catch ( qsaError ) {
} finally {
if ( !old ) {
- context.removeAttribute("id");
+ context.removeAttribute( "id" );
}
}
}
@@ -4003,9 +4136,10 @@ function Sizzle( selector, context, results, seed ) {
* @param {Element|Object} elem An element or a document
*/
isXML = Sizzle.isXML = function( elem ) {
+
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ var documentElement = elem && ( elem.ownerDocument || elem ).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
@@ -4030,35 +4164,38 @@ setDocument = Sizzle.setDocument = function( node ) {
documentIsXML = isXML( doc );
// Check if getElementsByTagName("*") returns only elements
- support.tagNameNoComments = assert(function( div ) {
- div.appendChild( doc.createComment("") );
- return !div.getElementsByTagName("*").length;
- });
+ support.tagNameNoComments = assert( function( div ) {
+ div.appendChild( doc.createComment( "" ) );
+ return !div.getElementsByTagName( "*" ).length;
+ } );
// Check if attributes should be retrieved by attribute nodes
- support.attributes = assert(function( div ) {
+ support.attributes = assert( function( div ) {
div.innerHTML = "<select></select>";
- var type = typeof div.lastChild.getAttribute("multiple");
+ var type = typeof div.lastChild.getAttribute( "multiple" );
+
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
- });
+ } );
// Check if getElementsByClassName can be trusted
- support.getByClassName = assert(function( div ) {
+ support.getByClassName = assert( function( div ) {
+
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ if ( !div.getElementsByClassName || !div.getElementsByClassName( "e" ).length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
- return div.getElementsByClassName("e").length === 2;
- });
+ return div.getElementsByClassName( "e" ).length === 2;
+ } );
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
- support.getByName = assert(function( div ) {
+ support.getByName = assert( function( div ) {
+
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
@@ -4066,8 +4203,10 @@ setDocument = Sizzle.setDocument = function( node ) {
// Test
var pass = doc.getElementsByName &&
+
// buggy browsers will return fewer than the correct 2
doc.getElementsByName( expando ).length === 2 +
+
// buggy browsers will return more than the correct 0
doc.getElementsByName( expando + 0 ).length;
support.getIdNotName = !doc.getElementById( expando );
@@ -4076,63 +4215,64 @@ setDocument = Sizzle.setDocument = function( node ) {
docElem.removeChild( div );
return pass;
- });
+ } );
// IE6/7 return modified attributes
- Expr.attrHandle = assert(function( div ) {
+ Expr.attrHandle = assert( function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
- div.firstChild.getAttribute("href") === "#";
- }) ?
+ div.firstChild.getAttribute( "href" ) === "#";
+ } ) ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
- return elem.getAttribute("type");
+ return elem.getAttribute( "type" );
}
};
// ID find and filter
if ( support.getIdNotName ) {
- Expr.find["ID"] = function( id, context ) {
+ Expr.find[ "ID" ] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
+
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
+ return m && m.parentNode ? [ m ] : [];
}
};
- Expr.filter["ID"] = function( id ) {
+ Expr.filter[ "ID" ] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
- return elem.getAttribute("id") === attrId;
+ return elem.getAttribute( "id" ) === attrId;
};
};
} else {
- Expr.find["ID"] = function( id, context ) {
+ Expr.find[ "ID" ] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
var m = context.getElementById( id );
return m ?
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
- [m] :
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode( "id" ).value === id ?
+ [ m ] :
undefined :
[];
}
};
- Expr.filter["ID"] = function( id ) {
+ Expr.filter[ "ID" ] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode( "id" );
return node && node.value === attrId;
};
};
}
// Tag
- Expr.find["TAG"] = support.tagNameNoComments ?
+ Expr.find[ "TAG" ] = support.tagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
@@ -4146,7 +4286,7 @@ setDocument = Sizzle.setDocument = function( node ) {
// Filter out possible comments
if ( tag === "*" ) {
- while ( (elem = results[i++]) ) {
+ while ( ( elem = results[ i++ ] ) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
@@ -4158,14 +4298,14 @@ setDocument = Sizzle.setDocument = function( node ) {
};
// Name
- Expr.find["NAME"] = support.getByName && function( tag, context ) {
+ Expr.find[ "NAME" ] = support.getByName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
};
// Class
- Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+ Expr.find[ "CLASS" ] = support.getByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
return context.getElementsByClassName( className );
}
@@ -4181,10 +4321,12 @@ setDocument = Sizzle.setDocument = function( node ) {
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ];
- if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+ if ( ( support.qsa = isNative( doc.querySelectorAll ) ) ) {
+
// Build QSA regex
// Regex strategy adopted from Diego Perini
- assert(function( div ) {
+ assert( function( div ) {
+
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
@@ -4193,46 +4335,47 @@ setDocument = Sizzle.setDocument = function( node ) {
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
- if ( !div.querySelectorAll("[selected]").length ) {
+ if ( !div.querySelectorAll( "[selected]" ).length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
- if ( !div.querySelectorAll(":checked").length ) {
- rbuggyQSA.push(":checked");
+ if ( !div.querySelectorAll( ":checked" ).length ) {
+ rbuggyQSA.push( ":checked" );
}
- });
+ } );
- assert(function( div ) {
+ assert( function( div ) {
// Opera 10-12/IE8 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<input type='hidden' i=''/>";
- if ( div.querySelectorAll("[i^='']").length ) {
+ if ( div.querySelectorAll( "[i^='']" ).length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
- if ( !div.querySelectorAll(":enabled").length ) {
+ if ( !div.querySelectorAll( ":enabled" ).length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
- div.querySelectorAll("*,:x");
- rbuggyQSA.push(",.*:");
- });
+ div.querySelectorAll( "*,:x" );
+ rbuggyQSA.push( ",.*:" );
+ } );
}
- if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+ if ( ( support.matchesSelector = isNative( ( matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
- docElem.msMatchesSelector) )) ) {
+ docElem.msMatchesSelector ) ) ) ) {
+
+ assert( function( div ) {
- assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
@@ -4241,16 +4384,16 @@ setDocument = Sizzle.setDocument = function( node ) {
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
- });
+ } );
}
- rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
- rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+ rbuggyQSA = new RegExp( rbuggyQSA.join( "|" ) );
+ rbuggyMatches = new RegExp( rbuggyMatches.join( "|" ) );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
- contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+ contains = isNative( docElem.contains ) || docElem.compareDocumentPosition ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
@@ -4258,11 +4401,11 @@ setDocument = Sizzle.setDocument = function( node ) {
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
- ));
+ ) );
} :
function( a, b ) {
if ( b ) {
- while ( (b = b.parentNode) ) {
+ while ( ( b = b.parentNode ) ) {
if ( b === a ) {
return true;
}
@@ -4281,7 +4424,7 @@ setDocument = Sizzle.setDocument = function( node ) {
return 0;
}
- if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+ if ( ( compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ) ) ) {
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
if ( a === doc || contains( preferredDoc, a ) ) {
return -1;
@@ -4324,33 +4467,34 @@ setDocument = Sizzle.setDocument = function( node ) {
// Otherwise we need full lists of their ancestors for comparison
cur = a;
- while ( (cur = cur.parentNode) ) {
+ while ( ( cur = cur.parentNode ) ) {
ap.unshift( cur );
}
cur = b;
- while ( (cur = cur.parentNode) ) {
+ while ( ( cur = cur.parentNode ) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
- while ( ap[i] === bp[i] ) {
+ while ( ap[ i ] === bp[ i ] ) {
i++;
}
return i ?
+
// 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
- ap[i] === preferredDoc ? -1 :
- bp[i] === preferredDoc ? 1 :
+ ap[ i ] === preferredDoc ? -1 :
+ bp[ i ] === preferredDoc ? 1 :
0;
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
hasDuplicate = false;
- [0, 0].sort( sortOrder );
+ [ 0, 0 ].sort( sortOrder );
support.detectDuplicates = hasDuplicate;
return document;
@@ -4361,6 +4505,7 @@ Sizzle.matches = function( expr, elements ) {
};
Sizzle.matchesSelector = function( elem, expr ) {
+
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
@@ -4370,24 +4515,26 @@ Sizzle.matchesSelector = function( elem, expr ) {
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyQSA always contains :focus, so no need for an existence check
- if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+ if ( support.matchesSelector && !documentIsXML && ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && !rbuggyQSA.test( expr ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
+
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
- } catch(e) {}
+ } catch ( e ) {}
}
- return Sizzle( expr, document, null, [elem] ).length > 0;
+ return Sizzle( expr, document, null, [ elem ] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
+
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
@@ -4406,13 +4553,13 @@ Sizzle.attr = function( elem, name ) {
if ( !documentIsXML ) {
name = name.toLowerCase();
}
- if ( (val = Expr.attrHandle[ name ]) ) {
+ if ( ( val = Expr.attrHandle[ name ] ) ) {
return val( elem );
}
if ( documentIsXML || support.attributes ) {
return elem.getAttribute( name );
}
- return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+ return ( ( val = elem.getAttributeNode( name ) ) || elem.getAttribute( name ) ) && elem[ name ] === true ?
name :
val && val.specified ? val.value : null;
};
@@ -4433,7 +4580,7 @@ Sizzle.uniqueSort = function( results ) {
results.sort( sortOrder );
if ( hasDuplicate ) {
- for ( ; (elem = results[i]); i++ ) {
+ for ( ; ( elem = results[ i ] ); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
@@ -4457,7 +4604,7 @@ function siblingCheck( a, b ) {
// Check if b follows a
if ( cur ) {
- while ( (cur = cur.nextSibling) ) {
+ while ( ( cur = cur.nextSibling ) ) {
if ( cur === b ) {
return -1;
}
@@ -4479,27 +4626,27 @@ function createInputPseudo( type ) {
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && elem.type === type;
+ return ( name === "input" || name === "button" ) && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
- return markFunction(function( argument ) {
+ return markFunction( function( argument ) {
argument = +argument;
- return markFunction(function( seed, matches ) {
+ return markFunction( function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
- if ( seed[ (j = matchIndexes[i]) ] ) {
- seed[j] = !(matches[j] = seed[j]);
+ if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
+ seed[ j ] = !( matches[ j ] = seed[ j ] );
}
}
- });
- });
+ } );
+ } );
}
/**
@@ -4513,17 +4660,21 @@ getText = Sizzle.getText = function( elem ) {
nodeType = elem.nodeType;
if ( !nodeType ) {
+
// If no nodeType, this is expected to be an array
- for ( ; (node = elem[i]); i++ ) {
+ for ( ; ( node = elem[ i ] ); i++ ) {
+
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
+
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
@@ -4532,6 +4683,7 @@ getText = Sizzle.getText = function( elem ) {
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
+
// Do not include comment or processing instruction nodes
return ret;
@@ -4557,13 +4709,13 @@ Expr = Sizzle.selectors = {
preFilter: {
"ATTR": function( match ) {
- match[1] = match[1].replace( runescape, funescape );
+ match[ 1 ] = match[ 1 ].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
- match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+ match[ 3 ] = ( match[ 4 ] || match[ 5 ] || "" ).replace( runescape, funescape );
- if ( match[2] === "~=" ) {
- match[3] = " " + match[3] + " ";
+ if ( match[ 2 ] === "~=" ) {
+ match[ 3 ] = " " + match[ 3 ] + " ";
}
return match.slice( 0, 4 );
@@ -4580,22 +4732,23 @@ Expr = Sizzle.selectors = {
7 sign of y-component
8 y of y-component
*/
- match[1] = match[1].toLowerCase();
+ match[ 1 ] = match[ 1 ].toLowerCase();
+
+ if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
- if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
- if ( !match[3] ) {
- Sizzle.error( match[0] );
+ if ( !match[ 3 ] ) {
+ Sizzle.error( match[ 0 ] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+ match[ 4 ] = +( match[ 4 ] ? match[ 5 ] + ( match[ 6 ] || 1 ) : 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
+ match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
// other types prohibit arguments
- } else if ( match[3] ) {
- Sizzle.error( match[0] );
+ } else if ( match[ 3 ] ) {
+ Sizzle.error( match[ 0 ] );
}
return match;
@@ -4603,26 +4756,28 @@ Expr = Sizzle.selectors = {
"PSEUDO": function( match ) {
var excess,
- unquoted = !match[5] && match[2];
+ unquoted = !match[ 5 ] && match[ 2 ];
- if ( matchExpr["CHILD"].test( match[0] ) ) {
+ if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
return null;
}
// Accept quoted arguments as-is
- if ( match[4] ) {
- match[2] = match[4];
+ if ( match[ 4 ] ) {
+ match[ 2 ] = match[ 4 ];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
+
// Get excess from tokenize (recursively)
- (excess = tokenize( unquoted, true )) &&
+ ( excess = tokenize( unquoted, true ) ) &&
+
// advance to the next closing parenthesis
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+ ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
// excess is a negative index
- match[0] = match[0].slice( 0, excess );
- match[2] = unquoted.slice( 0, excess );
+ match[ 0 ] = match[ 0 ].slice( 0, excess );
+ match[ 2 ] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
@@ -4647,10 +4802,10 @@ Expr = Sizzle.selectors = {
var pattern = classCache[ className + " " ];
return pattern ||
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ ( pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" ) ) &&
classCache( className, function( elem ) {
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
- });
+ return pattern.test( elem.className || ( typeof elem.getAttribute !== strundefined && elem.getAttribute( "class" ) ) || "" );
+ } );
},
"ATTR": function( name, operator, check ) {
@@ -4702,11 +4857,12 @@ Expr = Sizzle.selectors = {
if ( simple ) {
while ( dir ) {
node = elem;
- while ( (node = node[ dir ]) ) {
+ while ( ( node = node[ dir ] ) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
+
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
@@ -4717,17 +4873,18 @@ Expr = Sizzle.selectors = {
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
+
// Seek `elem` from a previously-cached index
- outerCache = parent[ expando ] || (parent[ expando ] = {});
+ outerCache = parent[ expando ] || ( parent[ expando ] = {} );
cache = outerCache[ type ] || [];
- nodeIndex = cache[0] === dirruns && cache[1];
- diff = cache[0] === dirruns && cache[2];
+ nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
+ diff = cache[ 0 ] === dirruns && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
- while ( (node = ++nodeIndex && node && node[ dir ] ||
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
- (diff = nodeIndex = 0) || start.pop()) ) {
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
@@ -4737,19 +4894,21 @@ Expr = Sizzle.selectors = {
}
// Use previously-cached element index if available
- } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
- diff = cache[1];
+ } else if ( useCache && ( cache = ( elem[ expando ] || ( elem[ expando ] = {} ) )[ type ] ) && cache[ 0 ] === dirruns ) {
+ diff = cache[ 1 ];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
+
// Use the same loop as above to seek `elem` from the start
- while ( (node = ++nodeIndex && node && node[ dir ] ||
- (diff = nodeIndex = 0) || start.pop()) ) {
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+
// Cache the index of each encountered element
if ( useCache ) {
- (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ ( node[ expando ] || ( node[ expando ] = {} ) )[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
@@ -4767,6 +4926,7 @@ Expr = Sizzle.selectors = {
},
"PSEUDO": function( pseudo, argument ) {
+
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
@@ -4786,15 +4946,15 @@ Expr = Sizzle.selectors = {
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
- markFunction(function( seed, matches ) {
+ markFunction( function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
- idx = indexOf.call( seed, matched[i] );
- seed[ idx ] = !( matches[ idx ] = matched[i] );
+ idx = indexOf.call( seed, matched[ i ] );
+ seed[ idx ] = !( matches[ idx ] = matched[ i ] );
}
- }) :
+ } ) :
function( elem ) {
return fn( elem, 0, args );
};
@@ -4805,8 +4965,10 @@ Expr = Sizzle.selectors = {
},
pseudos: {
+
// Potentially complex pseudos
- "not": markFunction(function( selector ) {
+ "not": markFunction( function( selector ) {
+
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
@@ -4815,36 +4977,36 @@ Expr = Sizzle.selectors = {
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
- markFunction(function( seed, matches, context, xml ) {
+ markFunction( function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
- if ( (elem = unmatched[i]) ) {
- seed[i] = !(matches[i] = elem);
+ if ( ( elem = unmatched[ i ] ) ) {
+ seed[ i ] = !( matches[ i ] = elem );
}
}
- }) :
+ } ) :
function( elem, context, xml ) {
- input[0] = elem;
+ input[ 0 ] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
- }),
+ } ),
- "has": markFunction(function( selector ) {
+ "has": markFunction( function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
- }),
+ } ),
- "contains": markFunction(function( text ) {
+ "contains": markFunction( function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
- }),
+ } ),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
@@ -4854,25 +5016,26 @@ Expr = Sizzle.selectors = {
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
+
// lang value must be a valid identifider
- if ( !ridentifier.test(lang || "") ) {
+ if ( !ridentifier.test( lang || "" ) ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
- if ( (elemLang = documentIsXML ?
- elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
- elem.lang) ) {
+ if ( ( elemLang = documentIsXML ?
+ elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) :
+ elem.lang ) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
return false;
};
- }),
+ } ),
// Miscellaneous
"target": function( elem ) {
@@ -4885,7 +5048,7 @@ Expr = Sizzle.selectors = {
},
"focus": function( elem ) {
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ return elem === document.activeElement && ( !document.hasFocus || document.hasFocus() ) && !!( elem.type || elem.href || ~elem.tabIndex );
},
// Boolean properties
@@ -4898,13 +5061,15 @@ Expr = Sizzle.selectors = {
},
"checked": function( elem ) {
+
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ return ( nodeName === "input" && !!elem.checked ) || ( nodeName === "option" && !!elem.selected );
},
"selected": function( elem ) {
+
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
@@ -4916,6 +5081,7 @@ Expr = Sizzle.selectors = {
// Contents
"empty": function( elem ) {
+
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
@@ -4930,7 +5096,7 @@ Expr = Sizzle.selectors = {
},
"parent": function( elem ) {
- return !Expr.pseudos["empty"]( elem );
+ return !Expr.pseudos[ "empty" ]( elem );
},
// Element/input types
@@ -4949,57 +5115,58 @@ Expr = Sizzle.selectors = {
"text": function( elem ) {
var attr;
+
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ ( ( attr = elem.getAttribute( "type" ) ) == null || attr.toLowerCase() === elem.type );
},
// Position-in-collection
- "first": createPositionalPseudo(function() {
+ "first": createPositionalPseudo( function() {
return [ 0 ];
- }),
+ } ),
- "last": createPositionalPseudo(function( matchIndexes, length ) {
+ "last": createPositionalPseudo( function( matchIndexes, length ) {
return [ length - 1 ];
- }),
+ } ),
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ "eq": createPositionalPseudo( function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
- }),
+ } ),
- "even": createPositionalPseudo(function( matchIndexes, length ) {
+ "even": createPositionalPseudo( function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
- }),
+ } ),
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ "odd": createPositionalPseudo( function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
- }),
+ } ),
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
- }),
+ } ),
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
- })
+ } )
}
};
@@ -5027,10 +5194,11 @@ function tokenize( selector, parseOnly ) {
while ( soFar ) {
// Comma and first run
- if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
if ( match ) {
+
// Don't consume trailing commas as valid
- soFar = soFar.slice( match[0].length ) || soFar;
+ soFar = soFar.slice( match[ 0 ].length ) || soFar;
}
groups.push( tokens = [] );
}
@@ -5038,20 +5206,21 @@ function tokenize( selector, parseOnly ) {
matched = false;
// Combinators
- if ( (match = rcombinators.exec( soFar )) ) {
+ if ( ( match = rcombinators.exec( soFar ) ) ) {
matched = match.shift();
tokens.push( {
value: matched,
+
// Cast descendant combinators to space
- type: match[0].replace( rtrim, " " )
+ type: match[ 0 ].replace( rtrim, " " )
} );
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
- (match = preFilters[ type ]( match ))) ) {
+ if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
+ ( match = preFilters[ type ]( match ) ) ) ) {
matched = match.shift();
tokens.push( {
value: matched,
@@ -5074,6 +5243,7 @@ function tokenize( selector, parseOnly ) {
soFar.length :
soFar ?
Sizzle.error( selector ) :
+
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
@@ -5083,7 +5253,7 @@ function toSelector( tokens ) {
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
- selector += tokens[i].value;
+ selector += tokens[ i ].value;
}
return selector;
}
@@ -5094,9 +5264,10 @@ function addCombinator( matcher, combinator, base ) {
doneName = done++;
return combinator.first ?
+
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
- while ( (elem = elem[ dir ]) ) {
+ while ( ( elem = elem[ dir ] ) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
@@ -5110,7 +5281,7 @@ function addCombinator( matcher, combinator, base ) {
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
- while ( (elem = elem[ dir ]) ) {
+ while ( ( elem = elem[ dir ] ) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
@@ -5118,17 +5289,17 @@ function addCombinator( matcher, combinator, base ) {
}
}
} else {
- while ( (elem = elem[ dir ]) ) {
+ while ( ( elem = elem[ dir ] ) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
- outerCache = elem[ expando ] || (elem[ expando ] = {});
- if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
- if ( (data = cache[1]) === true || data === cachedruns ) {
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
+ if ( ( cache = outerCache[ dir ] ) && cache[ 0 ] === dirkey ) {
+ if ( ( data = cache[ 1 ] ) === true || data === cachedruns ) {
return data === true;
}
} else {
cache = outerCache[ dir ] = [ dirkey ];
- cache[1] = matcher( elem, context, xml ) || cachedruns;
- if ( cache[1] === true ) {
+ cache[ 1 ] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[ 1 ] === true ) {
return true;
}
}
@@ -5143,13 +5314,13 @@ function elementMatcher( matchers ) {
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
- if ( !matchers[i]( elem, context, xml ) ) {
+ if ( !matchers[ i ]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
- matchers[0];
+ matchers[ 0 ];
}
function condense( unmatched, map, filter, context, xml ) {
@@ -5160,7 +5331,7 @@ function condense( unmatched, map, filter, context, xml ) {
mapped = map != null;
for ( ; i < len; i++ ) {
- if ( (elem = unmatched[i]) ) {
+ if ( ( elem = unmatched[ i ] ) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
@@ -5180,7 +5351,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
- return markFunction(function( seed, results, context, xml ) {
+ return markFunction( function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
@@ -5195,6 +5366,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
elems,
matcherOut = matcher ?
+
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
@@ -5218,8 +5390,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
- if ( (elem = temp[i]) ) {
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ if ( ( elem = temp[ i ] ) ) {
+ matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
}
}
}
@@ -5227,25 +5399,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
+
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
- if ( (elem = matcherOut[i]) ) {
+ if ( ( elem = matcherOut[ i ] ) ) {
+
// Restore matcherIn since elem is not yet a final match
- 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
i = matcherOut.length;
while ( i-- ) {
- if ( (elem = matcherOut[i]) &&
- (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+ if ( ( elem = matcherOut[ i ] ) &&
+ ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
- seed[temp] = !(results[temp] = elem);
+ seed[ temp ] = !( results[ temp ] = elem );
}
}
}
@@ -5263,14 +5437,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
push.apply( results, matcherOut );
}
}
- });
+ } );
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
- leadingRelative = Expr.relative[ tokens[0].type ],
- implicitRelative = leadingRelative || Expr.relative[" "],
+ leadingRelative = Expr.relative[ tokens[ 0 ].type ],
+ implicitRelative = leadingRelative || Expr.relative[ " " ],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
@@ -5282,23 +5456,24 @@ function matcherFromTokens( tokens ) {
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
- (checkContext = context).nodeType ?
+ ( checkContext = context ).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
} else {
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+ matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
+
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
- if ( Expr.relative[ tokens[j].type ] ) {
+ if ( Expr.relative[ tokens[ j ].type ] ) {
break;
}
}
@@ -5307,7 +5482,7 @@ function matcherFromTokens( tokens ) {
i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
j < len && toSelector( tokens )
);
}
@@ -5319,6 +5494,7 @@ function matcherFromTokens( tokens ) {
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+
// A counter to specify which element is currently being matched
var matcherCachedRuns = 0,
bySet = setMatchers.length > 0,
@@ -5331,10 +5507,12 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
+
// We must always have either seed elements or context
- elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ elems = seed || byElement && Expr.find[ "TAG" ]( "*", expandContext && context.parentNode || context ),
+
// 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 );
if ( outermost ) {
outermostContext = context !== document && context;
@@ -5343,10 +5521,10 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
- for ( ; (elem = elems[i]) != null; i++ ) {
+ for ( ; ( elem = elems[ i ] ) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
- while ( (matcher = elementMatchers[j++]) ) {
+ while ( ( matcher = elementMatchers[ j++ ] ) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
@@ -5360,8 +5538,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
// Track unmatched elements for set filters
if ( bySet ) {
+
// They will have gone through all possible matchers
- if ( (elem = !matcher && elem) ) {
+ if ( ( elem = !matcher && elem ) ) {
matchedCount--;
}
@@ -5376,16 +5555,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
- while ( (matcher = setMatchers[j++]) ) {
+ while ( ( matcher = setMatchers[ j++ ] ) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
+
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
- if ( !(unmatched[i] || setMatched[i]) ) {
- setMatched[i] = pop.call( results );
+ if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
+ setMatched[ i ] = pop.call( results );
}
}
}
@@ -5426,13 +5606,14 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
cached = compilerCache[ selector + " " ];
if ( !cached ) {
+
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
- cached = matcherFromTokens( group[i] );
+ cached = matcherFromTokens( group[ i ] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
@@ -5450,7 +5631,7 @@ function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
- Sizzle( selector, contexts[i], results );
+ Sizzle( selector, contexts[ i ], results );
}
return results;
}
@@ -5460,16 +5641,17 @@ function select( selector, context, results, seed ) {
match = tokenize( selector );
if ( !seed ) {
+
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
- tokens = match[0] = match[0].slice( 0 );
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ tokens = match[ 0 ] = match[ 0 ].slice( 0 );
+ if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
context.nodeType === 9 && !documentIsXML &&
- Expr.relative[ tokens[1].type ] ) {
+ Expr.relative[ tokens[ 1 ].type ] ) {
- context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+ context = Expr.find[ "ID" ]( token.matches[ 0 ].replace( runescape, funescape ), context )[ 0 ];
if ( !context ) {
return results;
}
@@ -5478,20 +5660,21 @@ function select( selector, context, results, seed ) {
}
// Fetch a seed set for right-to-left matching
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
- token = tokens[i];
+ token = tokens[ i ];
// Abort if we hit a combinator
- if ( Expr.relative[ (type = token.type) ] ) {
+ if ( Expr.relative[ ( type = token.type ) ] ) {
break;
}
- if ( (find = Expr.find[ type ]) ) {
+ if ( ( find = Expr.find[ type ] ) ) {
+
// Search, expanding context for leading sibling combinators
- if ( (seed = find(
- token.matches[0].replace( runescape, funescape ),
- rsibling.test( tokens[0].type ) && context.parentNode || context
- )) ) {
+ if ( ( seed = find(
+ token.matches[ 0 ].replace( runescape, funescape ),
+ rsibling.test( tokens[ 0 ].type ) && context.parentNode || context
+ ) ) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
@@ -5521,7 +5704,7 @@ function select( selector, context, results, seed ) {
}
// Deprecated
-Expr.pseudos["nth"] = Expr.pseudos["eq"];
+Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
// Easy API for creating new setFilters
function setFilters() {}
@@ -5535,18 +5718,18 @@ setDocument();
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
-
-})( window );
+} )( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
+
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
@@ -5555,20 +5738,20 @@ var runtil = /Until$/,
prev: true
};
-jQuery.fn.extend({
+jQuery.fn.extend( {
find: function( selector ) {
var i, ret, self,
len = this.length;
if ( typeof selector !== "string" ) {
self = this;
- return this.pushStack( jQuery( selector ).filter(function() {
+ return this.pushStack( jQuery( selector ).filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
- }) );
+ } ) );
}
ret = [];
@@ -5587,30 +5770,31 @@ jQuery.fn.extend({
targets = jQuery( target, this ),
len = targets.length;
- return this.filter(function() {
+ return this.filter( function() {
for ( i = 0; i < len; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
+ if ( jQuery.contains( this, targets[ i ] ) ) {
return true;
}
}
- });
+ } );
},
not: function( selector ) {
- return this.pushStack( winnow(this, selector, false) );
+ return this.pushStack( winnow( this, selector, false ) );
},
filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true) );
+ return this.pushStack( winnow( this, selector, true ) );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
+
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery( selector, this.context ).index( this[ 0 ] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
@@ -5625,10 +5809,10 @@ jQuery.fn.extend({
0;
for ( ; i < l; i++ ) {
- cur = this[i];
+ cur = this[ i ];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ if ( pos ? pos.index( cur ) > -1 : jQuery.find.matchesSelector( cur, selectors ) ) {
ret.push( cur );
break;
}
@@ -5645,18 +5829,19 @@ jQuery.fn.extend({
// No argument, return index in parent
if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
}
// index in selector
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
return jQuery.inArray(
+
// If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
+ elem.jquery ? elem[ 0 ] : elem, this );
},
add: function( selector, context ) {
@@ -5665,15 +5850,15 @@ jQuery.fn.extend({
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
- return this.pushStack( jQuery.unique(all) );
+ return this.pushStack( jQuery.unique( all ) );
},
addBack: function( selector ) {
return this.add( selector == null ?
- this.prevObject : this.prevObject.filter(selector)
+ this.prevObject : this.prevObject.filter( selector )
);
}
-});
+} );
jQuery.fn.andSelf = jQuery.fn.addBack;
@@ -5685,7 +5870,7 @@ function sibling( cur, dir ) {
return cur;
}
-jQuery.each({
+jQuery.each( {
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
@@ -5745,28 +5930,28 @@ jQuery.each({
return this.pushStack( ret );
};
-});
+} );
-jQuery.extend({
+jQuery.extend( {
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
+ jQuery.find.matchesSelector( elems[ 0 ], expr ) ? [ elems[ 0 ] ] : [] :
+ jQuery.find.matches( expr, elems );
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ while ( cur && cur.nodeType !== 9 && ( until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until ) ) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
- cur = cur[dir];
+ cur = cur[ dir ];
}
return matched;
},
@@ -5782,7 +5967,7 @@ jQuery.extend({
return r;
}
-});
+} );
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
@@ -5792,31 +5977,31 @@ function winnow( elements, qualifier, keep ) {
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
+ return jQuery.grep( elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
- });
+ } );
} else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem ) {
+ return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) === keep;
- });
+ } );
} else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
+ var filtered = jQuery.grep( elements, function( elem ) {
return elem.nodeType === 1;
- });
+ } );
if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
+ return jQuery.filter( qualifier, filtered, !keep );
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
- return jQuery.grep(elements, function( elem ) {
+ return jQuery.grep( elements, function( elem ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
+ } );
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
@@ -5835,7 +6020,7 @@ function createSafeFragment( document ) {
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ),
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
@@ -5843,6 +6028,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /^$|\/(?:java|ecma)script/i,
@@ -5862,40 +6048,41 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
// 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: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
},
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.thead;
wrapMap.th = wrapMap.td;
-jQuery.fn.extend({
+jQuery.fn.extend( {
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
- this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ this.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
+ return this.each( function( i ) {
+ jQuery( this ).wrapAll( html.call( this, i ) );
+ } );
}
- if ( this[0] ) {
+ if ( this[ 0 ] ) {
+
// The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+ var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
+ if ( this[ 0 ].parentNode ) {
+ wrap.insertBefore( this[ 0 ] );
}
- wrap.map(function() {
+ wrap.map( function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
@@ -5903,7 +6090,7 @@ jQuery.fn.extend({
}
return elem;
- }).append( this );
+ } ).append( this );
}
return this;
@@ -5911,12 +6098,12 @@ jQuery.fn.extend({
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
+ return this.each( function( i ) {
+ jQuery( this ).wrapInner( html.call( this, i ) );
+ } );
}
- return this.each(function() {
+ return this.each( function() {
var self = jQuery( this ),
contents = self.contents();
@@ -5926,39 +6113,39 @@ jQuery.fn.extend({
} else {
self.append( html );
}
- });
+ } );
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
+ return this.each( function( i ) {
+ jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
+ } );
},
unwrap: function() {
- return this.parent().each(function() {
+ return this.parent().each( function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
- }).end();
+ } ).end();
},
append: function() {
- return this.domManip(arguments, true, function( elem ) {
+ return this.domManip( arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.appendChild( elem );
}
- });
+ } );
},
prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
+ return this.domManip( arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.insertBefore( elem, this.firstChild );
}
- });
+ } );
},
before: function() {
@@ -5966,7 +6153,7 @@ jQuery.fn.extend({
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
- });
+ } );
},
after: function() {
@@ -5974,7 +6161,7 @@ jQuery.fn.extend({
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
- });
+ } );
},
// keepData is for internal use only--do not document
@@ -5982,7 +6169,7 @@ jQuery.fn.extend({
var elem,
i = 0;
- for ( ; (elem = this[i]) != null; i++ ) {
+ for ( ; ( elem = this[ i ] ) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem ) );
@@ -6004,7 +6191,8 @@ jQuery.fn.extend({
var elem,
i = 0;
- for ( ; (elem = this[i]) != null; i++ ) {
+ for ( ; ( elem = this[ i ] ) != null; i++ ) {
+
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
@@ -6029,14 +6217,14 @@ jQuery.fn.extend({
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
- return this.map( function () {
+ return this.map( function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
+ } );
},
html: function( value ) {
return jQuery.access( this, function( value ) {
- var elem = this[0] || {},
+ var elem = this[ 0 ] || {},
i = 0,
l = this.length;
@@ -6050,14 +6238,15 @@ jQuery.fn.extend({
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
- !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+ !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
- for (; i < l; i++ ) {
+ for ( ; i < l; i++ ) {
+
// Remove element nodes and prevent memory leaks
- elem = this[i] || {};
+ elem = this[ i ] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
@@ -6067,7 +6256,7 @@ jQuery.fn.extend({
elem = 0;
// If using innerHTML throws an exception, use the fallback method
- } catch(e) {}
+ } catch ( e ) {}
}
if ( elem ) {
@@ -6093,7 +6282,7 @@ jQuery.fn.extend({
jQuery( this ).remove();
parent.insertBefore( elem, next );
}
- });
+ } );
},
detach: function( selector ) {
@@ -6111,18 +6300,18 @@ jQuery.fn.extend({
l = this.length,
set = this,
iNoClone = l - 1,
- value = args[0],
+ value = args[ 0 ],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
- return this.each(function( index ) {
+ return this.each( function( index ) {
var self = set.eq( index );
if ( isFunction ) {
- args[0] = value.call( this, index, table ? self.html() : undefined );
+ args[ 0 ] = value.call( this, index, table ? self.html() : undefined );
}
self.domManip( args, table, callback );
- });
+ } );
}
if ( l ) {
@@ -6153,9 +6342,9 @@ jQuery.fn.extend({
}
callback.call(
- table && jQuery.nodeName( this[i], "table" ) ?
- findOrAppend( this[i], "tbody" ) :
- this[i],
+ table && jQuery.nodeName( this[ i ], "table" ) ?
+ findOrAppend( this[ i ], "tbody" ) :
+ this[ i ],
node,
i
);
@@ -6174,15 +6363,16 @@ jQuery.fn.extend({
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
if ( node.src ) {
+
// Hope ajax is available...
- jQuery.ajax({
+ jQuery.ajax( {
url: node.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
- });
+ } );
} else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
}
@@ -6197,24 +6387,24 @@ jQuery.fn.extend({
return this;
}
-});
+} );
function findOrAppend( elem, tag ) {
- return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+ return elem.getElementsByTagName( tag )[ 0 ] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
- var attr = elem.getAttributeNode("type");
+ var attr = elem.getAttributeNode( "type" );
elem.type = ( attr && attr.specified ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
- elem.type = match[1];
+ elem.type = match[ 1 ];
} else {
- elem.removeAttribute("type");
+ elem.removeAttribute( "type" );
}
return elem;
}
@@ -6223,8 +6413,8 @@ function restoreScript( elem ) {
function setGlobalEval( elems, refElements ) {
var elem,
i = 0;
- for ( ; (elem = elems[i]) != null; i++ ) {
- jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ for ( ; ( elem = elems[ i ] ) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[ i ], "globalEval" ) );
}
}
@@ -6294,11 +6484,12 @@ function fixCloneNodeIssues( src, dest ) {
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
- if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
@@ -6323,7 +6514,7 @@ function fixCloneNodeIssues( src, dest ) {
}
}
-jQuery.each({
+jQuery.each( {
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
@@ -6338,8 +6529,8 @@ jQuery.each({
last = insert.length - 1;
for ( ; i <= last; i++ ) {
- elems = i === last ? this : this.clone(true);
- jQuery( insert[i] )[ original ]( elems );
+ elems = i === last ? this : this.clone( true );
+ jQuery( insert[ i ] )[ original ]( elems );
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
core_push.apply( ret, elems.get() );
@@ -6347,7 +6538,7 @@ jQuery.each({
return this.pushStack( ret );
};
-});
+} );
function getAll( context, tag ) {
var elems, elem,
@@ -6357,7 +6548,7 @@ function getAll( context, tag ) {
undefined;
if ( !found ) {
- for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ for ( found = [], elems = context.childNodes || context; ( elem = elems[ i ] ) != null; i++ ) {
if ( !tag || jQuery.nodeName( elem, tag ) ) {
found.push( elem );
} else {
@@ -6378,12 +6569,12 @@ function fixDefaultChecked( elem ) {
}
}
-jQuery.extend({
+jQuery.extend( {
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem );
- if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc( elem ) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
@@ -6392,18 +6583,19 @@ jQuery.extend({
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+ if ( ( !jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked ) &&
+ ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
// 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
- if ( destElements[i] ) {
- fixCloneNodeIssues( node, destElements[i] );
+ if ( destElements[ i ] ) {
+ fixCloneNodeIssues( node, destElements[ i ] );
}
}
}
@@ -6414,8 +6606,8 @@ jQuery.extend({
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
- for ( i = 0; (node = srcElements[i]) != null; i++ ) {
- cloneCopyEvent( node, destElements[i] );
+ for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) {
+ cloneCopyEvent( node, destElements[ i ] );
}
} else {
cloneCopyEvent( elem, clone );
@@ -6460,23 +6652,23 @@ jQuery.extend({
// Convert html into DOM nodes
} else {
- tmp = tmp || safe.appendChild( context.createElement("div") );
+ tmp = tmp || safe.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation
- tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
- tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+ tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
// Descend through wrappers to the right content
- j = wrap[0];
+ j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Manually add leading whitespace removed by IE
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
}
// Remove IE's autoinserted <tbody> from table fragments
@@ -6487,13 +6679,13 @@ jQuery.extend({
tmp.firstChild :
// String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
tmp :
0;
j = elem && elem.childNodes.length;
while ( j-- ) {
- if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && !tbody.childNodes.length ) {
elem.removeChild( tbody );
}
}
@@ -6527,7 +6719,7 @@ jQuery.extend({
}
i = 0;
- while ( (elem = nodes[ i++ ]) ) {
+ while ( ( elem = nodes[ i++ ] ) ) {
// #4087 - If origin and destination elements are the same, and this is
// that element, do not do anything
@@ -6548,7 +6740,7 @@ jQuery.extend({
// Capture executables
if ( scripts ) {
j = 0;
- while ( (elem = tmp[ j++ ]) ) {
+ while ( ( elem = tmp[ j++ ] ) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
@@ -6569,7 +6761,7 @@ jQuery.extend({
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
- for ( ; (elem = elems[i]) != null; i++ ) {
+ for ( ; ( elem = elems[ i ] ) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
@@ -6613,11 +6805,12 @@ jQuery.extend({
}
}
}
-});
+} );
var iframe, getStyles, curCSS,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
+
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
@@ -6645,7 +6838,7 @@ function vendorPropName( style, name ) {
}
// check for vendor prefixed names
- var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
origName = name,
i = cssPrefixes.length;
@@ -6660,6 +6853,7 @@ function vendorPropName( style, name ) {
}
function isHidden( elem, el ) {
+
// isHidden might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
@@ -6681,6 +6875,7 @@ function showHide( elements, show ) {
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
+
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
@@ -6691,7 +6886,7 @@ function showHide( elements, show ) {
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay( elem.nodeName ) );
}
} else {
@@ -6720,7 +6915,7 @@ function showHide( elements, show ) {
return elements;
}
-jQuery.fn.extend({
+jQuery.fn.extend( {
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
var len, styles,
@@ -6752,23 +6947,25 @@ jQuery.fn.extend({
toggle: function( state ) {
var bool = typeof state === "boolean";
- return this.each(function() {
+ return this.each( function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
- });
+ } );
}
-});
+} );
+
+jQuery.extend( {
-jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
+
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
@@ -6793,12 +6990,14 @@ jQuery.extend({
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
+
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
+
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
@@ -6820,8 +7019,9 @@ jQuery.extend({
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ if ( type === "string" && ( ret = rrelNum.exec( value ) ) ) {
+ value = ( ret[ 1 ] + 1 ) * ret[ 2 ] + parseFloat( jQuery.css( elem, name ) );
+
// Fixes bug #9237
type = "number";
}
@@ -6838,23 +7038,24 @@ jQuery.extend({
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions
- if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+ if ( !hooks || !( "set" in hooks ) || ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
- } catch(e) {}
+ } catch ( e ) {}
}
} else {
+
// If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
return ret;
}
@@ -6917,7 +7118,7 @@ jQuery.extend({
return ret;
}
-});
+} );
// NOTE: we've included the "window" in window.getComputedStyle
// because jsdom on node.js will break without it.
@@ -7016,6 +7217,7 @@ if ( window.getComputedStyle ) {
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
+
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
@@ -7023,20 +7225,24 @@ function setPositiveNumber( elem, value, subtract ) {
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
+
// If we already have the right measurement, avoid augmentation
4 :
+
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
+
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
+
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
@@ -7047,6 +7253,7 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
+
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
@@ -7072,6 +7279,7 @@ function getWidthOrHeight( elem, name, extra ) {
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
+
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
@@ -7079,7 +7287,7 @@ function getWidthOrHeight( elem, name, extra ) {
}
// Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test(val) ) {
+ if ( rnumnonpx.test( val ) ) {
return val;
}
@@ -7113,15 +7321,16 @@ function css_defaultDisplay( nodeName ) {
// If the simple way fails, read from inside an iframe
if ( display === "none" || !display ) {
+
// Use the already-created iframe if possible
iframe = ( iframe ||
- jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ jQuery( "<iframe frameborder='0' width='0' height='0'/>" )
.css( "cssText", "display:block !important" )
).appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
- doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
- doc.write("<!doctype html><html><body>");
+ doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
+ doc.write( "<!doctype html><html><body>" );
doc.close();
display = actualDisplay( nodeName, doc );
@@ -7138,21 +7347,22 @@ function css_defaultDisplay( nodeName ) {
// Called ONLY from within css_defaultDisplay
function actualDisplay( name, doc ) {
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
- display = jQuery.css( elem[0], "display" );
+ display = jQuery.css( elem[ 0 ], "display" );
elem.remove();
return display;
}
-jQuery.each([ "height", "width" ], function( i, name ) {
+jQuery.each( [ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
+
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
- }) :
+ } ) :
getWidthOrHeight( elem, name, extra );
}
},
@@ -7170,13 +7380,14 @@ jQuery.each([ "height", "width" ], function( i, name ) {
);
}
};
-});
+} );
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
+
// IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ return ropacity.test( ( computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter ) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
@@ -7218,11 +7429,12 @@ if ( !jQuery.support.opacity ) {
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
-jQuery(function() {
+jQuery( function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
if ( computed ) {
+
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" },
@@ -7241,6 +7453,7 @@ jQuery(function() {
get: function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
+
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
@@ -7248,17 +7461,18 @@ jQuery(function() {
}
}
};
- });
+ } );
}
-});
+} );
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
+
// Support: Opera <= 12.12
// Opera reports offsetWidths and offsetHeights less than zero on some elements
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
- (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ ( !jQuery.support.reliableHiddenOffsets && ( ( elem.style && elem.style.display ) || jQuery.css( elem, "display" ) ) === "none" );
};
jQuery.expr.filters.visible = function( elem ) {
@@ -7267,7 +7481,7 @@ if ( jQuery.expr && jQuery.expr.filters ) {
}
// These hooks are used by animate to expand properties
-jQuery.each({
+jQuery.each( {
margin: "",
padding: "",
border: "Width"
@@ -7278,7 +7492,7 @@ jQuery.each({
expanded = {},
// assumes a single number if not a string
- parts = typeof value === "string" ? value.split(" ") : [ value ];
+ parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
@@ -7292,43 +7506,45 @@ jQuery.each({
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
-});
+} );
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
-jQuery.fn.extend({
+jQuery.fn.extend( {
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
- return this.map(function(){
+ return this.map( function() {
+
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
- })
- .filter(function(){
+ } )
+ .filter( function() {
var type = this.type;
+
// Use .is(":disabled") so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !manipulation_rcheckableType.test( type ) );
- })
- .map(function( i, elem ){
+ } )
+ .map( function( i, elem ) {
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
- jQuery.map( val, function( val ){
+ jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
+ } ) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
+ } ).get();
}
-});
+} );
//Serialize an array of form elements or a set of
//key/values into a query string
@@ -7336,6 +7552,7 @@ jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
+
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
@@ -7348,12 +7565,14 @@ jQuery.param = function( a, traditional ) {
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
- });
+ } );
} else {
+
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
@@ -7369,32 +7588,37 @@ function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
+
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
+
// Treat each array item as a scalar.
add( prefix, v );
} else {
+
// Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
- });
+ } );
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
+
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
+
// Serialize scalar item.
add( prefix, obj );
}
}
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+ "change select submit keydown keypress keyup error contextmenu" ).split( " " ), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
@@ -7402,12 +7626,13 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
this.on( name, null, data, fn ) :
this.trigger( name );
};
-});
+} );
jQuery.fn.hover = function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
};
var
+
// Document location
ajaxLocParts,
ajaxLocation,
@@ -7445,13 +7670,14 @@ var
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = "*/".concat("*");
+ allTypes = "*/".concat( "*" );
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
-} catch( e ) {
+} catch ( e ) {
+
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
@@ -7478,16 +7704,18 @@ function addToPrefiltersOrTransports( structure ) {
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
if ( jQuery.isFunction( func ) ) {
+
// For each dataType in the dataTypeExpression
- while ( (dataType = dataTypes[i++]) ) {
+ while ( ( dataType = dataTypes[ i++ ] ) ) {
+
// Prepend if requested
- if ( dataType[0] === "+" ) {
+ if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
- (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+ ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
// Otherwise append
} else {
- (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
}
}
}
@@ -7505,14 +7733,14 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
- if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
- });
+ } );
return selected;
}
@@ -7528,7 +7756,7 @@ function ajaxExtend( target, src ) {
for ( key in src ) {
if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
@@ -7545,7 +7773,7 @@ jQuery.fn.load = function( url, params, callback ) {
var selector, response, type,
self = this,
- off = url.indexOf(" ");
+ off = url.indexOf( " " );
if ( off >= 0 ) {
selector = url.slice( off, url.length );
@@ -7566,14 +7794,14 @@ jQuery.fn.load = function( url, params, callback ) {
// If we have elements to modify, make the request
if ( self.length > 0 ) {
- jQuery.ajax({
+ jQuery.ajax( {
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params
- }).done(function( responseText ) {
+ } ).done( function( responseText ) {
// Save response for use in complete callback
response = arguments;
@@ -7582,28 +7810,29 @@ jQuery.fn.load = function( url, params, callback ) {
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
- jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+ jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
- }).complete( callback && function( jqXHR, status ) {
+ } ).complete( callback && function( jqXHR, status ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
- });
+ } );
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
- jQuery.fn[ type ] = function( fn ){
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
+ jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn );
};
-});
+} );
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
+
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
@@ -7611,17 +7840,17 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
data = undefined;
}
- return jQuery.ajax({
+ return jQuery.ajax( {
url: url,
type: method,
dataType: type,
data: data,
success: callback
- });
+ } );
};
-});
+} );
-jQuery.extend({
+jQuery.extend( {
// Counter for holding the number of active queries
active: 0,
@@ -7726,12 +7955,16 @@ jQuery.extend({
var // Cross-domain detection vars
parts,
+
// Loop variable
i,
+
// URL without anti-cache param
cacheURL,
+
// Response headers as string
responseHeadersString,
+
// timeout handle
timeoutTimer,
@@ -7739,28 +7972,38 @@ jQuery.extend({
fireGlobals,
transport,
+
// Response headers
responseHeaders,
+
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
+
// Callbacks context
callbackContext = s.context || s,
+
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
+
// Deferreds
deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks("once memory"),
+ completeDeferred = jQuery.Callbacks( "once memory" ),
+
// Status-dependent callbacks
statusCode = s.statusCode || {},
+
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
+
// The jqXHR state
state = 0,
+
// Default abort message
strAbort = "canceled",
+
// Fake xhr
jqXHR = {
readyState: 0,
@@ -7771,8 +8014,8 @@ jQuery.extend({
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
- while ( (match = rheaders.exec( responseHeadersString )) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
+ responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
@@ -7809,10 +8052,12 @@ jQuery.extend({
if ( map ) {
if ( state < 2 ) {
for ( code in map ) {
+
// Lazy-add the new callback in a way that preserves old ones
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
} else {
+
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
}
@@ -7846,7 +8091,7 @@ jQuery.extend({
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [ "" ];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
@@ -7876,7 +8121,7 @@ jQuery.extend({
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger("ajaxStart");
+ jQuery.event.trigger( "ajaxStart" );
}
// Uppercase the type
@@ -7895,6 +8140,7 @@ jQuery.extend({
// If data is available, append data to url
if ( s.data ) {
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
@@ -7929,8 +8175,8 @@ jQuery.extend({
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
+ s.accepts[ s.dataTypes[ 0 ] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
@@ -7941,6 +8187,7 @@ jQuery.extend({
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+
// Abort if not done already and return
return jqXHR.abort();
}
@@ -7966,10 +8213,11 @@ jQuery.extend({
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
+
// Timeout
if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout(function() {
- jqXHR.abort("timeout");
+ timeoutTimer = setTimeout( function() {
+ jqXHR.abort( "timeout" );
}, s.timeout );
}
@@ -7977,9 +8225,11 @@ jQuery.extend({
state = 1;
transport.send( requestHeaders, done );
} catch ( e ) {
+
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
+
// Simply rethrow otherwise
} else {
throw e;
@@ -8025,11 +8275,11 @@ jQuery.extend({
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
- modified = jqXHR.getResponseHeader("Last-Modified");
+ modified = jqXHR.getResponseHeader( "Last-Modified" );
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
- modified = jqXHR.getResponseHeader("etag");
+ modified = jqXHR.getResponseHeader( "etag" );
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
@@ -8054,6 +8304,7 @@ jQuery.extend({
isSuccess = !error;
}
} else {
+
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
@@ -8090,9 +8341,10 @@ jQuery.extend({
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
- jQuery.event.trigger("ajaxStop");
+ jQuery.event.trigger( "ajaxStop" );
}
}
}
@@ -8107,7 +8359,7 @@ jQuery.extend({
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
}
-});
+} );
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
@@ -8123,15 +8375,15 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
+ jqXHR[ responseFields[ type ] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
+ while ( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
}
}
@@ -8149,9 +8401,10 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
+
// Try convertible dataTypes
for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
finalDataType = type;
break;
}
@@ -8159,6 +8412,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
firstDataType = type;
}
}
+
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
@@ -8179,6 +8433,7 @@ function ajaxConvert( s, response ) {
var conv2, current, conv, tmp,
converters = {},
i = 0,
+
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ];
@@ -8196,7 +8451,7 @@ function ajaxConvert( s, response ) {
}
// Convert to each sequential dataType, tolerating list modification
- for ( ; (current = dataTypes[++i]); ) {
+ for ( ; ( current = dataTypes[ ++i ] ); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
@@ -8212,13 +8467,14 @@ function ajaxConvert( s, response ) {
for ( conv2 in converters ) {
// If conv2 outputs current
- tmp = conv2.split(" ");
+ tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
+
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
@@ -8239,7 +8495,7 @@ function ajaxConvert( s, response ) {
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
- if ( conv && s["throws"] ) {
+ if ( conv && s[ "throws" ] ) {
response = conv( response );
} else {
try {
@@ -8258,8 +8514,9 @@ function ajaxConvert( s, response ) {
return { state: "success", data: response };
}
+
// Install script dataType
-jQuery.ajaxSetup({
+jQuery.ajaxSetup( {
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
@@ -8272,7 +8529,7 @@ jQuery.ajaxSetup({
return text;
}
}
-});
+} );
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
@@ -8283,22 +8540,22 @@ jQuery.ajaxPrefilter( "script", function( s ) {
s.type = "GET";
s.global = false;
}
-});
+} );
// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
+jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
- head = document.head || jQuery("head")[0] || document.documentElement;
+ head = document.head || jQuery( "head" )[ 0 ] || document.documentElement;
return {
send: function( _, callback ) {
- script = document.createElement("script");
+ script = document.createElement( "script" );
script.async = true;
@@ -8343,19 +8600,19 @@ jQuery.ajaxTransport( "script", function(s) {
}
};
}
-});
+} );
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
-jQuery.ajaxSetup({
+jQuery.ajaxSetup( {
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
this[ callback ] = true;
return callback;
}
-});
+} );
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
@@ -8363,7 +8620,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
- typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) && rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
@@ -8382,7 +8639,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
}
// Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
+ s.converters[ "script json" ] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
@@ -8399,12 +8656,14 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
};
// Clean-up function (fires after converters)
- jqXHR.always(function() {
+ jqXHR.always( function() {
+
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
+
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
@@ -8418,16 +8677,18 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
}
responseContainer = overwritten = undefined;
- });
+ } );
// Delegate to script
return "script";
}
-});
+} );
var xhrCallbacks, xhrSupported,
xhrId = 0,
+
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject && function() {
+
// Abort all pending requests
var key;
for ( key in xhrCallbacks ) {
@@ -8439,13 +8700,13 @@ var xhrCallbacks, xhrSupported,
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
- } catch( e ) {}
+ } catch ( e ) {}
}
function createActiveXHR() {
try {
- return new window.ActiveXObject("Microsoft.XMLHTTP");
- } catch( e ) {}
+ return new window.ActiveXObject( "Microsoft.XMLHTTP" );
+ } catch ( e ) {}
}
// Create the request object
@@ -8460,6 +8721,7 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
+
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
@@ -8471,7 +8733,8 @@ xhrSupported = jQuery.support.ajax = !!xhrSupported;
// Create transport if the browser can provide an xhr
if ( xhrSupported ) {
- jQuery.ajaxTransport(function( s ) {
+ jQuery.ajaxTransport( function( s ) {
+
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
@@ -8509,8 +8772,8 @@ if ( xhrSupported ) {
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers["X-Requested-With"] = "XMLHttpRequest";
+ if ( !s.crossDomain && !headers[ "X-Requested-With" ] ) {
+ headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
@@ -8518,7 +8781,7 @@ if ( xhrSupported ) {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
- } catch( err ) {}
+ } catch ( err ) {}
// Do send the request
// This may raise an exception which is actually
@@ -8550,6 +8813,7 @@ if ( xhrSupported ) {
// If it's an abort
if ( isAbort ) {
+
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
@@ -8569,7 +8833,8 @@ if ( xhrSupported ) {
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
- } catch( e ) {
+ } catch ( e ) {
+
// We normalize with Webkit giving an empty statusText
statusText = "";
}
@@ -8581,13 +8846,14 @@ if ( xhrSupported ) {
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
+
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
- } catch( firefoxAccessException ) {
+ } catch ( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
@@ -8600,21 +8866,25 @@ if ( xhrSupported ) {
};
if ( !s.async ) {
+
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
+
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
+
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
+
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
@@ -8629,7 +8899,7 @@ if ( xhrSupported ) {
}
};
}
- });
+ } );
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
@@ -8637,7 +8907,7 @@ var fxNow, timerId,
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
- "*": [function( prop, value ) {
+ "*": [ function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
@@ -8647,17 +8917,19 @@ var fxNow, timerId,
maxIterations = 20;
if ( parts ) {
- end = +parts[2];
- unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ end = +parts[ 2 ];
+ unit = parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
+
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
+
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
@@ -8668,23 +8940,24 @@ var fxNow, timerId,
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
- } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ } while ( scale !== ( scale = tween.cur() / target ) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
+
// If a +=/-= token was provided, we're doing a relative animation
- tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+ tween.end = parts[ 1 ] ? start + ( parts[ 1 ] + 1 ) * end : end;
}
return tween;
- }]
+ } ]
};
// Animations created synchronously will run synchronously
function createFxNow() {
- setTimeout(function() {
+ setTimeout( function() {
fxNow = undefined;
- });
+ } );
return ( fxNow = jQuery.now() );
}
@@ -8700,7 +8973,7 @@ function createTweens( animation, props ) {
return;
}
}
- });
+ } );
}
function Animation( elem, properties, options ) {
@@ -8709,15 +8982,17 @@ function Animation( elem, properties, options ) {
index = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
+
// don't match elem in the :animated selector
delete tick.elem;
- }),
+ } ),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
@@ -8728,7 +9003,7 @@ function Animation( elem, properties, options ) {
animation.tweens[ index ].run( percent );
}
- deferred.notifyWith( elem, [ animation, percent, remaining ]);
+ deferred.notifyWith( elem, [ animation, percent, remaining ] );
if ( percent < 1 && length ) {
return remaining;
@@ -8737,7 +9012,7 @@ function Animation( elem, properties, options ) {
return false;
}
},
- animation = deferred.promise({
+ animation = deferred.promise( {
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
@@ -8754,6 +9029,7 @@ function Animation( elem, properties, options ) {
},
stop: function( gotoEnd ) {
var index = 0,
+
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
@@ -8774,7 +9050,7 @@ function Animation( elem, properties, options ) {
}
return this;
}
- }),
+ } ),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
@@ -8797,7 +9073,7 @@ function Animation( elem, properties, options ) {
elem: elem,
anim: animation,
queue: animation.opts.queue
- })
+ } )
);
// attach callbacks from options
@@ -8851,7 +9127,7 @@ jQuery.Animation = jQuery.extend( Animation, {
callback = props;
props = [ "*" ];
} else {
- props = props.split(" ");
+ props = props.split( " " );
}
var prop,
@@ -8872,7 +9148,7 @@ jQuery.Animation = jQuery.extend( Animation, {
animationPrefilters.push( callback );
}
}
-});
+} );
function defaultPrefilter( elem, props, opts ) {
/*jshint validthis:true */
@@ -8899,20 +9175,22 @@ function defaultPrefilter( elem, props, opts ) {
}
hooks.unqueued++;
- anim.always(function() {
+ anim.always( function() {
+
// doing this makes sure that the complete handler will be called
// before this completes
- anim.always(function() {
+ anim.always( function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
- });
- });
+ } );
+ } );
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
@@ -8938,15 +9216,14 @@ function defaultPrefilter( elem, props, opts ) {
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
- anim.always(function() {
+ anim.always( function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
- });
+ } );
}
}
-
// show/hide pass
for ( index in props ) {
value = props[ index ];
@@ -8974,17 +9251,17 @@ function defaultPrefilter( elem, props, opts ) {
if ( hidden ) {
jQuery( elem ).show();
} else {
- anim.done(function() {
+ anim.done( function() {
jQuery( elem ).hide();
- });
+ } );
}
- anim.done(function() {
+ anim.done( function() {
var prop;
jQuery._removeData( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
- });
+ } );
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
@@ -9058,7 +9335,7 @@ Tween.propHooks = {
var result;
if ( tween.elem[ tween.prop ] != null &&
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ ( !tween.elem.style || tween.elem.style[ tween.prop ] == null ) ) {
return tween.elem[ tween.prop ];
}
@@ -9067,10 +9344,12 @@ Tween.propHooks = {
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, "" );
+
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
+
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
@@ -9095,33 +9374,35 @@ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
}
};
-jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
- .end().animate({ opacity: to }, speed, easing, callback );
+ .end().animate( { opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
+
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
doAnimation.finish = function() {
anim.stop( true );
};
+
// Empty animations, or finishing resolves immediately
if ( empty || jQuery._data( this, "finish" ) ) {
anim.stop( true );
@@ -9149,7 +9430,7 @@ jQuery.fn.extend({
this.queue( type || "fx", [] );
}
- return this.each(function() {
+ return this.each( function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
@@ -9168,7 +9449,7 @@ jQuery.fn.extend({
}
for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ if ( timers[ index ].elem === this && ( type == null || timers[ index ].queue === type ) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
@@ -9181,13 +9462,13 @@ jQuery.fn.extend({
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
- });
+ } );
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
- return this.each(function() {
+ return this.each( function() {
var index,
data = jQuery._data( this ),
queue = data[ type + "queue" ],
@@ -9222,9 +9503,9 @@ jQuery.fn.extend({
// turn off finishing flag
delete data.finish;
- });
+ } );
}
-});
+} );
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
@@ -9234,8 +9515,8 @@ function genFx( type, includeWidth ) {
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
- includeWidth = includeWidth? 1 : 0;
- for( ; i < 4 ; i += 2 - includeWidth ) {
+ includeWidth = includeWidth ? 1 : 0;
+ for ( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
@@ -9248,10 +9529,10 @@ function genFx( type, includeWidth ) {
}
// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx("show"),
- slideUp: genFx("hide"),
- slideToggle: genFx("toggle"),
+jQuery.each( {
+ slideDown: genFx( "show" ),
+ slideUp: genFx( "hide" ),
+ slideToggle: genFx( "toggle" ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
@@ -9259,7 +9540,7 @@ jQuery.each({
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
-});
+} );
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
@@ -9298,7 +9579,7 @@ jQuery.easing = {
return p;
},
swing: function( p ) {
- return 0.5 - Math.cos( p*Math.PI ) / 2;
+ return 0.5 - Math.cos( p * Math.PI ) / 2;
}
};
@@ -9313,6 +9594,7 @@ jQuery.fx.tick = function() {
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
+
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
@@ -9347,6 +9629,7 @@ jQuery.fx.stop = function() {
jQuery.fx.speeds = {
slow: 600,
fast: 200,
+
// Default speed
_default: 400
};
@@ -9356,18 +9639,18 @@ jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
+ return jQuery.grep( jQuery.timers, function( fn ) {
return elem === fn.elem;
- }).length;
+ } ).length;
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
- this.each(function( i ) {
+ this.each( function( i ) {
jQuery.offset.setOffset( this, options, i );
- });
+ } );
}
var docElem, win,
@@ -9412,7 +9695,7 @@ jQuery.offset = {
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
@@ -9444,8 +9727,7 @@ jQuery.offset = {
}
};
-
-jQuery.fn.extend({
+jQuery.fn.extend( {
position: function() {
if ( !this[ 0 ] ) {
@@ -9458,9 +9740,11 @@ jQuery.fn.extend({
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
+
// we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
+
// Get *real* offsetParent
offsetParent = this.offsetParent();
@@ -9480,24 +9764,23 @@ jQuery.fn.extend({
// are the same in Safari causing offset.left to incorrectly be 0
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
};
},
offsetParent: function() {
- return this.map(function() {
+ return this.map( function() {
var offsetParent = this.offsetParent || document.documentElement;
- while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.documentElement;
- });
+ } );
}
-});
-
+} );
// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
@@ -9505,7 +9788,7 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me
var win = getWindow( elem );
if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
+ return win ? ( prop in win ) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
@@ -9521,7 +9804,7 @@ jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( me
}
}, method, val, arguments.length, null );
};
-});
+} );
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
@@ -9530,9 +9813,11 @@ function getWindow( elem ) {
elem.defaultView || elem.parentWindow :
false;
}
+
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
@@ -9542,6 +9827,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
+
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
@@ -9562,6 +9848,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
}
return value === undefined ?
+
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
@@ -9569,8 +9856,9 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
- });
-});
+ } );
+} );
+
// Limit scope pollution from any deprecated API
// (function() {
@@ -9591,7 +9879,7 @@ window.jQuery = window.$ = jQuery;
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
+ define( "jquery", [], function() { return jQuery; } );
}
-})( window );
+} )( window );
diff --git a/test/data/readywaitloader.js b/test/data/readywaitloader.js
index e07dac7a9..8f4a3452e 100644
--- a/test/data/readywaitloader.js
+++ b/test/data/readywaitloader.js
@@ -1,19 +1,19 @@
// Simple script loader that uses jQuery.readyWait via jQuery.holdReady()
//Hold on jQuery!
-jQuery.holdReady(true);
+jQuery.holdReady( true );
var readyRegExp = /^(complete|loaded)$/;
-function assetLoaded( evt ){
+function assetLoaded( evt ) {
var node = evt.currentTarget || evt.srcElement;
- if ( evt.type === "load" || readyRegExp.test(node.readyState) ) {
- jQuery.holdReady(false);
+ if ( evt.type === "load" || readyRegExp.test( node.readyState ) ) {
+ jQuery.holdReady( false );
}
}
setTimeout( function() {
- var script = document.createElement("script");
+ var script = document.createElement( "script" );
script.type = "text/javascript";
if ( script.addEventListener ) {
script.addEventListener( "load", assetLoaded, false );
@@ -21,5 +21,5 @@ setTimeout( function() {
script.attachEvent( "onreadystatechange", assetLoaded );
}
script.src = "data/readywaitasset.js";
- document.getElementsByTagName("head")[0].appendChild(script);
+ document.getElementsByTagName( "head" )[ 0 ].appendChild( script );
}, 2000 );
diff --git a/test/data/testinit.js b/test/data/testinit.js
index 0dcb4f871..491440e19 100644
--- a/test/data/testinit.js
+++ b/test/data/testinit.js
@@ -3,6 +3,7 @@
var fireNative, originaljQuery, original$,
baseURL = "",
supportjQuery = this.jQuery,
+
// see RFC 2606
externalHost = "example.com";
@@ -24,7 +25,7 @@ this.q = function() {
i = 0;
for ( ; i < arguments.length; i++ ) {
- r.push( document.getElementById( arguments[i] ) );
+ r.push( document.getElementById( arguments[ i ] ) );
}
return r;
};
@@ -62,7 +63,7 @@ this.createDashboardXML = function() {
</locations> \
</dashboard>';
- return jQuery.parseXML(string);
+ return jQuery.parseXML( string );
};
this.createWithFriesXML = function() {
@@ -131,7 +132,7 @@ fireNative = document.createEvent ?
* @result "data/test.php?foo=bar&10538358345554"
*/
function url( value ) {
- return baseURL + value + (/\?/.test( value ) ? "&" : "?") +
+ return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 );
}
@@ -166,7 +167,7 @@ this.ajaxTest = function( title, expect, options ) {
}
// Make sure all events will be called before done()
- setTimeout(done);
+ setTimeout( done );
}
},
requests = jQuery.map( requestOptions, function( options ) {
@@ -192,7 +193,7 @@ this.ajaxTest = function( title, expect, options ) {
.done( callIfDefined( "done", "success" ) )
.fail( callIfDefined( "fail", "error" ) )
.always( complete );
- });
+ } );
ajaxTest.abort = function( reason ) {
if ( !completed ) {
@@ -201,20 +202,20 @@ this.ajaxTest = function( title, expect, options ) {
ok( false, "aborted " + reason );
jQuery.each( requests, function( i, request ) {
request.abort();
- });
+ } );
}
};
- });
+ } );
};
this.testIframe = function( fileName, name, fn ) {
- QUnit.test(name, function( assert ) {
+ QUnit.test( name, function( assert ) {
var done = assert.async();
// load fixture in iframe
var iframe = loadFixture(),
win = iframe.contentWindow,
- interval = setInterval(function() {
+ interval = setInterval( function() {
if ( win && win.jQuery && win.jQuery.isReady ) {
clearInterval( interval );
@@ -225,7 +226,7 @@ this.testIframe = function( fileName, name, fn ) {
iframe = null;
}
}, 15 );
- });
+ } );
function loadFixture() {
var src = url( "./data/" + fileName + ".html" ),
@@ -248,7 +249,7 @@ this.testIframeWithCallback = function( title, fileName, func ) {
args.push( assert );
- setTimeout(function() {
+ setTimeout( function() {
this.iframeCallback = undefined;
iframe.remove();
@@ -256,12 +257,12 @@ this.testIframeWithCallback = function( title, fileName, func ) {
func = function() {};
done();
- });
+ } );
};
- iframe = jQuery( "<div/>" ).css({ position: "absolute", width: "500px", left: "-600px" })
+ iframe = jQuery( "<div/>" ).css( { position: "absolute", width: "500px", left: "-600px" } )
.append( jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) ) )
.appendTo( "#qunit-fixture" );
- });
+ } );
};
this.iframeCallback = undefined;
@@ -275,7 +276,7 @@ this.loadTests = function() {
loadSwarm = url && url.indexOf( "http" ) === 0;
// Get testSubproject from testrunner first
- require([ "data/testrunner.js" ], function() {
+ require( [ "data/testrunner.js" ], function() {
var tests = [
"unit/core.js",
"unit/callbacks.js",
@@ -300,7 +301,7 @@ this.loadTests = function() {
];
// Ensure load order (to preserve test numbers)
- (function loadDep() {
+ ( function loadDep() {
var dep = tests.shift();
if ( dep ) {
@@ -318,14 +319,14 @@ this.loadTests = function() {
// Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) {
- require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ],
+ require( [ "http://swarm.jquery.org/js/inject.js?" + ( new Date() ).getTime() ],
function() {
QUnit.start();
- });
+ } );
} else {
QUnit.start();
}
}
- })();
- });
+ } )();
+ } );
};
diff --git a/test/data/testrunner.js b/test/data/testrunner.js
index 3701870ad..454e8035e 100644
--- a/test/data/testrunner.js
+++ b/test/data/testrunner.js
@@ -1,4 +1,4 @@
-(function() {
+( function() {
// Store the old counts so that we only assert on tests that have actually leaked,
// instead of asserting every time a test has leaked sometime in the past
@@ -49,6 +49,7 @@ QUnit.expectJqData = function( env, elems, key ) {
// be available as long as the object is not garbage collected by
// the js engine, and when it is, the data will be removed with it.
if ( !elem.nodeType ) {
+
// Fixes false positives for dataTests(window), dataTests({}).
continue;
}
@@ -56,6 +57,7 @@ QUnit.expectJqData = function( env, elems, key ) {
expando = elem[ jQuery.expando ];
if ( expando === undefined ) {
+
// In this case the element exists fine, but
// jQuery.data (or internal data) was never (in)directly
// called.
@@ -79,12 +81,12 @@ QUnit.expectJqData = function( env, elems, key ) {
}
};
-QUnit.config.urlConfig.push({
+QUnit.config.urlConfig.push( {
id: "jqdata",
label: "Always check jQuery.data",
tooltip: "Trigger QUnit.expectJqData detection for all tests " +
"instead of just the ones that call it"
-});
+} );
/**
* Ensures that tests have cleaned up properly after themselves. Should be passed as the
@@ -106,6 +108,7 @@ window.moduleTeardown = function() {
delete jQuery.cache[ i ];
delete expectedDataKeys[ i ];
}
+
// In case it was removed from cache before (or never there in the first place)
for ( i in expectedDataKeys ) {
deepEqual(
@@ -129,7 +132,7 @@ window.moduleTeardown = function() {
if ( jQuery.active !== undefined && jQuery.active !== oldActive ) {
equal( jQuery.active, oldActive, "No AJAX requests are still active" );
if ( ajaxTest.abort ) {
- ajaxTest.abort("active requests");
+ ajaxTest.abort( "active requests" );
}
oldActive = jQuery.active;
}
@@ -150,15 +153,17 @@ window.moduleTeardown = function() {
}
};
-QUnit.done(function() {
+QUnit.done( function() {
+
// Remove our own fixtures outside #qunit-fixture
supportjQuery( "#qunit ~ *" ).remove();
-});
+} );
-QUnit.testDone(function() {
+QUnit.testDone( function() {
// Ensure jQuery events and data on the fixture are properly removed
jQuery( "#qunit-fixture" ).empty();
+
// ...even if the jQuery under test has a broken .empty()
supportjQuery( "#qunit-fixture" ).empty();
@@ -172,10 +177,10 @@ QUnit.testDone(function() {
// Cleanup globals
Globals.cleanup();
-});
+} );
// Register globals for cleanup and the cleanup code itself
-window.Globals = (function() {
+window.Globals = ( function() {
var globals = {};
return {
@@ -193,6 +198,6 @@ window.Globals = (function() {
globals = {};
}
};
-})();
+} )();
-})();
+} )();