Version Description
- Bug fix: Edit media functionality.
Download this release
Release Info
Developer | brainstormforce |
Plugin | All In One Schema Rich Snippets |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- index.php +1 -1
- js/jquery.js +1524 -1
- js/media.js +29 -25
- readme.txt +1 -29
index.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.brainstormforce.com
|
|
5 |
Author: Brainstorm Force
|
6 |
Author URI: http://www.brainstormforce.com
|
7 |
Description: The All in One Rich Snippets gives the power to the blog author to control the rich snippets to be shown in the search results by the search engines.
|
8 |
-
Version: 1.1.
|
9 |
Text Domain: rich-snippets
|
10 |
License: GPL2
|
11 |
*/
|
5 |
Author: Brainstorm Force
|
6 |
Author URI: http://www.brainstormforce.com
|
7 |
Description: The All in One Rich Snippets gives the power to the blog author to control the rich snippets to be shown in the search results by the search engines.
|
8 |
+
Version: 1.1.2
|
9 |
Text Domain: rich-snippets
|
10 |
License: GPL2
|
11 |
*/
|
js/jquery.js
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
* Date: 2013-2-4
|
13 |
*/
|
14 |
(function( window, undefined ) {
|
|
|
15 |
// Can't do this because several apps including ASP.NET trace
|
16 |
// the stack via arguments.caller.callee and Firefox dies if
|
17 |
// you try to trace through "use strict" call chains. (#13335)
|
@@ -20,23 +21,32 @@
|
|
20 |
var
|
21 |
// The deferred used on DOM ready
|
22 |
readyList,
|
|
|
23 |
// A central reference to the root jQuery(document)
|
24 |
rootjQuery,
|
|
|
25 |
// Support: IE<9
|
26 |
// For `typeof node.method` instead of `node.method !== undefined`
|
27 |
core_strundefined = typeof undefined,
|
|
|
28 |
// Use the correct document accordingly with window argument (sandbox)
|
29 |
document = window.document,
|
30 |
location = window.location,
|
|
|
31 |
// Map over jQuery in case of overwrite
|
32 |
_jQuery = window.jQuery,
|
|
|
33 |
// Map over the $ in case of overwrite
|
34 |
_$ = window.$,
|
|
|
35 |
// [[Class]] -> type pairs
|
36 |
class2type = {},
|
|
|
37 |
// List of deleted data cache ids, so we can reuse them
|
38 |
core_deletedIds = [],
|
|
|
39 |
core_version = "1.9.1",
|
|
|
40 |
// Save a reference to some core methods
|
41 |
core_concat = core_deletedIds.concat,
|
42 |
core_push = core_deletedIds.push,
|
@@ -45,37 +55,48 @@ var
|
|
45 |
core_toString = class2type.toString,
|
46 |
core_hasOwn = class2type.hasOwnProperty,
|
47 |
core_trim = core_version.trim,
|
|
|
48 |
// Define a local copy of jQuery
|
49 |
jQuery = function( selector, context ) {
|
50 |
// The jQuery object is actually just the init constructor 'enhanced'
|
51 |
return new jQuery.fn.init( selector, context, rootjQuery );
|
52 |
},
|
|
|
53 |
// Used for matching numbers
|
54 |
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
|
|
|
55 |
// Used for splitting on whitespace
|
56 |
core_rnotwhite = /\S+/g,
|
|
|
57 |
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
|
58 |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
|
59 |
// A simple way to check for HTML strings
|
60 |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
61 |
// Strict HTML recognition (#11290: must start with <)
|
62 |
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
|
|
|
63 |
// Match a standalone tag
|
64 |
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
|
|
|
65 |
// JSON RegExp
|
66 |
rvalidchars = /^[\],:{}\s]*$/,
|
67 |
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
68 |
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
|
69 |
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
|
|
|
70 |
// Matches dashed string for camelizing
|
71 |
rmsPrefix = /^-ms-/,
|
72 |
rdashAlpha = /-([\da-z])/gi,
|
|
|
73 |
// Used by jQuery.camelCase as callback to replace()
|
74 |
fcamelCase = function( all, letter ) {
|
75 |
return letter.toUpperCase();
|
76 |
},
|
|
|
77 |
// The ready event handler
|
78 |
completed = function( event ) {
|
|
|
79 |
// readyState === "complete" is good enough for us to call the dom ready in oldIE
|
80 |
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
|
81 |
detach();
|
@@ -87,56 +108,70 @@ var
|
|
87 |
if ( document.addEventListener ) {
|
88 |
document.removeEventListener( "DOMContentLoaded", completed, false );
|
89 |
window.removeEventListener( "load", completed, false );
|
|
|
90 |
} else {
|
91 |
document.detachEvent( "onreadystatechange", completed );
|
92 |
window.detachEvent( "onload", completed );
|
93 |
}
|
94 |
};
|
|
|
95 |
jQuery.fn = jQuery.prototype = {
|
96 |
// The current version of jQuery being used
|
97 |
jquery: core_version,
|
|
|
98 |
constructor: jQuery,
|
99 |
init: function( selector, context, rootjQuery ) {
|
100 |
var match, elem;
|
|
|
101 |
// HANDLE: $(""), $(null), $(undefined), $(false)
|
102 |
if ( !selector ) {
|
103 |
return this;
|
104 |
}
|
|
|
105 |
// Handle HTML strings
|
106 |
if ( typeof selector === "string" ) {
|
107 |
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
|
108 |
// Assume that strings that start and end with <> are HTML and skip the regex check
|
109 |
match = [ null, selector, null ];
|
|
|
110 |
} else {
|
111 |
match = rquickExpr.exec( selector );
|
112 |
}
|
|
|
113 |
// Match html or make sure no context is specified for #id
|
114 |
if ( match && (match[1] || !context) ) {
|
|
|
115 |
// HANDLE: $(html) -> $(array)
|
116 |
if ( match[1] ) {
|
117 |
context = context instanceof jQuery ? context[0] : context;
|
|
|
118 |
// scripts is true for back-compat
|
119 |
jQuery.merge( this, jQuery.parseHTML(
|
120 |
match[1],
|
121 |
context && context.nodeType ? context.ownerDocument || context : document,
|
122 |
true
|
123 |
) );
|
|
|
124 |
// HANDLE: $(html, props)
|
125 |
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
|
126 |
for ( match in context ) {
|
127 |
// Properties of context are called as methods if possible
|
128 |
if ( jQuery.isFunction( this[ match ] ) ) {
|
129 |
this[ match ]( context[ match ] );
|
|
|
130 |
// ...and otherwise set as attributes
|
131 |
} else {
|
132 |
this.attr( match, context[ match ] );
|
133 |
}
|
134 |
}
|
135 |
}
|
|
|
136 |
return this;
|
|
|
137 |
// HANDLE: $(#id)
|
138 |
} else {
|
139 |
elem = document.getElementById( match[2] );
|
|
|
140 |
// Check parentNode to catch when Blackberry 4.6 returns
|
141 |
// nodes that are no longer in the document #6963
|
142 |
if ( elem && elem.parentNode ) {
|
@@ -145,116 +180,148 @@ jQuery.fn = jQuery.prototype = {
|
|
145 |
if ( elem.id !== match[2] ) {
|
146 |
return rootjQuery.find( selector );
|
147 |
}
|
|
|
148 |
// Otherwise, we inject the element directly into the jQuery object
|
149 |
this.length = 1;
|
150 |
this[0] = elem;
|
151 |
}
|
|
|
152 |
this.context = document;
|
153 |
this.selector = selector;
|
154 |
return this;
|
155 |
}
|
|
|
156 |
// HANDLE: $(expr, $(...))
|
157 |
} else if ( !context || context.jquery ) {
|
158 |
return ( context || rootjQuery ).find( selector );
|
|
|
159 |
// HANDLE: $(expr, context)
|
160 |
// (which is just equivalent to: $(context).find(expr)
|
161 |
} else {
|
162 |
return this.constructor( context ).find( selector );
|
163 |
}
|
|
|
164 |
// HANDLE: $(DOMElement)
|
165 |
} else if ( selector.nodeType ) {
|
166 |
this.context = this[0] = selector;
|
167 |
this.length = 1;
|
168 |
return this;
|
|
|
169 |
// HANDLE: $(function)
|
170 |
// Shortcut for document ready
|
171 |
} else if ( jQuery.isFunction( selector ) ) {
|
172 |
return rootjQuery.ready( selector );
|
173 |
}
|
|
|
174 |
if ( selector.selector !== undefined ) {
|
175 |
this.selector = selector.selector;
|
176 |
this.context = selector.context;
|
177 |
}
|
|
|
178 |
return jQuery.makeArray( selector, this );
|
179 |
},
|
|
|
180 |
// Start with an empty selector
|
181 |
selector: "",
|
|
|
182 |
// The default length of a jQuery object is 0
|
183 |
length: 0,
|
|
|
184 |
// The number of elements contained in the matched element set
|
185 |
size: function() {
|
186 |
return this.length;
|
187 |
},
|
|
|
188 |
toArray: function() {
|
189 |
return core_slice.call( this );
|
190 |
},
|
|
|
191 |
// Get the Nth element in the matched element set OR
|
192 |
// Get the whole matched element set as a clean array
|
193 |
get: function( num ) {
|
194 |
return num == null ?
|
|
|
195 |
// Return a 'clean' array
|
196 |
this.toArray() :
|
|
|
197 |
// Return just the object
|
198 |
( num < 0 ? this[ this.length + num ] : this[ num ] );
|
199 |
},
|
|
|
200 |
// Take an array of elements and push it onto the stack
|
201 |
// (returning the new matched element set)
|
202 |
pushStack: function( elems ) {
|
|
|
203 |
// Build a new jQuery matched element set
|
204 |
var ret = jQuery.merge( this.constructor(), elems );
|
|
|
205 |
// Add the old object onto the stack (as a reference)
|
206 |
ret.prevObject = this;
|
207 |
ret.context = this.context;
|
|
|
208 |
// Return the newly-formed element set
|
209 |
return ret;
|
210 |
},
|
|
|
211 |
// Execute a callback for every element in the matched set.
|
212 |
// (You can seed the arguments with an array of args, but this is
|
213 |
// only used internally.)
|
214 |
each: function( callback, args ) {
|
215 |
return jQuery.each( this, callback, args );
|
216 |
},
|
|
|
217 |
ready: function( fn ) {
|
218 |
// Add the callback
|
219 |
jQuery.ready.promise().done( fn );
|
|
|
220 |
return this;
|
221 |
},
|
|
|
222 |
slice: function() {
|
223 |
return this.pushStack( core_slice.apply( this, arguments ) );
|
224 |
},
|
|
|
225 |
first: function() {
|
226 |
return this.eq( 0 );
|
227 |
},
|
|
|
228 |
last: function() {
|
229 |
return this.eq( -1 );
|
230 |
},
|
|
|
231 |
eq: function( i ) {
|
232 |
var len = this.length,
|
233 |
j = +i + ( i < 0 ? len : 0 );
|
234 |
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
|
235 |
},
|
|
|
236 |
map: function( callback ) {
|
237 |
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
238 |
return callback.call( elem, i, elem );
|
239 |
}));
|
240 |
},
|
|
|
241 |
end: function() {
|
242 |
return this.prevObject || this.constructor(null);
|
243 |
},
|
|
|
244 |
// For internal use only.
|
245 |
// Behaves like an Array's method, not like a jQuery method.
|
246 |
push: core_push,
|
247 |
sort: [].sort,
|
248 |
splice: [].splice
|
249 |
};
|
|
|
250 |
// Give the init function the jQuery prototype for later instantiation
|
251 |
jQuery.fn.init.prototype = jQuery.fn;
|
|
|
252 |
jQuery.extend = jQuery.fn.extend = function() {
|
253 |
var src, copyIsArray, copy, name, options, clone,
|
254 |
target = arguments[0] || {},
|
255 |
i = 1,
|
256 |
length = arguments.length,
|
257 |
deep = false;
|
|
|
258 |
// Handle a deep copy situation
|
259 |
if ( typeof target === "boolean" ) {
|
260 |
deep = target;
|
@@ -262,15 +329,18 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
262 |
// skip the boolean and the target
|
263 |
i = 2;
|
264 |
}
|
|
|
265 |
// Handle case when target is a string or something (possible in deep copy)
|
266 |
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
267 |
target = {};
|
268 |
}
|
|
|
269 |
// extend jQuery itself if only one argument is passed
|
270 |
if ( length === i ) {
|
271 |
target = this;
|
272 |
--i;
|
273 |
}
|
|
|
274 |
for ( ; i < length; i++ ) {
|
275 |
// Only deal with non-null/undefined values
|
276 |
if ( (options = arguments[ i ]) != null ) {
|
@@ -278,20 +348,25 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
278 |
for ( name in options ) {
|
279 |
src = target[ name ];
|
280 |
copy = options[ name ];
|
|
|
281 |
// Prevent never-ending loop
|
282 |
if ( target === copy ) {
|
283 |
continue;
|
284 |
}
|
|
|
285 |
// Recurse if we're merging plain objects or arrays
|
286 |
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
287 |
if ( copyIsArray ) {
|
288 |
copyIsArray = false;
|
289 |
clone = src && jQuery.isArray(src) ? src : [];
|
|
|
290 |
} else {
|
291 |
clone = src && jQuery.isPlainObject(src) ? src : {};
|
292 |
}
|
|
|
293 |
// Never move original objects, clone them
|
294 |
target[ name ] = jQuery.extend( deep, clone, copy );
|
|
|
295 |
// Don't bring in undefined values
|
296 |
} else if ( copy !== undefined ) {
|
297 |
target[ name ] = copy;
|
@@ -299,24 +374,31 @@ jQuery.extend = jQuery.fn.extend = function() {
|
|
299 |
}
|
300 |
}
|
301 |
}
|
|
|
302 |
// Return the modified object
|
303 |
return target;
|
304 |
};
|
|
|
305 |
jQuery.extend({
|
306 |
noConflict: function( deep ) {
|
307 |
if ( window.$ === jQuery ) {
|
308 |
window.$ = _$;
|
309 |
}
|
|
|
310 |
if ( deep && window.jQuery === jQuery ) {
|
311 |
window.jQuery = _jQuery;
|
312 |
}
|
|
|
313 |
return jQuery;
|
314 |
},
|
|
|
315 |
// Is the DOM ready to be used? Set to true once it occurs.
|
316 |
isReady: false,
|
|
|
317 |
// A counter to track how many items to wait for before
|
318 |
// the ready event fires. See #6781
|
319 |
readyWait: 1,
|
|
|
320 |
// Hold (or release) the ready event
|
321 |
holdReady: function( hold ) {
|
322 |
if ( hold ) {
|
@@ -325,44 +407,56 @@ jQuery.extend({
|
|
325 |
jQuery.ready( true );
|
326 |
}
|
327 |
},
|
|
|
328 |
// Handle when the DOM is ready
|
329 |
ready: function( wait ) {
|
|
|
330 |
// Abort if there are pending holds or we're already ready
|
331 |
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
332 |
return;
|
333 |
}
|
|
|
334 |
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
335 |
if ( !document.body ) {
|
336 |
return setTimeout( jQuery.ready );
|
337 |
}
|
|
|
338 |
// Remember that the DOM is ready
|
339 |
jQuery.isReady = true;
|
|
|
340 |
// If a normal DOM Ready event fired, decrement, and wait if need be
|
341 |
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
342 |
return;
|
343 |
}
|
|
|
344 |
// If there are functions bound, to execute
|
345 |
readyList.resolveWith( document, [ jQuery ] );
|
|
|
346 |
// Trigger any bound ready events
|
347 |
if ( jQuery.fn.trigger ) {
|
348 |
jQuery( document ).trigger("ready").off("ready");
|
349 |
}
|
350 |
},
|
|
|
351 |
// See test/unit/core.js for details concerning isFunction.
|
352 |
// Since version 1.3, DOM methods and functions like alert
|
353 |
// aren't supported. They return false on IE (#2968).
|
354 |
isFunction: function( obj ) {
|
355 |
return jQuery.type(obj) === "function";
|
356 |
},
|
|
|
357 |
isArray: Array.isArray || function( obj ) {
|
358 |
return jQuery.type(obj) === "array";
|
359 |
},
|
|
|
360 |
isWindow: function( obj ) {
|
361 |
return obj != null && obj == obj.window;
|
362 |
},
|
|
|
363 |
isNumeric: function( obj ) {
|
364 |
return !isNaN( parseFloat(obj) ) && isFinite( obj );
|
365 |
},
|
|
|
366 |
type: function( obj ) {
|
367 |
if ( obj == null ) {
|
368 |
return String( obj );
|
@@ -371,6 +465,7 @@ jQuery.extend({
|
|
371 |
class2type[ core_toString.call(obj) ] || "object" :
|
372 |
typeof obj;
|
373 |
},
|
|
|
374 |
isPlainObject: function( obj ) {
|
375 |
// Must be an Object.
|
376 |
// Because of IE, we also have to check the presence of the constructor property.
|
@@ -378,6 +473,7 @@ jQuery.extend({
|
|
378 |
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
379 |
return false;
|
380 |
}
|
|
|
381 |
try {
|
382 |
// Not own constructor property must be Object
|
383 |
if ( obj.constructor &&
|
@@ -389,12 +485,16 @@ jQuery.extend({
|
|
389 |
// IE8,9 Will throw exceptions on certain host objects #9897
|
390 |
return false;
|
391 |
}
|
|
|
392 |
// Own properties are enumerated firstly, so to speed up,
|
393 |
// if last one is own, then all properties are own.
|
|
|
394 |
var key;
|
395 |
for ( key in obj ) {}
|
|
|
396 |
return key === undefined || core_hasOwn.call( obj, key );
|
397 |
},
|
|
|
398 |
isEmptyObject: function( obj ) {
|
399 |
var name;
|
400 |
for ( name in obj ) {
|
@@ -402,9 +502,11 @@ jQuery.extend({
|
|
402 |
}
|
403 |
return true;
|
404 |
},
|
|
|
405 |
error: function( msg ) {
|
406 |
throw new Error( msg );
|
407 |
},
|
|
|
408 |
// data: string of html
|
409 |
// context (optional): If specified, the fragment will be created in this context, defaults to document
|
410 |
// keepScripts (optional): If true, will include scripts passed in the html string
|
@@ -417,41 +519,52 @@ jQuery.extend({
|
|
417 |
context = false;
|
418 |
}
|
419 |
context = context || document;
|
|
|
420 |
var parsed = rsingleTag.exec( data ),
|
421 |
scripts = !keepScripts && [];
|
|
|
422 |
// Single tag
|
423 |
if ( parsed ) {
|
424 |
return [ context.createElement( parsed[1] ) ];
|
425 |
}
|
|
|
426 |
parsed = jQuery.buildFragment( [ data ], context, scripts );
|
427 |
if ( scripts ) {
|
428 |
jQuery( scripts ).remove();
|
429 |
}
|
430 |
return jQuery.merge( [], parsed.childNodes );
|
431 |
},
|
|
|
432 |
parseJSON: function( data ) {
|
433 |
// Attempt to parse using the native JSON parser first
|
434 |
if ( window.JSON && window.JSON.parse ) {
|
435 |
return window.JSON.parse( data );
|
436 |
}
|
|
|
437 |
if ( data === null ) {
|
438 |
return data;
|
439 |
}
|
|
|
440 |
if ( typeof data === "string" ) {
|
|
|
441 |
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
442 |
data = jQuery.trim( data );
|
|
|
443 |
if ( data ) {
|
444 |
// Make sure the incoming data is actual JSON
|
445 |
// Logic borrowed from http://json.org/json2.js
|
446 |
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
|
447 |
.replace( rvalidtokens, "]" )
|
448 |
.replace( rvalidbraces, "")) ) {
|
|
|
449 |
return ( new Function( "return " + data ) )();
|
450 |
}
|
451 |
}
|
452 |
}
|
|
|
453 |
jQuery.error( "Invalid JSON: " + data );
|
454 |
},
|
|
|
455 |
// Cross-browser xml parsing
|
456 |
parseXML: function( data ) {
|
457 |
var xml, tmp;
|
@@ -475,7 +588,9 @@ jQuery.extend({
|
|
475 |
}
|
476 |
return xml;
|
477 |
},
|
|
|
478 |
noop: function() {},
|
|
|
479 |
// Evaluates a script in a global context
|
480 |
// Workarounds based on findings by Jim Driscoll
|
481 |
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
@@ -489,24 +604,29 @@ jQuery.extend({
|
|
489 |
} )( data );
|
490 |
}
|
491 |
},
|
|
|
492 |
// Convert dashed to camelCase; used by the css and data modules
|
493 |
// Microsoft forgot to hump their vendor prefix (#9572)
|
494 |
camelCase: function( string ) {
|
495 |
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
496 |
},
|
|
|
497 |
nodeName: function( elem, name ) {
|
498 |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
499 |
},
|
|
|
500 |
// args is for internal usage only
|
501 |
each: function( obj, callback, args ) {
|
502 |
var value,
|
503 |
i = 0,
|
504 |
length = obj.length,
|
505 |
isArray = isArraylike( obj );
|
|
|
506 |
if ( args ) {
|
507 |
if ( isArray ) {
|
508 |
for ( ; i < length; i++ ) {
|
509 |
value = callback.apply( obj[ i ], args );
|
|
|
510 |
if ( value === false ) {
|
511 |
break;
|
512 |
}
|
@@ -514,16 +634,19 @@ jQuery.extend({
|
|
514 |
} else {
|
515 |
for ( i in obj ) {
|
516 |
value = callback.apply( obj[ i ], args );
|
|
|
517 |
if ( value === false ) {
|
518 |
break;
|
519 |
}
|
520 |
}
|
521 |
}
|
|
|
522 |
// A special, fast, case for the most common use of each
|
523 |
} else {
|
524 |
if ( isArray ) {
|
525 |
for ( ; i < length; i++ ) {
|
526 |
value = callback.call( obj[ i ], i, obj[ i ] );
|
|
|
527 |
if ( value === false ) {
|
528 |
break;
|
529 |
}
|
@@ -531,14 +654,17 @@ jQuery.extend({
|
|
531 |
} else {
|
532 |
for ( i in obj ) {
|
533 |
value = callback.call( obj[ i ], i, obj[ i ] );
|
|
|
534 |
if ( value === false ) {
|
535 |
break;
|
536 |
}
|
537 |
}
|
538 |
}
|
539 |
}
|
|
|
540 |
return obj;
|
541 |
},
|
|
|
542 |
// Use native String.trim function wherever possible
|
543 |
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
|
544 |
function( text ) {
|
@@ -546,15 +672,18 @@ jQuery.extend({
|
|
546 |
"" :
|
547 |
core_trim.call( text );
|
548 |
} :
|
|
|
549 |
// Otherwise use our own trimming functionality
|
550 |
function( text ) {
|
551 |
return text == null ?
|
552 |
"" :
|
553 |
( text + "" ).replace( rtrim, "" );
|
554 |
},
|
|
|
555 |
// results is for internal usage only
|
556 |
makeArray: function( arr, results ) {
|
557 |
var ret = results || [];
|
|
|
558 |
if ( arr != null ) {
|
559 |
if ( isArraylike( Object(arr) ) ) {
|
560 |
jQuery.merge( ret,
|
@@ -565,16 +694,21 @@ jQuery.extend({
|
|
565 |
core_push.call( ret, arr );
|
566 |
}
|
567 |
}
|
|
|
568 |
return ret;
|
569 |
},
|
|
|
570 |
inArray: function( elem, arr, i ) {
|
571 |
var len;
|
|
|
572 |
if ( arr ) {
|
573 |
if ( core_indexOf ) {
|
574 |
return core_indexOf.call( arr, elem, i );
|
575 |
}
|
|
|
576 |
len = arr.length;
|
577 |
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
|
|
|
578 |
for ( ; i < len; i++ ) {
|
579 |
// Skip accessing in sparse arrays
|
580 |
if ( i in arr && arr[ i ] === elem ) {
|
@@ -582,12 +716,15 @@ jQuery.extend({
|
|
582 |
}
|
583 |
}
|
584 |
}
|
|
|
585 |
return -1;
|
586 |
},
|
|
|
587 |
merge: function( first, second ) {
|
588 |
var l = second.length,
|
589 |
i = first.length,
|
590 |
j = 0;
|
|
|
591 |
if ( typeof l === "number" ) {
|
592 |
for ( ; j < l; j++ ) {
|
593 |
first[ i++ ] = second[ j ];
|
@@ -597,15 +734,19 @@ jQuery.extend({
|
|
597 |
first[ i++ ] = second[ j++ ];
|
598 |
}
|
599 |
}
|
|
|
600 |
first.length = i;
|
|
|
601 |
return first;
|
602 |
},
|
|
|
603 |
grep: function( elems, callback, inv ) {
|
604 |
var retVal,
|
605 |
ret = [],
|
606 |
i = 0,
|
607 |
length = elems.length;
|
608 |
inv = !!inv;
|
|
|
609 |
// Go through the array, only saving the items
|
610 |
// that pass the validator function
|
611 |
for ( ; i < length; i++ ) {
|
@@ -614,8 +755,10 @@ jQuery.extend({
|
|
614 |
ret.push( elems[ i ] );
|
615 |
}
|
616 |
}
|
|
|
617 |
return ret;
|
618 |
},
|
|
|
619 |
// arg is for internal usage only
|
620 |
map: function( elems, callback, arg ) {
|
621 |
var value,
|
@@ -623,74 +766,92 @@ jQuery.extend({
|
|
623 |
length = elems.length,
|
624 |
isArray = isArraylike( elems ),
|
625 |
ret = [];
|
|
|
626 |
// Go through the array, translating each of the items to their
|
627 |
if ( isArray ) {
|
628 |
for ( ; i < length; i++ ) {
|
629 |
value = callback( elems[ i ], i, arg );
|
|
|
630 |
if ( value != null ) {
|
631 |
ret[ ret.length ] = value;
|
632 |
}
|
633 |
}
|
|
|
634 |
// Go through every key on the object,
|
635 |
} else {
|
636 |
for ( i in elems ) {
|
637 |
value = callback( elems[ i ], i, arg );
|
|
|
638 |
if ( value != null ) {
|
639 |
ret[ ret.length ] = value;
|
640 |
}
|
641 |
}
|
642 |
}
|
|
|
643 |
// Flatten any nested arrays
|
644 |
return core_concat.apply( [], ret );
|
645 |
},
|
|
|
646 |
// A global GUID counter for objects
|
647 |
guid: 1,
|
|
|
648 |
// Bind a function to a context, optionally partially applying any
|
649 |
// arguments.
|
650 |
proxy: function( fn, context ) {
|
651 |
var args, proxy, tmp;
|
|
|
652 |
if ( typeof context === "string" ) {
|
653 |
tmp = fn[ context ];
|
654 |
context = fn;
|
655 |
fn = tmp;
|
656 |
}
|
|
|
657 |
// Quick check to determine if target is callable, in the spec
|
658 |
// this throws a TypeError, but we will just return undefined.
|
659 |
if ( !jQuery.isFunction( fn ) ) {
|
660 |
return undefined;
|
661 |
}
|
|
|
662 |
// Simulated bind
|
663 |
args = core_slice.call( arguments, 2 );
|
664 |
proxy = function() {
|
665 |
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
|
666 |
};
|
|
|
667 |
// Set the guid of unique handler to the same of original handler, so it can be removed
|
668 |
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
|
|
|
669 |
return proxy;
|
670 |
},
|
|
|
671 |
// Multifunctional method to get and set values of a collection
|
672 |
// The value/s can optionally be executed if it's a function
|
673 |
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
674 |
var i = 0,
|
675 |
length = elems.length,
|
676 |
bulk = key == null;
|
|
|
677 |
// Sets many values
|
678 |
if ( jQuery.type( key ) === "object" ) {
|
679 |
chainable = true;
|
680 |
for ( i in key ) {
|
681 |
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
|
682 |
}
|
|
|
683 |
// Sets one value
|
684 |
} else if ( value !== undefined ) {
|
685 |
chainable = true;
|
|
|
686 |
if ( !jQuery.isFunction( value ) ) {
|
687 |
raw = true;
|
688 |
}
|
|
|
689 |
if ( bulk ) {
|
690 |
// Bulk operations run against the entire set
|
691 |
if ( raw ) {
|
692 |
fn.call( elems, value );
|
693 |
fn = null;
|
|
|
694 |
// ...except when executing function values
|
695 |
} else {
|
696 |
bulk = fn;
|
@@ -699,53 +860,68 @@ jQuery.extend({
|
|
699 |
};
|
700 |
}
|
701 |
}
|
|
|
702 |
if ( fn ) {
|
703 |
for ( ; i < length; i++ ) {
|
704 |
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
|
705 |
}
|
706 |
}
|
707 |
}
|
|
|
708 |
return chainable ?
|
709 |
elems :
|
|
|
710 |
// Gets
|
711 |
bulk ?
|
712 |
fn.call( elems ) :
|
713 |
length ? fn( elems[0], key ) : emptyGet;
|
714 |
},
|
|
|
715 |
now: function() {
|
716 |
return ( new Date() ).getTime();
|
717 |
}
|
718 |
});
|
|
|
719 |
jQuery.ready.promise = function( obj ) {
|
720 |
if ( !readyList ) {
|
|
|
721 |
readyList = jQuery.Deferred();
|
|
|
722 |
// Catch cases where $(document).ready() is called after the browser event has already occurred.
|
723 |
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
724 |
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
725 |
if ( document.readyState === "complete" ) {
|
726 |
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
727 |
setTimeout( jQuery.ready );
|
|
|
728 |
// Standards-based browsers support DOMContentLoaded
|
729 |
} else if ( document.addEventListener ) {
|
730 |
// Use the handy event callback
|
731 |
document.addEventListener( "DOMContentLoaded", completed, false );
|
|
|
732 |
// A fallback to window.onload, that will always work
|
733 |
window.addEventListener( "load", completed, false );
|
|
|
734 |
// If IE event model is used
|
735 |
} else {
|
736 |
// Ensure firing before onload, maybe late but safe also for iframes
|
737 |
document.attachEvent( "onreadystatechange", completed );
|
|
|
738 |
// A fallback to window.onload, that will always work
|
739 |
window.attachEvent( "onload", completed );
|
|
|
740 |
// If IE and not a frame
|
741 |
// continually check to see if the document is ready
|
742 |
var top = false;
|
|
|
743 |
try {
|
744 |
top = window.frameElement == null && document.documentElement;
|
745 |
} catch(e) {}
|
|
|
746 |
if ( top && top.doScroll ) {
|
747 |
(function doScrollCheck() {
|
748 |
if ( !jQuery.isReady ) {
|
|
|
749 |
try {
|
750 |
// Use the trick by Diego Perini
|
751 |
// http://javascript.nwbox.com/IEContentLoaded/
|
@@ -753,8 +929,10 @@ jQuery.ready.promise = function( obj ) {
|
|
753 |
} catch(e) {
|
754 |
return setTimeout( doScrollCheck, 50 );
|
755 |
}
|
|
|
756 |
// detach all dom ready events
|
757 |
detach();
|
|
|
758 |
// and execute any waiting functions
|
759 |
jQuery.ready();
|
760 |
}
|
@@ -764,27 +942,34 @@ jQuery.ready.promise = function( obj ) {
|
|
764 |
}
|
765 |
return readyList.promise( obj );
|
766 |
};
|
|
|
767 |
// Populate the class2type map
|
768 |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
|
769 |
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
770 |
});
|
|
|
771 |
function isArraylike( obj ) {
|
772 |
var length = obj.length,
|
773 |
type = jQuery.type( obj );
|
|
|
774 |
if ( jQuery.isWindow( obj ) ) {
|
775 |
return false;
|
776 |
}
|
|
|
777 |
if ( obj.nodeType === 1 && length ) {
|
778 |
return true;
|
779 |
}
|
|
|
780 |
return type === "array" || type !== "function" &&
|
781 |
( length === 0 ||
|
782 |
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
|
783 |
}
|
|
|
784 |
// All jQuery objects should point back to these
|
785 |
rootjQuery = jQuery(document);
|
786 |
// String to Object options format cache
|
787 |
var optionsCache = {};
|
|
|
788 |
// Convert String-formatted options into Object-formatted ones and store in cache
|
789 |
function createOptions( options ) {
|
790 |
var object = optionsCache[ options ] = {};
|
@@ -793,6 +978,7 @@ function createOptions( options ) {
|
|
793 |
});
|
794 |
return object;
|
795 |
}
|
|
|
796 |
/*
|
797 |
* Create a callback list using the following parameters:
|
798 |
*
|
@@ -816,11 +1002,13 @@ function createOptions( options ) {
|
|
816 |
*
|
817 |
*/
|
818 |
jQuery.Callbacks = function( options ) {
|
|
|
819 |
// Convert options from String-formatted to Object-formatted if needed
|
820 |
// (we check in cache first)
|
821 |
options = typeof options === "string" ?
|
822 |
( optionsCache[ options ] || createOptions( options ) ) :
|
823 |
jQuery.extend( {}, options );
|
|
|
824 |
var // Flag to know if list is currently firing
|
825 |
firing,
|
826 |
// Last fire value (for non-forgettable lists)
|
@@ -972,9 +1160,11 @@ jQuery.Callbacks = function( options ) {
|
|
972 |
return !!fired;
|
973 |
}
|
974 |
};
|
|
|
975 |
return self;
|
976 |
};
|
977 |
jQuery.extend({
|
|
|
978 |
Deferred: function( func ) {
|
979 |
var tuples = [
|
980 |
// action, add listener, listener list, final state
|
@@ -1020,22 +1210,28 @@ jQuery.extend({
|
|
1020 |
}
|
1021 |
},
|
1022 |
deferred = {};
|
|
|
1023 |
// Keep pipe for back-compat
|
1024 |
promise.pipe = promise.then;
|
|
|
1025 |
// Add list-specific methods
|
1026 |
jQuery.each( tuples, function( i, tuple ) {
|
1027 |
var list = tuple[ 2 ],
|
1028 |
stateString = tuple[ 3 ];
|
|
|
1029 |
// promise[ done | fail | progress ] = list.add
|
1030 |
promise[ tuple[1] ] = list.add;
|
|
|
1031 |
// Handle state
|
1032 |
if ( stateString ) {
|
1033 |
list.add(function() {
|
1034 |
// state = [ resolved | rejected ]
|
1035 |
state = stateString;
|
|
|
1036 |
// [ reject_list | resolve_list ].disable; progress_list.lock
|
1037 |
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
|
1038 |
}
|
|
|
1039 |
// deferred[ resolve | reject | notify ]
|
1040 |
deferred[ tuple[0] ] = function() {
|
1041 |
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
|
@@ -1043,24 +1239,31 @@ jQuery.extend({
|
|
1043 |
};
|
1044 |
deferred[ tuple[0] + "With" ] = list.fireWith;
|
1045 |
});
|
|
|
1046 |
// Make the deferred a promise
|
1047 |
promise.promise( deferred );
|
|
|
1048 |
// Call given func if any
|
1049 |
if ( func ) {
|
1050 |
func.call( deferred, deferred );
|
1051 |
}
|
|
|
1052 |
// All done!
|
1053 |
return deferred;
|
1054 |
},
|
|
|
1055 |
// Deferred helper
|
1056 |
when: function( subordinate /* , ..., subordinateN */ ) {
|
1057 |
var i = 0,
|
1058 |
resolveValues = core_slice.call( arguments ),
|
1059 |
length = resolveValues.length,
|
|
|
1060 |
// the count of uncompleted subordinates
|
1061 |
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
|
|
|
1062 |
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
|
1063 |
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
|
|
|
1064 |
// Update function for both resolve and progress values
|
1065 |
updateFunc = function( i, contexts, values ) {
|
1066 |
return function( value ) {
|
@@ -1073,7 +1276,9 @@ jQuery.extend({
|
|
1073 |
}
|
1074 |
};
|
1075 |
},
|
|
|
1076 |
progressValues, progressContexts, resolveContexts;
|
|
|
1077 |
// add listeners to Deferred subordinates; treat others as resolved
|
1078 |
if ( length > 1 ) {
|
1079 |
progressValues = new Array( length );
|
@@ -1090,68 +1295,90 @@ jQuery.extend({
|
|
1090 |
}
|
1091 |
}
|
1092 |
}
|
|
|
1093 |
// if we're not waiting on anything, resolve the master
|
1094 |
if ( !remaining ) {
|
1095 |
deferred.resolveWith( resolveContexts, resolveValues );
|
1096 |
}
|
|
|
1097 |
return deferred.promise();
|
1098 |
}
|
1099 |
});
|
1100 |
jQuery.support = (function() {
|
|
|
1101 |
var support, all, a,
|
1102 |
input, select, fragment,
|
1103 |
opt, eventName, isSupported, i,
|
1104 |
div = document.createElement("div");
|
|
|
1105 |
// Setup
|
1106 |
div.setAttribute( "className", "t" );
|
1107 |
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
|
|
1108 |
// Support tests won't run in some limited or non-browser environments
|
1109 |
all = div.getElementsByTagName("*");
|
1110 |
a = div.getElementsByTagName("a")[ 0 ];
|
1111 |
if ( !all || !a || !all.length ) {
|
1112 |
return {};
|
1113 |
}
|
|
|
1114 |
// First batch of tests
|
1115 |
select = document.createElement("select");
|
1116 |
opt = select.appendChild( document.createElement("option") );
|
1117 |
input = div.getElementsByTagName("input")[ 0 ];
|
|
|
1118 |
a.style.cssText = "top:1px;float:left;opacity:.5";
|
1119 |
support = {
|
1120 |
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
1121 |
getSetAttribute: div.className !== "t",
|
|
|
1122 |
// IE strips leading whitespace when .innerHTML is used
|
1123 |
leadingWhitespace: div.firstChild.nodeType === 3,
|
|
|
1124 |
// Make sure that tbody elements aren't automatically inserted
|
1125 |
// IE will insert them into empty tables
|
1126 |
tbody: !div.getElementsByTagName("tbody").length,
|
|
|
1127 |
// Make sure that link elements get serialized correctly by innerHTML
|
1128 |
// This requires a wrapper element in IE
|
1129 |
htmlSerialize: !!div.getElementsByTagName("link").length,
|
|
|
1130 |
// Get the style information from getAttribute
|
1131 |
// (IE uses .cssText instead)
|
1132 |
style: /top/.test( a.getAttribute("style") ),
|
|
|
1133 |
// Make sure that URLs aren't manipulated
|
1134 |
// (IE normalizes it by default)
|
1135 |
hrefNormalized: a.getAttribute("href") === "/a",
|
|
|
1136 |
// Make sure that element opacity exists
|
1137 |
// (IE uses filter instead)
|
1138 |
// Use a regex to work around a WebKit issue. See #5145
|
1139 |
opacity: /^0.5/.test( a.style.opacity ),
|
|
|
1140 |
// Verify style float existence
|
1141 |
// (IE uses styleFloat instead of cssFloat)
|
|
|
|
|
1142 |
cssFloat: !!a.style.cssFloat,
|
|
|
1143 |
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
1144 |
checkOn: !!input.value,
|
|
|
1145 |
// Make sure that a selected-by-default option has a working selected property.
|
1146 |
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
1147 |
optSelected: opt.selected,
|
|
|
1148 |
// Tests for enctype support on a form (#6743)
|
1149 |
enctype: !!document.createElement("form").enctype,
|
|
|
1150 |
// Makes sure cloning an html5 element does not cause problems
|
1151 |
// Where outerHTML is undefined, this still works
|
1152 |
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
|
|
|
1153 |
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
|
1154 |
boxModel: document.compatMode === "CSS1Compat",
|
|
|
1155 |
// Will be defined later
|
1156 |
deleteExpando: true,
|
1157 |
noCloneEvent: true,
|
@@ -1161,37 +1388,47 @@ jQuery.support = (function() {
|
|
1161 |
boxSizingReliable: true,
|
1162 |
pixelPosition: false
|
1163 |
};
|
|
|
1164 |
// Make sure checked status is properly cloned
|
1165 |
input.checked = true;
|
1166 |
support.noCloneChecked = input.cloneNode( true ).checked;
|
|
|
1167 |
// Make sure that the options inside disabled selects aren't marked as disabled
|
1168 |
// (WebKit marks them as disabled)
|
1169 |
select.disabled = true;
|
1170 |
support.optDisabled = !opt.disabled;
|
|
|
1171 |
// Support: IE<9
|
1172 |
try {
|
1173 |
delete div.test;
|
1174 |
} catch( e ) {
|
1175 |
support.deleteExpando = false;
|
1176 |
}
|
|
|
1177 |
// Check if we can trust getAttribute("value")
|
1178 |
input = document.createElement("input");
|
1179 |
input.setAttribute( "value", "" );
|
1180 |
support.input = input.getAttribute( "value" ) === "";
|
|
|
1181 |
// Check if an input maintains its value after becoming a radio
|
1182 |
input.value = "t";
|
1183 |
input.setAttribute( "type", "radio" );
|
1184 |
support.radioValue = input.value === "t";
|
|
|
1185 |
// #11217 - WebKit loses check when the name is after the checked attribute
|
1186 |
input.setAttribute( "checked", "t" );
|
1187 |
input.setAttribute( "name", "t" );
|
|
|
1188 |
fragment = document.createDocumentFragment();
|
1189 |
fragment.appendChild( input );
|
|
|
1190 |
// Check if a disconnected checkbox will retain its checked
|
1191 |
// value of true after appended to the DOM (IE6/7)
|
1192 |
support.appendChecked = input.checked;
|
|
|
1193 |
// WebKit doesn't clone checked state correctly in fragments
|
1194 |
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
|
|
1195 |
// Support: IE<9
|
1196 |
// Opera does not clone events (and typeof div.attachEvent === undefined).
|
1197 |
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
|
@@ -1199,29 +1436,38 @@ jQuery.support = (function() {
|
|
1199 |
div.attachEvent( "onclick", function() {
|
1200 |
support.noCloneEvent = false;
|
1201 |
});
|
|
|
1202 |
div.cloneNode( true ).click();
|
1203 |
}
|
|
|
1204 |
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
|
1205 |
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
|
1206 |
for ( i in { submit: true, change: true, focusin: true }) {
|
1207 |
div.setAttribute( eventName = "on" + i, "t" );
|
|
|
1208 |
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
|
1209 |
}
|
|
|
1210 |
div.style.backgroundClip = "content-box";
|
1211 |
div.cloneNode( true ).style.backgroundClip = "";
|
1212 |
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
|
|
1213 |
// Run tests that need a body at doc ready
|
1214 |
jQuery(function() {
|
1215 |
var container, marginDiv, tds,
|
1216 |
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
|
1217 |
body = document.getElementsByTagName("body")[0];
|
|
|
1218 |
if ( !body ) {
|
1219 |
// Return for frameset docs that don't have a body
|
1220 |
return;
|
1221 |
}
|
|
|
1222 |
container = document.createElement("div");
|
1223 |
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
|
|
|
1224 |
body.appendChild( container ).appendChild( div );
|
|
|
1225 |
// Support: IE8
|
1226 |
// Check if table cells still have offsetWidth/Height when they are set
|
1227 |
// to display:none and there are still other visible table cells in a
|
@@ -1233,20 +1479,25 @@ jQuery.support = (function() {
|
|
1233 |
tds = div.getElementsByTagName("td");
|
1234 |
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
|
1235 |
isSupported = ( tds[ 0 ].offsetHeight === 0 );
|
|
|
1236 |
tds[ 0 ].style.display = "";
|
1237 |
tds[ 1 ].style.display = "none";
|
|
|
1238 |
// Support: IE8
|
1239 |
// Check if empty table cells still have offsetWidth/Height
|
1240 |
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
|
|
1241 |
// Check box-sizing and margin behavior
|
1242 |
div.innerHTML = "";
|
1243 |
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
|
1244 |
support.boxSizing = ( div.offsetWidth === 4 );
|
1245 |
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
|
|
|
1246 |
// Use window.getComputedStyle because jsdom on node.js will break without it.
|
1247 |
if ( window.getComputedStyle ) {
|
1248 |
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
|
1249 |
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
|
|
|
1250 |
// Check if div with explicit width and no margin-right incorrectly
|
1251 |
// gets computed margin-right based on width of container. (#3333)
|
1252 |
// Fails in WebKit before Feb 2011 nightlies
|
@@ -1255,9 +1506,11 @@ jQuery.support = (function() {
|
|
1255 |
marginDiv.style.cssText = div.style.cssText = divReset;
|
1256 |
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
1257 |
div.style.width = "1px";
|
|
|
1258 |
support.reliableMarginRight =
|
1259 |
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
|
1260 |
}
|
|
|
1261 |
if ( typeof div.style.zoom !== core_strundefined ) {
|
1262 |
// Support: IE<8
|
1263 |
// Check if natively block-level elements act like inline-block
|
@@ -1266,12 +1519,14 @@ jQuery.support = (function() {
|
|
1266 |
div.innerHTML = "";
|
1267 |
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
|
1268 |
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
|
|
|
1269 |
// Support: IE6
|
1270 |
// Check if elements with layout shrink-wrap their children
|
1271 |
div.style.display = "block";
|
1272 |
div.innerHTML = "<div></div>";
|
1273 |
div.firstChild.style.width = "5px";
|
1274 |
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
|
|
|
1275 |
if ( support.inlineBlockNeedsLayout ) {
|
1276 |
// Prevent IE 6 from affecting layout for positioned elements #11048
|
1277 |
// Prevent IE from shrinking the body in IE 7 mode #12869
|
@@ -1279,37 +1534,49 @@ jQuery.support = (function() {
|
|
1279 |
body.style.zoom = 1;
|
1280 |
}
|
1281 |
}
|
|
|
1282 |
body.removeChild( container );
|
|
|
1283 |
// Null elements to avoid leaks in IE
|
1284 |
container = div = tds = marginDiv = null;
|
1285 |
});
|
|
|
1286 |
// Null elements to avoid leaks in IE
|
1287 |
all = select = fragment = opt = a = input = null;
|
|
|
1288 |
return support;
|
1289 |
})();
|
|
|
1290 |
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
1291 |
rmultiDash = /([A-Z])/g;
|
|
|
1292 |
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
1293 |
if ( !jQuery.acceptData( elem ) ) {
|
1294 |
return;
|
1295 |
}
|
|
|
1296 |
var thisCache, ret,
|
1297 |
internalKey = jQuery.expando,
|
1298 |
getByName = typeof name === "string",
|
|
|
1299 |
// We have to handle DOM nodes and JS objects differently because IE6-7
|
1300 |
// can't GC object references properly across the DOM-JS boundary
|
1301 |
isNode = elem.nodeType,
|
|
|
1302 |
// Only DOM nodes need the global jQuery cache; JS object data is
|
1303 |
// attached directly to the object so GC can occur automatically
|
1304 |
cache = isNode ? jQuery.cache : elem,
|
|
|
1305 |
// Only defining an ID for JS objects if its cache already exists allows
|
1306 |
// the code to shortcut on the same path as a DOM node with no cache
|
1307 |
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
|
|
|
1308 |
// Avoid doing any more work than we need to when trying to get data on an
|
1309 |
// object that has no data at all
|
1310 |
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
|
1311 |
return;
|
1312 |
}
|
|
|
1313 |
if ( !id ) {
|
1314 |
// Only DOM nodes need a new unique ID for each element since their data
|
1315 |
// ends up in the global cache
|
@@ -1319,14 +1586,17 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
|
1319 |
id = internalKey;
|
1320 |
}
|
1321 |
}
|
|
|
1322 |
if ( !cache[ id ] ) {
|
1323 |
cache[ id ] = {};
|
|
|
1324 |
// Avoids exposing jQuery metadata on plain JS objects when the object
|
1325 |
// is serialized using JSON.stringify
|
1326 |
if ( !isNode ) {
|
1327 |
cache[ id ].toJSON = jQuery.noop;
|
1328 |
}
|
1329 |
}
|
|
|
1330 |
// An object can be passed to jQuery.data instead of a key/value pair; this gets
|
1331 |
// shallow copied over onto the existing cache
|
1332 |
if ( typeof name === "object" || typeof name === "function" ) {
|
@@ -1336,7 +1606,9 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
|
1336 |
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
|
1337 |
}
|
1338 |
}
|
|
|
1339 |
thisCache = cache[ id ];
|
|
|
1340 |
// jQuery data() is stored in a separate object inside the object's internal data
|
1341 |
// cache in order to avoid key collisions between internal data and user-defined
|
1342 |
// data.
|
@@ -1344,49 +1616,66 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
|
1344 |
if ( !thisCache.data ) {
|
1345 |
thisCache.data = {};
|
1346 |
}
|
|
|
1347 |
thisCache = thisCache.data;
|
1348 |
}
|
|
|
1349 |
if ( data !== undefined ) {
|
1350 |
thisCache[ jQuery.camelCase( name ) ] = data;
|
1351 |
}
|
|
|
1352 |
// Check for both converted-to-camel and non-converted data property names
|
1353 |
// If a data property was specified
|
1354 |
if ( getByName ) {
|
|
|
1355 |
// First Try to find as-is property data
|
1356 |
ret = thisCache[ name ];
|
|
|
1357 |
// Test for null|undefined property data
|
1358 |
if ( ret == null ) {
|
|
|
1359 |
// Try to find the camelCased property
|
1360 |
ret = thisCache[ jQuery.camelCase( name ) ];
|
1361 |
}
|
1362 |
} else {
|
1363 |
ret = thisCache;
|
1364 |
}
|
|
|
1365 |
return ret;
|
1366 |
}
|
|
|
1367 |
function internalRemoveData( elem, name, pvt ) {
|
1368 |
if ( !jQuery.acceptData( elem ) ) {
|
1369 |
return;
|
1370 |
}
|
|
|
1371 |
var i, l, thisCache,
|
1372 |
isNode = elem.nodeType,
|
|
|
1373 |
// See jQuery.data for more information
|
1374 |
cache = isNode ? jQuery.cache : elem,
|
1375 |
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
|
|
|
1376 |
// If there is already no cache entry for this object, there is no
|
1377 |
// purpose in continuing
|
1378 |
if ( !cache[ id ] ) {
|
1379 |
return;
|
1380 |
}
|
|
|
1381 |
if ( name ) {
|
|
|
1382 |
thisCache = pvt ? cache[ id ] : cache[ id ].data;
|
|
|
1383 |
if ( thisCache ) {
|
|
|
1384 |
// Support array or space separated string names for data keys
|
1385 |
if ( !jQuery.isArray( name ) ) {
|
|
|
1386 |
// try the string as a key before any manipulation
|
1387 |
if ( name in thisCache ) {
|
1388 |
name = [ name ];
|
1389 |
} else {
|
|
|
1390 |
// split the camel cased version by spaces unless a key with the spaces exists
|
1391 |
name = jQuery.camelCase( name );
|
1392 |
if ( name in thisCache ) {
|
@@ -1404,9 +1693,11 @@ function internalRemoveData( elem, name, pvt ) {
|
|
1404 |
// This will only penalize the array argument path.
|
1405 |
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
|
1406 |
}
|
|
|
1407 |
for ( i = 0, l = name.length; i < l; i++ ) {
|
1408 |
delete thisCache[ name[i] ];
|
1409 |
}
|
|
|
1410 |
// If there is no data left in the cache, we want to continue
|
1411 |
// and let the cache object itself get destroyed
|
1412 |
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
|
@@ -1414,31 +1705,39 @@ function internalRemoveData( elem, name, pvt ) {
|
|
1414 |
}
|
1415 |
}
|
1416 |
}
|
|
|
1417 |
// See jQuery.data for more information
|
1418 |
if ( !pvt ) {
|
1419 |
delete cache[ id ].data;
|
|
|
1420 |
// Don't destroy the parent cache unless the internal data object
|
1421 |
// had been the only thing left in it
|
1422 |
if ( !isEmptyDataObject( cache[ id ] ) ) {
|
1423 |
return;
|
1424 |
}
|
1425 |
}
|
|
|
1426 |
// Destroy the cache
|
1427 |
if ( isNode ) {
|
1428 |
jQuery.cleanData( [ elem ], true );
|
|
|
1429 |
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
|
1430 |
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
|
1431 |
delete cache[ id ];
|
|
|
1432 |
// When all else fails, null
|
1433 |
} else {
|
1434 |
cache[ id ] = null;
|
1435 |
}
|
1436 |
}
|
|
|
1437 |
jQuery.extend({
|
1438 |
cache: {},
|
|
|
1439 |
// Unique for each copy of jQuery on the page
|
1440 |
// Non-digits removed to match rinlinejQuery
|
1441 |
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
|
|
|
1442 |
// The following elements throw uncatchable exceptions if you
|
1443 |
// attempt to add expando properties to them.
|
1444 |
noData: {
|
@@ -1447,86 +1746,109 @@ jQuery.extend({
|
|
1447 |
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
1448 |
"applet": true
|
1449 |
},
|
|
|
1450 |
hasData: function( elem ) {
|
1451 |
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
|
1452 |
return !!elem && !isEmptyDataObject( elem );
|
1453 |
},
|
|
|
1454 |
data: function( elem, name, data ) {
|
1455 |
return internalData( elem, name, data );
|
1456 |
},
|
|
|
1457 |
removeData: function( elem, name ) {
|
1458 |
return internalRemoveData( elem, name );
|
1459 |
},
|
|
|
1460 |
// For internal use only.
|
1461 |
_data: function( elem, name, data ) {
|
1462 |
return internalData( elem, name, data, true );
|
1463 |
},
|
|
|
1464 |
_removeData: function( elem, name ) {
|
1465 |
return internalRemoveData( elem, name, true );
|
1466 |
},
|
|
|
1467 |
// A method for determining if a DOM node can handle the data expando
|
1468 |
acceptData: function( elem ) {
|
1469 |
// Do not set data on non-element because it will not be cleared (#8335).
|
1470 |
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
|
1471 |
return false;
|
1472 |
}
|
|
|
1473 |
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
|
|
|
1474 |
// nodes accept data unless otherwise specified; rejection can be conditional
|
1475 |
return !noData || noData !== true && elem.getAttribute("classid") === noData;
|
1476 |
}
|
1477 |
});
|
|
|
1478 |
jQuery.fn.extend({
|
1479 |
data: function( key, value ) {
|
1480 |
var attrs, name,
|
1481 |
elem = this[0],
|
1482 |
i = 0,
|
1483 |
data = null;
|
|
|
1484 |
// Gets all values
|
1485 |
if ( key === undefined ) {
|
1486 |
if ( this.length ) {
|
1487 |
data = jQuery.data( elem );
|
|
|
1488 |
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
|
1489 |
attrs = elem.attributes;
|
1490 |
for ( ; i < attrs.length; i++ ) {
|
1491 |
name = attrs[i].name;
|
|
|
1492 |
if ( !name.indexOf( "data-" ) ) {
|
1493 |
name = jQuery.camelCase( name.slice(5) );
|
|
|
1494 |
dataAttr( elem, name, data[ name ] );
|
1495 |
}
|
1496 |
}
|
1497 |
jQuery._data( elem, "parsedAttrs", true );
|
1498 |
}
|
1499 |
}
|
|
|
1500 |
return data;
|
1501 |
}
|
|
|
1502 |
// Sets multiple values
|
1503 |
if ( typeof key === "object" ) {
|
1504 |
return this.each(function() {
|
1505 |
jQuery.data( this, key );
|
1506 |
});
|
1507 |
}
|
|
|
1508 |
return jQuery.access( this, function( value ) {
|
|
|
1509 |
if ( value === undefined ) {
|
1510 |
// Try to fetch any internally stored data first
|
1511 |
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
|
1512 |
}
|
|
|
1513 |
this.each(function() {
|
1514 |
jQuery.data( this, key, value );
|
1515 |
});
|
1516 |
}, null, value, arguments.length > 1, null, true );
|
1517 |
},
|
|
|
1518 |
removeData: function( key ) {
|
1519 |
return this.each(function() {
|
1520 |
jQuery.removeData( this, key );
|
1521 |
});
|
1522 |
}
|
1523 |
});
|
|
|
1524 |
function dataAttr( elem, key, data ) {
|
1525 |
// If nothing was found internally, try to fetch any
|
1526 |
// data from the HTML5 data-* attribute
|
1527 |
if ( data === undefined && elem.nodeType === 1 ) {
|
|
|
1528 |
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
|
|
1529 |
data = elem.getAttribute( name );
|
|
|
1530 |
if ( typeof data === "string" ) {
|
1531 |
try {
|
1532 |
data = data === "true" ? true :
|
@@ -1537,18 +1859,23 @@ function dataAttr( elem, key, data ) {
|
|
1537 |
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
1538 |
data;
|
1539 |
} catch( e ) {}
|
|
|
1540 |
// Make sure we set the data so it isn't changed later
|
1541 |
jQuery.data( elem, key, data );
|
|
|
1542 |
} else {
|
1543 |
data = undefined;
|
1544 |
}
|
1545 |
}
|
|
|
1546 |
return data;
|
1547 |
}
|
|
|
1548 |
// checks a cache object for emptiness
|
1549 |
function isEmptyDataObject( obj ) {
|
1550 |
var name;
|
1551 |
for ( name in obj ) {
|
|
|
1552 |
// if the public data object is empty, the private is still empty
|
1553 |
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
|
1554 |
continue;
|
@@ -1557,14 +1884,17 @@ function isEmptyDataObject( obj ) {
|
|
1557 |
return false;
|
1558 |
}
|
1559 |
}
|
|
|
1560 |
return true;
|
1561 |
}
|
1562 |
jQuery.extend({
|
1563 |
queue: function( elem, type, data ) {
|
1564 |
var queue;
|
|
|
1565 |
if ( elem ) {
|
1566 |
type = ( type || "fx" ) + "queue";
|
1567 |
queue = jQuery._data( elem, type );
|
|
|
1568 |
// Speed up dequeue by getting out quickly if this is just a lookup
|
1569 |
if ( data ) {
|
1570 |
if ( !queue || jQuery.isArray(data) ) {
|
@@ -1576,8 +1906,10 @@ jQuery.extend({
|
|
1576 |
return queue || [];
|
1577 |
}
|
1578 |
},
|
|
|
1579 |
dequeue: function( elem, type ) {
|
1580 |
type = type || "fx";
|
|
|
1581 |
var queue = jQuery.queue( elem, type ),
|
1582 |
startLength = queue.length,
|
1583 |
fn = queue.shift(),
|
@@ -1585,26 +1917,32 @@ jQuery.extend({
|
|
1585 |
next = function() {
|
1586 |
jQuery.dequeue( elem, type );
|
1587 |
};
|
|
|
1588 |
// If the fx queue is dequeued, always remove the progress sentinel
|
1589 |
if ( fn === "inprogress" ) {
|
1590 |
fn = queue.shift();
|
1591 |
startLength--;
|
1592 |
}
|
|
|
1593 |
hooks.cur = fn;
|
1594 |
if ( fn ) {
|
|
|
1595 |
// Add a progress sentinel to prevent the fx queue from being
|
1596 |
// automatically dequeued
|
1597 |
if ( type === "fx" ) {
|
1598 |
queue.unshift( "inprogress" );
|
1599 |
}
|
|
|
1600 |
// clear up the last queue stop function
|
1601 |
delete hooks.stop;
|
1602 |
fn.call( elem, next, hooks );
|
1603 |
}
|
|
|
1604 |
if ( !startLength && hooks ) {
|
1605 |
hooks.empty.fire();
|
1606 |
}
|
1607 |
},
|
|
|
1608 |
// not intended for public consumption - generates a queueHooks object, or returns the current one
|
1609 |
_queueHooks: function( elem, type ) {
|
1610 |
var key = type + "queueHooks";
|
@@ -1616,23 +1954,29 @@ jQuery.extend({
|
|
1616 |
});
|
1617 |
}
|
1618 |
});
|
|
|
1619 |
jQuery.fn.extend({
|
1620 |
queue: function( type, data ) {
|
1621 |
var setter = 2;
|
|
|
1622 |
if ( typeof type !== "string" ) {
|
1623 |
data = type;
|
1624 |
type = "fx";
|
1625 |
setter--;
|
1626 |
}
|
|
|
1627 |
if ( arguments.length < setter ) {
|
1628 |
return jQuery.queue( this[0], type );
|
1629 |
}
|
|
|
1630 |
return data === undefined ?
|
1631 |
this :
|
1632 |
this.each(function() {
|
1633 |
var queue = jQuery.queue( this, type, data );
|
|
|
1634 |
// ensure a hooks for this queue
|
1635 |
jQuery._queueHooks( this, type );
|
|
|
1636 |
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
1637 |
jQuery.dequeue( this, type );
|
1638 |
}
|
@@ -1648,6 +1992,7 @@ jQuery.fn.extend({
|
|
1648 |
delay: function( time, type ) {
|
1649 |
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
|
1650 |
type = type || "fx";
|
|
|
1651 |
return this.queue( type, function( next, hooks ) {
|
1652 |
var timeout = setTimeout( next, time );
|
1653 |
hooks.stop = function() {
|
@@ -1671,11 +2016,13 @@ jQuery.fn.extend({
|
|
1671 |
defer.resolveWith( elements, [ elements ] );
|
1672 |
}
|
1673 |
};
|
|
|
1674 |
if ( typeof type !== "string" ) {
|
1675 |
obj = type;
|
1676 |
type = undefined;
|
1677 |
}
|
1678 |
type = type || "fx";
|
|
|
1679 |
while( i-- ) {
|
1680 |
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
|
1681 |
if ( tmp && tmp.empty ) {
|
@@ -1696,18 +2043,22 @@ var nodeHook, boolHook,
|
|
1696 |
ruseDefault = /^(?:checked|selected)$/i,
|
1697 |
getSetAttribute = jQuery.support.getSetAttribute,
|
1698 |
getSetInput = jQuery.support.input;
|
|
|
1699 |
jQuery.fn.extend({
|
1700 |
attr: function( name, value ) {
|
1701 |
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
|
1702 |
},
|
|
|
1703 |
removeAttr: function( name ) {
|
1704 |
return this.each(function() {
|
1705 |
jQuery.removeAttr( this, name );
|
1706 |
});
|
1707 |
},
|
|
|
1708 |
prop: function( name, value ) {
|
1709 |
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
|
1710 |
},
|
|
|
1711 |
removeProp: function( name ) {
|
1712 |
name = jQuery.propFix[ name ] || name;
|
1713 |
return this.each(function() {
|
@@ -1718,25 +2069,30 @@ jQuery.fn.extend({
|
|
1718 |
} catch( e ) {}
|
1719 |
});
|
1720 |
},
|
|
|
1721 |
addClass: function( value ) {
|
1722 |
var classes, elem, cur, clazz, j,
|
1723 |
i = 0,
|
1724 |
len = this.length,
|
1725 |
proceed = typeof value === "string" && value;
|
|
|
1726 |
if ( jQuery.isFunction( value ) ) {
|
1727 |
return this.each(function( j ) {
|
1728 |
jQuery( this ).addClass( value.call( this, j, this.className ) );
|
1729 |
});
|
1730 |
}
|
|
|
1731 |
if ( proceed ) {
|
1732 |
// The disjunction here is for better compressibility (see removeClass)
|
1733 |
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
|
|
1734 |
for ( ; i < len; i++ ) {
|
1735 |
elem = this[ i ];
|
1736 |
cur = elem.nodeType === 1 && ( elem.className ?
|
1737 |
( " " + elem.className + " " ).replace( rclass, " " ) :
|
1738 |
" "
|
1739 |
);
|
|
|
1740 |
if ( cur ) {
|
1741 |
j = 0;
|
1742 |
while ( (clazz = classes[j++]) ) {
|
@@ -1745,16 +2101,20 @@ jQuery.fn.extend({
|
|
1745 |
}
|
1746 |
}
|
1747 |
elem.className = jQuery.trim( cur );
|
|
|
1748 |
}
|
1749 |
}
|
1750 |
}
|
|
|
1751 |
return this;
|
1752 |
},
|
|
|
1753 |
removeClass: function( value ) {
|
1754 |
var classes, elem, cur, clazz, j,
|
1755 |
i = 0,
|
1756 |
len = this.length,
|
1757 |
proceed = arguments.length === 0 || typeof value === "string" && value;
|
|
|
1758 |
if ( jQuery.isFunction( value ) ) {
|
1759 |
return this.each(function( j ) {
|
1760 |
jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
@@ -1762,6 +2122,7 @@ jQuery.fn.extend({
|
|
1762 |
}
|
1763 |
if ( proceed ) {
|
1764 |
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
|
|
1765 |
for ( ; i < len; i++ ) {
|
1766 |
elem = this[ i ];
|
1767 |
// This expression is here for better compressibility (see addClass)
|
@@ -1769,6 +2130,7 @@ jQuery.fn.extend({
|
|
1769 |
( " " + elem.className + " " ).replace( rclass, " " ) :
|
1770 |
""
|
1771 |
);
|
|
|
1772 |
if ( cur ) {
|
1773 |
j = 0;
|
1774 |
while ( (clazz = classes[j++]) ) {
|
@@ -1781,16 +2143,20 @@ jQuery.fn.extend({
|
|
1781 |
}
|
1782 |
}
|
1783 |
}
|
|
|
1784 |
return this;
|
1785 |
},
|
|
|
1786 |
toggleClass: function( value, stateVal ) {
|
1787 |
var type = typeof value,
|
1788 |
isBool = typeof stateVal === "boolean";
|
|
|
1789 |
if ( jQuery.isFunction( value ) ) {
|
1790 |
return this.each(function( i ) {
|
1791 |
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
1792 |
});
|
1793 |
}
|
|
|
1794 |
return this.each(function() {
|
1795 |
if ( type === "string" ) {
|
1796 |
// toggle individual class names
|
@@ -1799,17 +2165,20 @@ jQuery.fn.extend({
|
|
1799 |
self = jQuery( this ),
|
1800 |
state = stateVal,
|
1801 |
classNames = value.match( core_rnotwhite ) || [];
|
|
|
1802 |
while ( (className = classNames[ i++ ]) ) {
|
1803 |
// check each className given, space separated list
|
1804 |
state = isBool ? state : !self.hasClass( className );
|
1805 |
self[ state ? "addClass" : "removeClass" ]( className );
|
1806 |
}
|
|
|
1807 |
// Toggle whole class name
|
1808 |
} else if ( type === core_strundefined || type === "boolean" ) {
|
1809 |
if ( this.className ) {
|
1810 |
// store className if set
|
1811 |
jQuery._data( this, "__className__", this.className );
|
1812 |
}
|
|
|
1813 |
// If the element has a class name or if we're passed "false",
|
1814 |
// then remove the whole classname (if there was one, the above saved it).
|
1815 |
// Otherwise bring back whatever was previously saved (if anything),
|
@@ -1818,6 +2187,7 @@ jQuery.fn.extend({
|
|
1818 |
}
|
1819 |
});
|
1820 |
},
|
|
|
1821 |
hasClass: function( selector ) {
|
1822 |
var className = " " + selector + " ",
|
1823 |
i = 0,
|
@@ -1827,38 +2197,50 @@ jQuery.fn.extend({
|
|
1827 |
return true;
|
1828 |
}
|
1829 |
}
|
|
|
1830 |
return false;
|
1831 |
},
|
|
|
1832 |
val: function( value ) {
|
1833 |
var ret, hooks, isFunction,
|
1834 |
elem = this[0];
|
|
|
1835 |
if ( !arguments.length ) {
|
1836 |
if ( elem ) {
|
1837 |
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
|
|
1838 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
1839 |
return ret;
|
1840 |
}
|
|
|
1841 |
ret = elem.value;
|
|
|
1842 |
return typeof ret === "string" ?
|
1843 |
// handle most common string cases
|
1844 |
ret.replace(rreturn, "") :
|
1845 |
// handle cases where value is null/undef or number
|
1846 |
ret == null ? "" : ret;
|
1847 |
}
|
|
|
1848 |
return;
|
1849 |
}
|
|
|
1850 |
isFunction = jQuery.isFunction( value );
|
|
|
1851 |
return this.each(function( i ) {
|
1852 |
var val,
|
1853 |
self = jQuery(this);
|
|
|
1854 |
if ( this.nodeType !== 1 ) {
|
1855 |
return;
|
1856 |
}
|
|
|
1857 |
if ( isFunction ) {
|
1858 |
val = value.call( this, i, self.val() );
|
1859 |
} else {
|
1860 |
val = value;
|
1861 |
}
|
|
|
1862 |
// Treat null/undefined as ""; convert numbers to string
|
1863 |
if ( val == null ) {
|
1864 |
val = "";
|
@@ -1869,7 +2251,9 @@ jQuery.fn.extend({
|
|
1869 |
return value == null ? "" : value + "";
|
1870 |
});
|
1871 |
}
|
|
|
1872 |
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
|
|
1873 |
// If set returns undefined, fall back to normal setting
|
1874 |
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
1875 |
this.value = val;
|
@@ -1877,6 +2261,7 @@ jQuery.fn.extend({
|
|
1877 |
});
|
1878 |
}
|
1879 |
});
|
|
|
1880 |
jQuery.extend({
|
1881 |
valHooks: {
|
1882 |
option: {
|
@@ -1898,31 +2283,40 @@ jQuery.extend({
|
|
1898 |
i = index < 0 ?
|
1899 |
max :
|
1900 |
one ? index : 0;
|
|
|
1901 |
// Loop through all the selected options
|
1902 |
for ( ; i < max; i++ ) {
|
1903 |
option = options[ i ];
|
|
|
1904 |
// oldIE doesn't update selected after form reset (#2551)
|
1905 |
if ( ( option.selected || i === index ) &&
|
1906 |
// Don't return options that are disabled or in a disabled optgroup
|
1907 |
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
1908 |
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
|
|
1909 |
// Get the specific value for the option
|
1910 |
value = jQuery( option ).val();
|
|
|
1911 |
// We don't need an array for one selects
|
1912 |
if ( one ) {
|
1913 |
return value;
|
1914 |
}
|
|
|
1915 |
// Multi-Selects return an array
|
1916 |
values.push( value );
|
1917 |
}
|
1918 |
}
|
|
|
1919 |
return values;
|
1920 |
},
|
|
|
1921 |
set: function( elem, value ) {
|
1922 |
var values = jQuery.makeArray( value );
|
|
|
1923 |
jQuery(elem).find("option").each(function() {
|
1924 |
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
1925 |
});
|
|
|
1926 |
if ( !values.length ) {
|
1927 |
elem.selectedIndex = -1;
|
1928 |
}
|
@@ -1930,54 +2324,70 @@ jQuery.extend({
|
|
1930 |
}
|
1931 |
}
|
1932 |
},
|
|
|
1933 |
attr: function( elem, name, value ) {
|
1934 |
var hooks, notxml, ret,
|
1935 |
nType = elem.nodeType;
|
|
|
1936 |
// don't get/set attributes on text, comment and attribute nodes
|
1937 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
1938 |
return;
|
1939 |
}
|
|
|
1940 |
// Fallback to prop when attributes are not supported
|
1941 |
if ( typeof elem.getAttribute === core_strundefined ) {
|
1942 |
return jQuery.prop( elem, name, value );
|
1943 |
}
|
|
|
1944 |
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
|
|
1945 |
// All attributes are lowercase
|
1946 |
// Grab necessary hook if one is defined
|
1947 |
if ( notxml ) {
|
1948 |
name = name.toLowerCase();
|
1949 |
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
|
1950 |
}
|
|
|
1951 |
if ( value !== undefined ) {
|
|
|
1952 |
if ( value === null ) {
|
1953 |
jQuery.removeAttr( elem, name );
|
|
|
1954 |
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
1955 |
return ret;
|
|
|
1956 |
} else {
|
1957 |
elem.setAttribute( name, value + "" );
|
1958 |
return value;
|
1959 |
}
|
|
|
1960 |
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
1961 |
return ret;
|
|
|
1962 |
} else {
|
|
|
1963 |
// In IE9+, Flash objects don't have .getAttribute (#12945)
|
1964 |
// Support: IE9+
|
1965 |
if ( typeof elem.getAttribute !== core_strundefined ) {
|
1966 |
ret = elem.getAttribute( name );
|
1967 |
}
|
|
|
1968 |
// Non-existent attributes return null, we normalize to undefined
|
1969 |
return ret == null ?
|
1970 |
undefined :
|
1971 |
ret;
|
1972 |
}
|
1973 |
},
|
|
|
1974 |
removeAttr: function( elem, value ) {
|
1975 |
var name, propName,
|
1976 |
i = 0,
|
1977 |
attrNames = value && value.match( core_rnotwhite );
|
|
|
1978 |
if ( attrNames && elem.nodeType === 1 ) {
|
1979 |
while ( (name = attrNames[i++]) ) {
|
1980 |
propName = jQuery.propFix[ name ] || name;
|
|
|
1981 |
// Boolean attributes get special treatment (#10870)
|
1982 |
if ( rboolean.test( name ) ) {
|
1983 |
// Set corresponding property to false for boolean attributes
|
@@ -1988,14 +2398,17 @@ jQuery.extend({
|
|
1988 |
} else {
|
1989 |
elem[ propName ] = false;
|
1990 |
}
|
|
|
1991 |
// See #9699 for explanation of this approach (setting first, then removal)
|
1992 |
} else {
|
1993 |
jQuery.attr( elem, name, "" );
|
1994 |
}
|
|
|
1995 |
elem.removeAttribute( getSetAttribute ? name : propName );
|
1996 |
}
|
1997 |
}
|
1998 |
},
|
|
|
1999 |
attrHooks: {
|
2000 |
type: {
|
2001 |
set: function( elem, value ) {
|
@@ -2012,6 +2425,7 @@ jQuery.extend({
|
|
2012 |
}
|
2013 |
}
|
2014 |
},
|
|
|
2015 |
propFix: {
|
2016 |
tabindex: "tabIndex",
|
2017 |
readonly: "readOnly",
|
@@ -2026,39 +2440,49 @@ jQuery.extend({
|
|
2026 |
frameborder: "frameBorder",
|
2027 |
contenteditable: "contentEditable"
|
2028 |
},
|
|
|
2029 |
prop: function( elem, name, value ) {
|
2030 |
var ret, hooks, notxml,
|
2031 |
nType = elem.nodeType;
|
|
|
2032 |
// don't get/set properties on text, comment and attribute nodes
|
2033 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
2034 |
return;
|
2035 |
}
|
|
|
2036 |
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
|
|
2037 |
if ( notxml ) {
|
2038 |
// Fix name and attach hooks
|
2039 |
name = jQuery.propFix[ name ] || name;
|
2040 |
hooks = jQuery.propHooks[ name ];
|
2041 |
}
|
|
|
2042 |
if ( value !== undefined ) {
|
2043 |
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
2044 |
return ret;
|
|
|
2045 |
} else {
|
2046 |
return ( elem[ name ] = value );
|
2047 |
}
|
|
|
2048 |
} else {
|
2049 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
2050 |
return ret;
|
|
|
2051 |
} else {
|
2052 |
return elem[ name ];
|
2053 |
}
|
2054 |
}
|
2055 |
},
|
|
|
2056 |
propHooks: {
|
2057 |
tabIndex: {
|
2058 |
get: function( elem ) {
|
2059 |
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
2060 |
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
2061 |
var attributeNode = elem.getAttributeNode("tabindex");
|
|
|
2062 |
return attributeNode && attributeNode.specified ?
|
2063 |
parseInt( attributeNode.value, 10 ) :
|
2064 |
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
@@ -2068,15 +2492,18 @@ jQuery.extend({
|
|
2068 |
}
|
2069 |
}
|
2070 |
});
|
|
|
2071 |
// Hook for boolean attributes
|
2072 |
boolHook = {
|
2073 |
get: function( elem, name ) {
|
2074 |
var
|
2075 |
// Use .prop to determine if this attribute is understood as boolean
|
2076 |
prop = jQuery.prop( elem, name ),
|
|
|
2077 |
// Fetch it accordingly
|
2078 |
attr = typeof prop === "boolean" && elem.getAttribute( name ),
|
2079 |
detail = typeof prop === "boolean" ?
|
|
|
2080 |
getSetInput && getSetAttribute ?
|
2081 |
attr != null :
|
2082 |
// oldIE fabricates an empty string for missing boolean attributes
|
@@ -2084,8 +2511,10 @@ boolHook = {
|
|
2084 |
ruseDefault.test( name ) ?
|
2085 |
elem[ jQuery.camelCase( "default-" + name ) ] :
|
2086 |
!!attr :
|
|
|
2087 |
// fetch an attribute node for properties not recognized as boolean
|
2088 |
elem.getAttributeNode( name );
|
|
|
2089 |
return detail && detail.value !== false ?
|
2090 |
name.toLowerCase() :
|
2091 |
undefined;
|
@@ -2097,21 +2526,26 @@ boolHook = {
|
|
2097 |
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
2098 |
// IE<8 needs the *property* name
|
2099 |
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
|
|
|
2100 |
// Use defaultChecked and defaultSelected for oldIE
|
2101 |
} else {
|
2102 |
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
|
2103 |
}
|
|
|
2104 |
return name;
|
2105 |
}
|
2106 |
};
|
|
|
2107 |
// fix oldIE value attroperty
|
2108 |
if ( !getSetInput || !getSetAttribute ) {
|
2109 |
jQuery.attrHooks.value = {
|
2110 |
get: function( elem, name ) {
|
2111 |
var ret = elem.getAttributeNode( name );
|
2112 |
return jQuery.nodeName( elem, "input" ) ?
|
|
|
2113 |
// Ignore the value *property* by using defaultValue
|
2114 |
elem.defaultValue :
|
|
|
2115 |
ret && ret.specified ? ret.value : undefined;
|
2116 |
},
|
2117 |
set: function( elem, value, name ) {
|
@@ -2125,8 +2559,10 @@ if ( !getSetInput || !getSetAttribute ) {
|
|
2125 |
}
|
2126 |
};
|
2127 |
}
|
|
|
2128 |
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
2129 |
if ( !getSetAttribute ) {
|
|
|
2130 |
// Use this for any attribute in IE6/7
|
2131 |
// This fixes almost every IE6/7 issue
|
2132 |
nodeHook = jQuery.valHooks.button = {
|
@@ -2144,13 +2580,16 @@ if ( !getSetAttribute ) {
|
|
2144 |
(ret = elem.ownerDocument.createAttribute( name ))
|
2145 |
);
|
2146 |
}
|
|
|
2147 |
ret.value = value += "";
|
|
|
2148 |
// Break association with cloned elements by also using setAttribute (#9646)
|
2149 |
return name === "value" || value === elem.getAttribute( name ) ?
|
2150 |
value :
|
2151 |
undefined;
|
2152 |
}
|
2153 |
};
|
|
|
2154 |
// Set contenteditable to false on removals(#10429)
|
2155 |
// Setting to empty string throws an error as an invalid value
|
2156 |
jQuery.attrHooks.contenteditable = {
|
@@ -2159,6 +2598,7 @@ if ( !getSetAttribute ) {
|
|
2159 |
nodeHook.set( elem, value === "" ? false : value, name );
|
2160 |
}
|
2161 |
};
|
|
|
2162 |
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
2163 |
// This is for removals
|
2164 |
jQuery.each([ "width", "height" ], function( i, name ) {
|
@@ -2172,6 +2612,8 @@ if ( !getSetAttribute ) {
|
|
2172 |
});
|
2173 |
});
|
2174 |
}
|
|
|
|
|
2175 |
// Some attributes require a special call on IE
|
2176 |
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
2177 |
if ( !jQuery.support.hrefNormalized ) {
|
@@ -2183,6 +2625,7 @@ if ( !jQuery.support.hrefNormalized ) {
|
|
2183 |
}
|
2184 |
});
|
2185 |
});
|
|
|
2186 |
// href/src property should get the full normalized URL (#10299/#12915)
|
2187 |
jQuery.each([ "href", "src" ], function( i, name ) {
|
2188 |
jQuery.propHooks[ name ] = {
|
@@ -2192,6 +2635,7 @@ if ( !jQuery.support.hrefNormalized ) {
|
|
2192 |
};
|
2193 |
});
|
2194 |
}
|
|
|
2195 |
if ( !jQuery.support.style ) {
|
2196 |
jQuery.attrHooks.style = {
|
2197 |
get: function( elem ) {
|
@@ -2205,14 +2649,17 @@ if ( !jQuery.support.style ) {
|
|
2205 |
}
|
2206 |
};
|
2207 |
}
|
|
|
2208 |
// Safari mis-reports the default selected property of an option
|
2209 |
// Accessing the parent's selectedIndex property fixes it
|
2210 |
if ( !jQuery.support.optSelected ) {
|
2211 |
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
|
2212 |
get: function( elem ) {
|
2213 |
var parent = elem.parentNode;
|
|
|
2214 |
if ( parent ) {
|
2215 |
parent.selectedIndex;
|
|
|
2216 |
// Make sure that it also works with optgroups, see #5701
|
2217 |
if ( parent.parentNode ) {
|
2218 |
parent.parentNode.selectedIndex;
|
@@ -2222,10 +2669,12 @@ if ( !jQuery.support.optSelected ) {
|
|
2222 |
}
|
2223 |
});
|
2224 |
}
|
|
|
2225 |
// IE6/7 call enctype encoding
|
2226 |
if ( !jQuery.support.enctype ) {
|
2227 |
jQuery.propFix.enctype = "encoding";
|
2228 |
}
|
|
|
2229 |
// Radios and checkboxes getter/setter
|
2230 |
if ( !jQuery.support.checkOn ) {
|
2231 |
jQuery.each([ "radio", "checkbox" ], function() {
|
@@ -2251,37 +2700,46 @@ var rformElems = /^(?:input|select|textarea)$/i,
|
|
2251 |
rmouseEvent = /^(?:mouse|contextmenu)|click/,
|
2252 |
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
2253 |
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
|
|
|
2254 |
function returnTrue() {
|
2255 |
return true;
|
2256 |
}
|
|
|
2257 |
function returnFalse() {
|
2258 |
return false;
|
2259 |
}
|
|
|
2260 |
/*
|
2261 |
* Helper functions for managing events -- not part of the public interface.
|
2262 |
* Props to Dean Edwards' addEvent library for many of the ideas.
|
2263 |
*/
|
2264 |
jQuery.event = {
|
|
|
2265 |
global: {},
|
|
|
2266 |
add: function( elem, types, handler, data, selector ) {
|
2267 |
var tmp, events, t, handleObjIn,
|
2268 |
special, eventHandle, handleObj,
|
2269 |
handlers, type, namespaces, origType,
|
2270 |
elemData = jQuery._data( elem );
|
|
|
2271 |
// Don't attach events to noData or text/comment nodes (but allow plain objects)
|
2272 |
if ( !elemData ) {
|
2273 |
return;
|
2274 |
}
|
|
|
2275 |
// Caller can pass in an object of custom data in lieu of the handler
|
2276 |
if ( handler.handler ) {
|
2277 |
handleObjIn = handler;
|
2278 |
handler = handleObjIn.handler;
|
2279 |
selector = handleObjIn.selector;
|
2280 |
}
|
|
|
2281 |
// Make sure that the handler has a unique ID, used to find/remove it later
|
2282 |
if ( !handler.guid ) {
|
2283 |
handler.guid = jQuery.guid++;
|
2284 |
}
|
|
|
2285 |
// Init the element's event structure and main handler, if this is the first
|
2286 |
if ( !(events = elemData.events) ) {
|
2287 |
events = elemData.events = {};
|
@@ -2297,6 +2755,7 @@ jQuery.event = {
|
|
2297 |
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
|
2298 |
eventHandle.elem = elem;
|
2299 |
}
|
|
|
2300 |
// Handle multiple events separated by a space
|
2301 |
// jQuery(...).bind("mouseover mouseout", fn);
|
2302 |
types = ( types || "" ).match( core_rnotwhite ) || [""];
|
@@ -2305,12 +2764,16 @@ jQuery.event = {
|
|
2305 |
tmp = rtypenamespace.exec( types[t] ) || [];
|
2306 |
type = origType = tmp[1];
|
2307 |
namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
|
|
2308 |
// If event changes its type, use the special event handlers for the changed type
|
2309 |
special = jQuery.event.special[ type ] || {};
|
|
|
2310 |
// If selector defined, determine special event api type, otherwise given type
|
2311 |
type = ( selector ? special.delegateType : special.bindType ) || type;
|
|
|
2312 |
// Update special based on newly reset type
|
2313 |
special = jQuery.event.special[ type ] || {};
|
|
|
2314 |
// handleObj is passed to all event handlers
|
2315 |
handleObj = jQuery.extend({
|
2316 |
type: type,
|
@@ -2322,38 +2785,47 @@ jQuery.event = {
|
|
2322 |
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
|
2323 |
namespace: namespaces.join(".")
|
2324 |
}, handleObjIn );
|
|
|
2325 |
// Init the event handler queue if we're the first
|
2326 |
if ( !(handlers = events[ type ]) ) {
|
2327 |
handlers = events[ type ] = [];
|
2328 |
handlers.delegateCount = 0;
|
|
|
2329 |
// Only use addEventListener/attachEvent if the special events handler returns false
|
2330 |
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
2331 |
// Bind the global event handler to the element
|
2332 |
if ( elem.addEventListener ) {
|
2333 |
elem.addEventListener( type, eventHandle, false );
|
|
|
2334 |
} else if ( elem.attachEvent ) {
|
2335 |
elem.attachEvent( "on" + type, eventHandle );
|
2336 |
}
|
2337 |
}
|
2338 |
}
|
|
|
2339 |
if ( special.add ) {
|
2340 |
special.add.call( elem, handleObj );
|
|
|
2341 |
if ( !handleObj.handler.guid ) {
|
2342 |
handleObj.handler.guid = handler.guid;
|
2343 |
}
|
2344 |
}
|
|
|
2345 |
// Add to the element's handler list, delegates in front
|
2346 |
if ( selector ) {
|
2347 |
handlers.splice( handlers.delegateCount++, 0, handleObj );
|
2348 |
} else {
|
2349 |
handlers.push( handleObj );
|
2350 |
}
|
|
|
2351 |
// Keep track of which events have ever been used, for event optimization
|
2352 |
jQuery.event.global[ type ] = true;
|
2353 |
}
|
|
|
2354 |
// Nullify elem to prevent memory leaks in IE
|
2355 |
elem = null;
|
2356 |
},
|
|
|
2357 |
// Detach an event or set of events from an element
|
2358 |
remove: function( elem, types, handler, selector, mappedTypes ) {
|
2359 |
var j, handleObj, tmp,
|
@@ -2361,9 +2833,11 @@ jQuery.event = {
|
|
2361 |
special, handlers, type,
|
2362 |
namespaces, origType,
|
2363 |
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
|
|
|
2364 |
if ( !elemData || !(events = elemData.events) ) {
|
2365 |
return;
|
2366 |
}
|
|
|
2367 |
// Once for each type.namespace in types; type may be omitted
|
2368 |
types = ( types || "" ).match( core_rnotwhite ) || [""];
|
2369 |
t = types.length;
|
@@ -2371,6 +2845,7 @@ jQuery.event = {
|
|
2371 |
tmp = rtypenamespace.exec( types[t] ) || [];
|
2372 |
type = origType = tmp[1];
|
2373 |
namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
|
|
2374 |
// Unbind all events (on this namespace, if provided) for the element
|
2375 |
if ( !type ) {
|
2376 |
for ( type in events ) {
|
@@ -2378,19 +2853,23 @@ jQuery.event = {
|
|
2378 |
}
|
2379 |
continue;
|
2380 |
}
|
|
|
2381 |
special = jQuery.event.special[ type ] || {};
|
2382 |
type = ( selector ? special.delegateType : special.bindType ) || type;
|
2383 |
handlers = events[ type ] || [];
|
2384 |
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
|
|
|
2385 |
// Remove matching events
|
2386 |
origCount = j = handlers.length;
|
2387 |
while ( j-- ) {
|
2388 |
handleObj = handlers[ j ];
|
|
|
2389 |
if ( ( mappedTypes || origType === handleObj.origType ) &&
|
2390 |
( !handler || handler.guid === handleObj.guid ) &&
|
2391 |
( !tmp || tmp.test( handleObj.namespace ) ) &&
|
2392 |
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
|
2393 |
handlers.splice( j, 1 );
|
|
|
2394 |
if ( handleObj.selector ) {
|
2395 |
handlers.delegateCount--;
|
2396 |
}
|
@@ -2399,38 +2878,49 @@ jQuery.event = {
|
|
2399 |
}
|
2400 |
}
|
2401 |
}
|
|
|
2402 |
// Remove generic event handler if we removed something and no more handlers exist
|
2403 |
// (avoids potential for endless recursion during removal of special event handlers)
|
2404 |
if ( origCount && !handlers.length ) {
|
2405 |
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
|
2406 |
jQuery.removeEvent( elem, type, elemData.handle );
|
2407 |
}
|
|
|
|
|
|
|
2408 |
delete events[ type ];
|
2409 |
}
|
2410 |
}
|
|
|
2411 |
// Remove the expando if it's no longer used
|
2412 |
if ( jQuery.isEmptyObject( events ) ) {
|
2413 |
delete elemData.handle;
|
|
|
2414 |
// removeData also checks for emptiness and clears the expando if empty
|
2415 |
// so use it instead of delete
|
2416 |
jQuery._removeData( elem, "events" );
|
2417 |
}
|
2418 |
},
|
|
|
2419 |
trigger: function( event, data, elem, onlyHandlers ) {
|
2420 |
var handle, ontype, cur,
|
2421 |
bubbleType, special, tmp, i,
|
2422 |
eventPath = [ elem || document ],
|
2423 |
type = core_hasOwn.call( event, "type" ) ? event.type : event,
|
2424 |
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
|
|
|
2425 |
cur = tmp = elem = elem || document;
|
|
|
2426 |
// Don't do events on text and comment nodes
|
2427 |
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
2428 |
return;
|
2429 |
}
|
|
|
2430 |
// focus/blur morphs to focusin/out; ensure we're not firing them right now
|
2431 |
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
|
2432 |
return;
|
2433 |
}
|
|
|
2434 |
if ( type.indexOf(".") >= 0 ) {
|
2435 |
// Namespaced trigger; create a regexp to match event type in handle()
|
2436 |
namespaces = type.split(".");
|
@@ -2438,32 +2928,39 @@ jQuery.event = {
|
|
2438 |
namespaces.sort();
|
2439 |
}
|
2440 |
ontype = type.indexOf(":") < 0 && "on" + type;
|
|
|
2441 |
// Caller can pass in a jQuery.Event object, Object, or just an event type string
|
2442 |
event = event[ jQuery.expando ] ?
|
2443 |
event :
|
2444 |
new jQuery.Event( type, typeof event === "object" && event );
|
|
|
2445 |
event.isTrigger = true;
|
2446 |
event.namespace = namespaces.join(".");
|
2447 |
event.namespace_re = event.namespace ?
|
2448 |
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
|
2449 |
null;
|
|
|
2450 |
// Clean up the event in case it is being reused
|
2451 |
event.result = undefined;
|
2452 |
if ( !event.target ) {
|
2453 |
event.target = elem;
|
2454 |
}
|
|
|
2455 |
// Clone any incoming data and prepend the event, creating the handler arg list
|
2456 |
data = data == null ?
|
2457 |
[ event ] :
|
2458 |
jQuery.makeArray( data, [ event ] );
|
|
|
2459 |
// Allow special events to draw outside the lines
|
2460 |
special = jQuery.event.special[ type ] || {};
|
2461 |
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
|
2462 |
return;
|
2463 |
}
|
|
|
2464 |
// Determine event propagation path in advance, per W3C events spec (#9951)
|
2465 |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
2466 |
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
|
|
|
2467 |
bubbleType = special.delegateType || type;
|
2468 |
if ( !rfocusMorph.test( bubbleType + type ) ) {
|
2469 |
cur = cur.parentNode;
|
@@ -2472,22 +2969,27 @@ jQuery.event = {
|
|
2472 |
eventPath.push( cur );
|
2473 |
tmp = cur;
|
2474 |
}
|
|
|
2475 |
// Only add window if we got to document (e.g., not plain obj or detached DOM)
|
2476 |
if ( tmp === (elem.ownerDocument || document) ) {
|
2477 |
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
|
2478 |
}
|
2479 |
}
|
|
|
2480 |
// Fire handlers on the event path
|
2481 |
i = 0;
|
2482 |
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
|
|
|
2483 |
event.type = i > 1 ?
|
2484 |
bubbleType :
|
2485 |
special.bindType || type;
|
|
|
2486 |
// jQuery handler
|
2487 |
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
|
2488 |
if ( handle ) {
|
2489 |
handle.apply( cur, data );
|
2490 |
}
|
|
|
2491 |
// Native handler
|
2492 |
handle = ontype && cur[ ontype ];
|
2493 |
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
|
@@ -2495,19 +2997,25 @@ jQuery.event = {
|
|
2495 |
}
|
2496 |
}
|
2497 |
event.type = type;
|
|
|
2498 |
// If nobody prevented the default action, do it now
|
2499 |
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
|
|
|
2500 |
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
|
2501 |
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
|
|
|
2502 |
// Call a native DOM method on the target with the same name name as the event.
|
2503 |
// Can't use an .isFunction() check here because IE6/7 fails that test.
|
2504 |
// Don't do default actions on window, that's where global variables be (#6170)
|
2505 |
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
|
|
|
2506 |
// Don't re-trigger an onFOO event when we call its FOO() method
|
2507 |
tmp = elem[ ontype ];
|
|
|
2508 |
if ( tmp ) {
|
2509 |
elem[ ontype ] = null;
|
2510 |
}
|
|
|
2511 |
// Prevent re-triggering of the same event, since we already bubbled it above
|
2512 |
jQuery.event.triggered = type;
|
2513 |
try {
|
@@ -2517,44 +3025,58 @@ jQuery.event = {
|
|
2517 |
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
|
2518 |
}
|
2519 |
jQuery.event.triggered = undefined;
|
|
|
2520 |
if ( tmp ) {
|
2521 |
elem[ ontype ] = tmp;
|
2522 |
}
|
2523 |
}
|
2524 |
}
|
2525 |
}
|
|
|
2526 |
return event.result;
|
2527 |
},
|
|
|
2528 |
dispatch: function( event ) {
|
|
|
2529 |
// Make a writable jQuery.Event from the native event object
|
2530 |
event = jQuery.event.fix( event );
|
|
|
2531 |
var i, ret, handleObj, matched, j,
|
2532 |
handlerQueue = [],
|
2533 |
args = core_slice.call( arguments ),
|
2534 |
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
|
2535 |
special = jQuery.event.special[ event.type ] || {};
|
|
|
2536 |
// Use the fix-ed jQuery.Event rather than the (read-only) native event
|
2537 |
args[0] = event;
|
2538 |
event.delegateTarget = this;
|
|
|
2539 |
// Call the preDispatch hook for the mapped type, and let it bail if desired
|
2540 |
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
2541 |
return;
|
2542 |
}
|
|
|
2543 |
// Determine handlers
|
2544 |
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
|
|
|
2545 |
// Run delegates first; they may want to stop propagation beneath us
|
2546 |
i = 0;
|
2547 |
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
|
2548 |
event.currentTarget = matched.elem;
|
|
|
2549 |
j = 0;
|
2550 |
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
|
|
|
2551 |
// Triggered event must either 1) have no namespace, or
|
2552 |
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
|
2553 |
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
|
|
|
2554 |
event.handleObj = handleObj;
|
2555 |
event.data = handleObj.data;
|
|
|
2556 |
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
|
2557 |
.apply( matched.elem, args );
|
|
|
2558 |
if ( ret !== undefined ) {
|
2559 |
if ( (event.result = ret) === false ) {
|
2560 |
event.preventDefault();
|
@@ -2564,30 +3086,38 @@ jQuery.event = {
|
|
2564 |
}
|
2565 |
}
|
2566 |
}
|
|
|
2567 |
// Call the postDispatch hook for the mapped type
|
2568 |
if ( special.postDispatch ) {
|
2569 |
special.postDispatch.call( this, event );
|
2570 |
}
|
|
|
2571 |
return event.result;
|
2572 |
},
|
|
|
2573 |
handlers: function( event, handlers ) {
|
2574 |
var sel, handleObj, matches, i,
|
2575 |
handlerQueue = [],
|
2576 |
delegateCount = handlers.delegateCount,
|
2577 |
cur = event.target;
|
|
|
2578 |
// Find delegate handlers
|
2579 |
// Black-hole SVG <use> instance trees (#13180)
|
2580 |
// Avoid non-left-click bubbling in Firefox (#3861)
|
2581 |
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
|
|
|
2582 |
for ( ; cur != this; cur = cur.parentNode || this ) {
|
|
|
2583 |
// Don't check non-elements (#13208)
|
2584 |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
|
2585 |
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
|
2586 |
matches = [];
|
2587 |
for ( i = 0; i < delegateCount; i++ ) {
|
2588 |
handleObj = handlers[ i ];
|
|
|
2589 |
// Don't conflict with Object.prototype properties (#13203)
|
2590 |
sel = handleObj.selector + " ";
|
|
|
2591 |
if ( matches[ sel ] === undefined ) {
|
2592 |
matches[ sel ] = handleObj.needsContext ?
|
2593 |
jQuery( sel, this ).index( cur ) >= 0 :
|
@@ -2603,21 +3133,26 @@ jQuery.event = {
|
|
2603 |
}
|
2604 |
}
|
2605 |
}
|
|
|
2606 |
// Add the remaining (directly-bound) handlers
|
2607 |
if ( delegateCount < handlers.length ) {
|
2608 |
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
|
2609 |
}
|
|
|
2610 |
return handlerQueue;
|
2611 |
},
|
|
|
2612 |
fix: function( event ) {
|
2613 |
if ( event[ jQuery.expando ] ) {
|
2614 |
return event;
|
2615 |
}
|
|
|
2616 |
// Create a writable copy of the event object and normalize some properties
|
2617 |
var i, prop, copy,
|
2618 |
type = event.type,
|
2619 |
originalEvent = event,
|
2620 |
fixHook = this.fixHooks[ type ];
|
|
|
2621 |
if ( !fixHook ) {
|
2622 |
this.fixHooks[ type ] = fixHook =
|
2623 |
rmouseEvent.test( type ) ? this.mouseHooks :
|
@@ -2625,66 +3160,84 @@ jQuery.event = {
|
|
2625 |
{};
|
2626 |
}
|
2627 |
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
|
|
|
2628 |
event = new jQuery.Event( originalEvent );
|
|
|
2629 |
i = copy.length;
|
2630 |
while ( i-- ) {
|
2631 |
prop = copy[ i ];
|
2632 |
event[ prop ] = originalEvent[ prop ];
|
2633 |
}
|
|
|
2634 |
// Support: IE<9
|
2635 |
// Fix target property (#1925)
|
2636 |
if ( !event.target ) {
|
2637 |
event.target = originalEvent.srcElement || document;
|
2638 |
}
|
|
|
2639 |
// Support: Chrome 23+, Safari?
|
2640 |
// Target should not be a text node (#504, #13143)
|
2641 |
if ( event.target.nodeType === 3 ) {
|
2642 |
event.target = event.target.parentNode;
|
2643 |
}
|
|
|
2644 |
// Support: IE<9
|
2645 |
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
|
2646 |
event.metaKey = !!event.metaKey;
|
|
|
2647 |
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
2648 |
},
|
|
|
2649 |
// Includes some event props shared by KeyEvent and MouseEvent
|
2650 |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
|
|
|
2651 |
fixHooks: {},
|
|
|
2652 |
keyHooks: {
|
2653 |
props: "char charCode key keyCode".split(" "),
|
2654 |
filter: function( event, original ) {
|
|
|
2655 |
// Add which for key events
|
2656 |
if ( event.which == null ) {
|
2657 |
event.which = original.charCode != null ? original.charCode : original.keyCode;
|
2658 |
}
|
|
|
2659 |
return event;
|
2660 |
}
|
2661 |
},
|
|
|
2662 |
mouseHooks: {
|
2663 |
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
|
2664 |
filter: function( event, original ) {
|
2665 |
var body, eventDoc, doc,
|
2666 |
button = original.button,
|
2667 |
fromElement = original.fromElement;
|
|
|
2668 |
// Calculate pageX/Y if missing and clientX/Y available
|
2669 |
if ( event.pageX == null && original.clientX != null ) {
|
2670 |
eventDoc = event.target.ownerDocument || document;
|
2671 |
doc = eventDoc.documentElement;
|
2672 |
body = eventDoc.body;
|
|
|
2673 |
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
|
2674 |
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
|
2675 |
}
|
|
|
2676 |
// Add relatedTarget, if necessary
|
2677 |
if ( !event.relatedTarget && fromElement ) {
|
2678 |
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
|
2679 |
}
|
|
|
2680 |
// Add which for click: 1 === left; 2 === middle; 3 === right
|
2681 |
// Note: button is not normalized, so don't use it
|
2682 |
if ( !event.which && button !== undefined ) {
|
2683 |
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
2684 |
}
|
|
|
2685 |
return event;
|
2686 |
}
|
2687 |
},
|
|
|
2688 |
special: {
|
2689 |
load: {
|
2690 |
// Prevent triggered image.load events from bubbling to window.load
|
@@ -2724,8 +3277,10 @@ jQuery.event = {
|
|
2724 |
},
|
2725 |
delegateType: "focusout"
|
2726 |
},
|
|
|
2727 |
beforeunload: {
|
2728 |
postDispatch: function( event ) {
|
|
|
2729 |
// Even when returnValue equals to undefined Firefox will still show alert
|
2730 |
if ( event.result !== undefined ) {
|
2731 |
event.originalEvent.returnValue = event.result;
|
@@ -2733,6 +3288,7 @@ jQuery.event = {
|
|
2733 |
}
|
2734 |
}
|
2735 |
},
|
|
|
2736 |
simulate: function( type, elem, event, bubble ) {
|
2737 |
// Piggyback on a donor event to simulate a different one.
|
2738 |
// Fake originalEvent to avoid donor's stopPropagation, but if the
|
@@ -2755,6 +3311,7 @@ jQuery.event = {
|
|
2755 |
}
|
2756 |
}
|
2757 |
};
|
|
|
2758 |
jQuery.removeEvent = document.removeEventListener ?
|
2759 |
function( elem, type, handle ) {
|
2760 |
if ( elem.removeEventListener ) {
|
@@ -2763,56 +3320,71 @@ jQuery.removeEvent = document.removeEventListener ?
|
|
2763 |
} :
|
2764 |
function( elem, type, handle ) {
|
2765 |
var name = "on" + type;
|
|
|
2766 |
if ( elem.detachEvent ) {
|
|
|
2767 |
// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
2768 |
// detachEvent needed property on element, by name of that event, to properly expose it to GC
|
2769 |
if ( typeof elem[ name ] === core_strundefined ) {
|
2770 |
elem[ name ] = null;
|
2771 |
}
|
|
|
2772 |
elem.detachEvent( name, handle );
|
2773 |
}
|
2774 |
};
|
|
|
2775 |
jQuery.Event = function( src, props ) {
|
2776 |
// Allow instantiation without the 'new' keyword
|
2777 |
if ( !(this instanceof jQuery.Event) ) {
|
2778 |
return new jQuery.Event( src, props );
|
2779 |
}
|
|
|
2780 |
// Event object
|
2781 |
if ( src && src.type ) {
|
2782 |
this.originalEvent = src;
|
2783 |
this.type = src.type;
|
|
|
2784 |
// Events bubbling up the document may have been marked as prevented
|
2785 |
// by a handler lower down the tree; reflect the correct value.
|
2786 |
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
|
2787 |
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
|
|
|
2788 |
// Event type
|
2789 |
} else {
|
2790 |
this.type = src;
|
2791 |
}
|
|
|
2792 |
// Put explicitly provided properties onto the event object
|
2793 |
if ( props ) {
|
2794 |
jQuery.extend( this, props );
|
2795 |
}
|
|
|
2796 |
// Create a timestamp if incoming event doesn't have one
|
2797 |
this.timeStamp = src && src.timeStamp || jQuery.now();
|
|
|
2798 |
// Mark it as fixed
|
2799 |
this[ jQuery.expando ] = true;
|
2800 |
};
|
|
|
2801 |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
2802 |
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
2803 |
jQuery.Event.prototype = {
|
2804 |
isDefaultPrevented: returnFalse,
|
2805 |
isPropagationStopped: returnFalse,
|
2806 |
isImmediatePropagationStopped: returnFalse,
|
|
|
2807 |
preventDefault: function() {
|
2808 |
var e = this.originalEvent;
|
|
|
2809 |
this.isDefaultPrevented = returnTrue;
|
2810 |
if ( !e ) {
|
2811 |
return;
|
2812 |
}
|
|
|
2813 |
// If preventDefault exists, run it on the original event
|
2814 |
if ( e.preventDefault ) {
|
2815 |
e.preventDefault();
|
|
|
2816 |
// Support: IE
|
2817 |
// Otherwise set the returnValue property of the original event to false
|
2818 |
} else {
|
@@ -2821,6 +3393,7 @@ jQuery.Event.prototype = {
|
|
2821 |
},
|
2822 |
stopPropagation: function() {
|
2823 |
var e = this.originalEvent;
|
|
|
2824 |
this.isPropagationStopped = returnTrue;
|
2825 |
if ( !e ) {
|
2826 |
return;
|
@@ -2829,6 +3402,7 @@ jQuery.Event.prototype = {
|
|
2829 |
if ( e.stopPropagation ) {
|
2830 |
e.stopPropagation();
|
2831 |
}
|
|
|
2832 |
// Support: IE
|
2833 |
// Set the cancelBubble property of the original event to true
|
2834 |
e.cancelBubble = true;
|
@@ -2838,6 +3412,7 @@ jQuery.Event.prototype = {
|
|
2838 |
this.stopPropagation();
|
2839 |
}
|
2840 |
};
|
|
|
2841 |
// Create mouseenter/leave events using mouseover/out and event-time checks
|
2842 |
jQuery.each({
|
2843 |
mouseenter: "mouseover",
|
@@ -2846,11 +3421,13 @@ jQuery.each({
|
|
2846 |
jQuery.event.special[ orig ] = {
|
2847 |
delegateType: fix,
|
2848 |
bindType: fix,
|
|
|
2849 |
handle: function( event ) {
|
2850 |
var ret,
|
2851 |
target = this,
|
2852 |
related = event.relatedTarget,
|
2853 |
handleObj = event.handleObj;
|
|
|
2854 |
// For mousenter/leave call the handler if related is outside the target.
|
2855 |
// NB: No relatedTarget if the mouse left/entered the browser window
|
2856 |
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
|
@@ -2862,14 +3439,17 @@ jQuery.each({
|
|
2862 |
}
|
2863 |
};
|
2864 |
});
|
|
|
2865 |
// IE submit delegation
|
2866 |
if ( !jQuery.support.submitBubbles ) {
|
|
|
2867 |
jQuery.event.special.submit = {
|
2868 |
setup: function() {
|
2869 |
// Only need this for delegated form submit events
|
2870 |
if ( jQuery.nodeName( this, "form" ) ) {
|
2871 |
return false;
|
2872 |
}
|
|
|
2873 |
// Lazy-add a submit handler when a descendant form may potentially be submitted
|
2874 |
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
|
2875 |
// Node name check avoids a VML-related crash in IE (#9807)
|
@@ -2884,6 +3464,7 @@ if ( !jQuery.support.submitBubbles ) {
|
|
2884 |
});
|
2885 |
// return undefined since we don't need an event listener
|
2886 |
},
|
|
|
2887 |
postDispatch: function( event ) {
|
2888 |
// If form was submitted by the user, bubble the event up the tree
|
2889 |
if ( event._submit_bubble ) {
|
@@ -2893,20 +3474,26 @@ if ( !jQuery.support.submitBubbles ) {
|
|
2893 |
}
|
2894 |
}
|
2895 |
},
|
|
|
2896 |
teardown: function() {
|
2897 |
// Only need this for delegated form submit events
|
2898 |
if ( jQuery.nodeName( this, "form" ) ) {
|
2899 |
return false;
|
2900 |
}
|
|
|
2901 |
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
|
2902 |
jQuery.event.remove( this, "._submit" );
|
2903 |
}
|
2904 |
};
|
2905 |
}
|
|
|
2906 |
// IE change delegation and checkbox/radio fix
|
2907 |
if ( !jQuery.support.changeBubbles ) {
|
|
|
2908 |
jQuery.event.special.change = {
|
|
|
2909 |
setup: function() {
|
|
|
2910 |
if ( rformElems.test( this.nodeName ) ) {
|
2911 |
// IE doesn't fire change on a check/radio until blur; trigger it on click
|
2912 |
// after a propertychange. Eat the blur-change in special.change.handle.
|
@@ -2930,6 +3517,7 @@ if ( !jQuery.support.changeBubbles ) {
|
|
2930 |
// Delegated event; lazy-add a change handler on descendant inputs
|
2931 |
jQuery.event.add( this, "beforeactivate._change", function( e ) {
|
2932 |
var elem = e.target;
|
|
|
2933 |
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
|
2934 |
jQuery.event.add( elem, "change._change", function( event ) {
|
2935 |
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
|
@@ -2940,27 +3528,34 @@ if ( !jQuery.support.changeBubbles ) {
|
|
2940 |
}
|
2941 |
});
|
2942 |
},
|
|
|
2943 |
handle: function( event ) {
|
2944 |
var elem = event.target;
|
|
|
2945 |
// Swallow native change events from checkbox/radio, we already triggered them above
|
2946 |
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
|
2947 |
return event.handleObj.handler.apply( this, arguments );
|
2948 |
}
|
2949 |
},
|
|
|
2950 |
teardown: function() {
|
2951 |
jQuery.event.remove( this, "._change" );
|
|
|
2952 |
return !rformElems.test( this.nodeName );
|
2953 |
}
|
2954 |
};
|
2955 |
}
|
|
|
2956 |
// Create "bubbling" focus and blur events
|
2957 |
if ( !jQuery.support.focusinBubbles ) {
|
2958 |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
|
|
2959 |
// Attach a single capturing handler while someone wants focusin/focusout
|
2960 |
var attaches = 0,
|
2961 |
handler = function( event ) {
|
2962 |
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
|
2963 |
};
|
|
|
2964 |
jQuery.event.special[ fix ] = {
|
2965 |
setup: function() {
|
2966 |
if ( attaches++ === 0 ) {
|
@@ -2975,9 +3570,12 @@ if ( !jQuery.support.focusinBubbles ) {
|
|
2975 |
};
|
2976 |
});
|
2977 |
}
|
|
|
2978 |
jQuery.fn.extend({
|
|
|
2979 |
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
|
2980 |
var type, origFn;
|
|
|
2981 |
// Types can be a map of types/handlers
|
2982 |
if ( typeof types === "object" ) {
|
2983 |
// ( types-Object, selector, data )
|
@@ -2991,6 +3589,7 @@ jQuery.fn.extend({
|
|
2991 |
}
|
2992 |
return this;
|
2993 |
}
|
|
|
2994 |
if ( data == null && fn == null ) {
|
2995 |
// ( types, fn )
|
2996 |
fn = selector;
|
@@ -3012,6 +3611,7 @@ jQuery.fn.extend({
|
|
3012 |
} else if ( !fn ) {
|
3013 |
return this;
|
3014 |
}
|
|
|
3015 |
if ( one === 1 ) {
|
3016 |
origFn = fn;
|
3017 |
fn = function( event ) {
|
@@ -3060,12 +3660,14 @@ jQuery.fn.extend({
|
|
3060 |
jQuery.event.remove( this, types, fn, selector );
|
3061 |
});
|
3062 |
},
|
|
|
3063 |
bind: function( types, data, fn ) {
|
3064 |
return this.on( types, null, data, fn );
|
3065 |
},
|
3066 |
unbind: function( types, fn ) {
|
3067 |
return this.off( types, null, fn );
|
3068 |
},
|
|
|
3069 |
delegate: function( selector, types, data, fn ) {
|
3070 |
return this.on( types, selector, data, fn );
|
3071 |
},
|
@@ -3073,6 +3675,7 @@ jQuery.fn.extend({
|
|
3073 |
// ( namespace ) or ( selector, types [, fn] )
|
3074 |
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
|
3075 |
},
|
|
|
3076 |
trigger: function( type, data ) {
|
3077 |
return this.each(function() {
|
3078 |
jQuery.event.trigger( type, data, this );
|
@@ -3092,6 +3695,7 @@ jQuery.fn.extend({
|
|
3092 |
* http://sizzlejs.com/
|
3093 |
*/
|
3094 |
(function( window, undefined ) {
|
|
|
3095 |
var i,
|
3096 |
cachedruns,
|
3097 |
Expr,
|
@@ -3100,6 +3704,7 @@ var i,
|
|
3100 |
compile,
|
3101 |
hasDuplicate,
|
3102 |
outermostContext,
|
|
|
3103 |
// Local document vars
|
3104 |
setDocument,
|
3105 |
document,
|
@@ -3110,6 +3715,7 @@ var i,
|
|
3110 |
matches,
|
3111 |
contains,
|
3112 |
sortOrder,
|
|
|
3113 |
// Instance-specific data
|
3114 |
expando = "sizzle" + -(new Date()),
|
3115 |
preferredDoc = window.document,
|
@@ -3119,9 +3725,11 @@ var i,
|
|
3119 |
classCache = createCache(),
|
3120 |
tokenCache = createCache(),
|
3121 |
compilerCache = createCache(),
|
|
|
3122 |
// General-purpose constants
|
3123 |
strundefined = typeof undefined,
|
3124 |
MAX_NEGATIVE = 1 << 31,
|
|
|
3125 |
// Array methods
|
3126 |
arr = [],
|
3127 |
pop = arr.pop,
|
@@ -3138,19 +3746,25 @@ var i,
|
|
3138 |
}
|
3139 |
return -1;
|
3140 |
},
|
|
|
|
|
3141 |
// Regular expressions
|
|
|
3142 |
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
|
3143 |
whitespace = "[\\x20\\t\\r\\n\\f]",
|
3144 |
// http://www.w3.org/TR/css3-syntax/#characters
|
3145 |
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
|
|
|
3146 |
// Loosely modeled on CSS identifier characters
|
3147 |
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
|
3148 |
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
|
3149 |
identifier = characterEncoding.replace( "w", "w#" ),
|
|
|
3150 |
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
|
3151 |
operators = "([*^$|!~]?=)",
|
3152 |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
|
3153 |
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
|
|
|
3154 |
// Prefer arguments quoted,
|
3155 |
// then not containing pseudos/brackets,
|
3156 |
// then attribute selectors/non-parenthetical expressions,
|
@@ -3158,12 +3772,15 @@ var i,
|
|
3158 |
// These preferences are here to reduce the number of selectors
|
3159 |
// needing tokenize in the PSEUDO preFilter
|
3160 |
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
|
|
|
3161 |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
|
3162 |
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
|
|
|
3163 |
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
|
3164 |
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
|
3165 |
rpseudo = new RegExp( pseudos ),
|
3166 |
ridentifier = new RegExp( "^" + identifier + "$" ),
|
|
|
3167 |
matchExpr = {
|
3168 |
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
|
3169 |
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
|
@@ -3179,14 +3796,20 @@ var i,
|
|
3179 |
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
|
3180 |
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
|
3181 |
},
|
|
|
3182 |
rsibling = /[\x20\t\r\n\f]*[+~]/,
|
|
|
3183 |
rnative = /^[^{]+\{\s*\[native code/,
|
|
|
3184 |
// Easily-parseable/retrievable ID or TAG or CLASS selectors
|
3185 |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
|
|
|
3186 |
rinputs = /^(?:input|select|textarea|button)$/i,
|
3187 |
rheader = /^h\d$/i,
|
|
|
3188 |
rescape = /'|\\/g,
|
3189 |
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
|
|
|
3190 |
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
|
3191 |
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
|
3192 |
funescape = function( _, escaped ) {
|
@@ -3200,6 +3823,7 @@ var i,
|
|
3200 |
// Supplemental Plane codepoint (surrogate pair)
|
3201 |
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
|
3202 |
};
|
|
|
3203 |
// Use a stripped-down slice if we can't use a native one
|
3204 |
try {
|
3205 |
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
|
@@ -3213,6 +3837,7 @@ try {
|
|
3213 |
return results;
|
3214 |
};
|
3215 |
}
|
|
|
3216 |
/**
|
3217 |
* For feature detection
|
3218 |
* @param {Function} fn The function to test for native support
|
@@ -3220,6 +3845,7 @@ try {
|
|
3220 |
function isNative( fn ) {
|
3221 |
return rnative.test( fn + "" );
|
3222 |
}
|
|
|
3223 |
/**
|
3224 |
* Create key-value caches of limited size
|
3225 |
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
|
@@ -3229,6 +3855,7 @@ function isNative( fn ) {
|
|
3229 |
function createCache() {
|
3230 |
var cache,
|
3231 |
keys = [];
|
|
|
3232 |
return (cache = function( key, value ) {
|
3233 |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
|
3234 |
if ( keys.push( key += " " ) > Expr.cacheLength ) {
|
@@ -3238,6 +3865,7 @@ function createCache() {
|
|
3238 |
return (cache[ key ] = value);
|
3239 |
});
|
3240 |
}
|
|
|
3241 |
/**
|
3242 |
* Mark a function for special use by Sizzle
|
3243 |
* @param {Function} fn The function to mark
|
@@ -3246,12 +3874,14 @@ function markFunction( fn ) {
|
|
3246 |
fn[ expando ] = true;
|
3247 |
return fn;
|
3248 |
}
|
|
|
3249 |
/**
|
3250 |
* Support testing using an element
|
3251 |
* @param {Function} fn Passed the created div and expects a boolean result
|
3252 |
*/
|
3253 |
function assert( fn ) {
|
3254 |
var div = document.createElement("div");
|
|
|
3255 |
try {
|
3256 |
return fn( div );
|
3257 |
} catch (e) {
|
@@ -3261,22 +3891,29 @@ function assert( fn ) {
|
|
3261 |
div = null;
|
3262 |
}
|
3263 |
}
|
|
|
3264 |
function Sizzle( selector, context, results, seed ) {
|
3265 |
var match, elem, m, nodeType,
|
3266 |
// QSA vars
|
3267 |
i, groups, old, nid, newContext, newSelector;
|
|
|
3268 |
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
|
3269 |
setDocument( context );
|
3270 |
}
|
|
|
3271 |
context = context || document;
|
3272 |
results = results || [];
|
|
|
3273 |
if ( !selector || typeof selector !== "string" ) {
|
3274 |
return results;
|
3275 |
}
|
|
|
3276 |
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
|
3277 |
return [];
|
3278 |
}
|
|
|
3279 |
if ( !documentIsXML && !seed ) {
|
|
|
3280 |
// Shortcuts
|
3281 |
if ( (match = rquickExpr.exec( selector )) ) {
|
3282 |
// Speed-up: Sizzle("#ID")
|
@@ -3303,34 +3940,40 @@ function Sizzle( selector, context, results, seed ) {
|
|
3303 |
return results;
|
3304 |
}
|
3305 |
}
|
|
|
3306 |
// Speed-up: Sizzle("TAG")
|
3307 |
} else if ( match[2] ) {
|
3308 |
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
|
3309 |
return results;
|
|
|
3310 |
// Speed-up: Sizzle(".CLASS")
|
3311 |
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
|
3312 |
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
|
3313 |
return results;
|
3314 |
}
|
3315 |
}
|
|
|
3316 |
// QSA path
|
3317 |
if ( support.qsa && !rbuggyQSA.test(selector) ) {
|
3318 |
old = true;
|
3319 |
nid = expando;
|
3320 |
newContext = context;
|
3321 |
newSelector = nodeType === 9 && selector;
|
|
|
3322 |
// qSA works strangely on Element-rooted queries
|
3323 |
// We can work around this by specifying an extra ID on the root
|
3324 |
// and working up from there (Thanks to Andrew Dupont for the technique)
|
3325 |
// IE 8 doesn't work on object elements
|
3326 |
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
3327 |
groups = tokenize( selector );
|
|
|
3328 |
if ( (old = context.getAttribute("id")) ) {
|
3329 |
nid = old.replace( rescape, "\\$&" );
|
3330 |
} else {
|
3331 |
context.setAttribute( "id", nid );
|
3332 |
}
|
3333 |
nid = "[id='" + nid + "'] ";
|
|
|
3334 |
i = groups.length;
|
3335 |
while ( i-- ) {
|
3336 |
groups[i] = nid + toSelector( groups[i] );
|
@@ -3338,6 +3981,7 @@ function Sizzle( selector, context, results, seed ) {
|
|
3338 |
newContext = rsibling.test( selector ) && context.parentNode || context;
|
3339 |
newSelector = groups.join(",");
|
3340 |
}
|
|
|
3341 |
if ( newSelector ) {
|
3342 |
try {
|
3343 |
push.apply( results, slice.call( newContext.querySelectorAll(
|
@@ -3353,9 +3997,11 @@ function Sizzle( selector, context, results, seed ) {
|
|
3353 |
}
|
3354 |
}
|
3355 |
}
|
|
|
3356 |
// All others
|
3357 |
return select( selector.replace( rtrim, "$1" ), context, results, seed );
|
3358 |
}
|
|
|
3359 |
/**
|
3360 |
* Detect xml
|
3361 |
* @param {Element|Object} elem An element or a document
|
@@ -3366,6 +4012,7 @@ isXML = Sizzle.isXML = function( elem ) {
|
|
3366 |
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
|
3367 |
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
3368 |
};
|
|
|
3369 |
/**
|
3370 |
* Sets document-related variables once based on the current document
|
3371 |
* @param {Element|Object} [doc] An element or document object to use to set the document
|
@@ -3373,20 +4020,25 @@ isXML = Sizzle.isXML = function( elem ) {
|
|
3373 |
*/
|
3374 |
setDocument = Sizzle.setDocument = function( node ) {
|
3375 |
var doc = node ? node.ownerDocument || node : preferredDoc;
|
|
|
3376 |
// If no document and documentElement is available, return
|
3377 |
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
|
3378 |
return document;
|
3379 |
}
|
|
|
3380 |
// Set our document
|
3381 |
document = doc;
|
3382 |
docElem = doc.documentElement;
|
|
|
3383 |
// Support tests
|
3384 |
documentIsXML = isXML( doc );
|
|
|
3385 |
// Check if getElementsByTagName("*") returns only elements
|
3386 |
support.tagNameNoComments = assert(function( div ) {
|
3387 |
div.appendChild( doc.createComment("") );
|
3388 |
return !div.getElementsByTagName("*").length;
|
3389 |
});
|
|
|
3390 |
// Check if attributes should be retrieved by attribute nodes
|
3391 |
support.attributes = assert(function( div ) {
|
3392 |
div.innerHTML = "<select></select>";
|
@@ -3394,6 +4046,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3394 |
// IE8 returns a string for some attributes even when not present
|
3395 |
return type !== "boolean" && type !== "string";
|
3396 |
});
|
|
|
3397 |
// Check if getElementsByClassName can be trusted
|
3398 |
support.getByClassName = assert(function( div ) {
|
3399 |
// Opera can't find a second classname (in 9.6)
|
@@ -3401,10 +4054,12 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3401 |
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
|
3402 |
return false;
|
3403 |
}
|
|
|
3404 |
// Safari 3.2 caches class attributes and doesn't catch changes
|
3405 |
div.lastChild.className = "e";
|
3406 |
return div.getElementsByClassName("e").length === 2;
|
3407 |
});
|
|
|
3408 |
// Check if getElementById returns elements by name
|
3409 |
// Check if getElementsByName privileges form controls or returns elements by ID
|
3410 |
support.getByName = assert(function( div ) {
|
@@ -3412,6 +4067,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3412 |
div.id = expando + 0;
|
3413 |
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
|
3414 |
docElem.insertBefore( div, docElem.firstChild );
|
|
|
3415 |
// Test
|
3416 |
var pass = doc.getElementsByName &&
|
3417 |
// buggy browsers will return fewer than the correct 2
|
@@ -3419,10 +4075,13 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3419 |
// buggy browsers will return more than the correct 0
|
3420 |
doc.getElementsByName( expando + 0 ).length;
|
3421 |
support.getIdNotName = !doc.getElementById( expando );
|
|
|
3422 |
// Cleanup
|
3423 |
docElem.removeChild( div );
|
|
|
3424 |
return pass;
|
3425 |
});
|
|
|
3426 |
// IE6/7 return modified attributes
|
3427 |
Expr.attrHandle = assert(function( div ) {
|
3428 |
div.innerHTML = "<a href='#'></a>";
|
@@ -3438,6 +4097,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3438 |
return elem.getAttribute("type");
|
3439 |
}
|
3440 |
};
|
|
|
3441 |
// ID find and filter
|
3442 |
if ( support.getIdNotName ) {
|
3443 |
Expr.find["ID"] = function( id, context ) {
|
@@ -3458,6 +4118,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3458 |
Expr.find["ID"] = function( id, context ) {
|
3459 |
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
|
3460 |
var m = context.getElementById( id );
|
|
|
3461 |
return m ?
|
3462 |
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
|
3463 |
[m] :
|
@@ -3473,6 +4134,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3473 |
};
|
3474 |
};
|
3475 |
}
|
|
|
3476 |
// Tag
|
3477 |
Expr.find["TAG"] = support.tagNameNoComments ?
|
3478 |
function( tag, context ) {
|
@@ -3485,6 +4147,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3485 |
tmp = [],
|
3486 |
i = 0,
|
3487 |
results = context.getElementsByTagName( tag );
|
|
|
3488 |
// Filter out possible comments
|
3489 |
if ( tag === "*" ) {
|
3490 |
while ( (elem = results[i++]) ) {
|
@@ -3492,29 +4155,36 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3492 |
tmp.push( elem );
|
3493 |
}
|
3494 |
}
|
|
|
3495 |
return tmp;
|
3496 |
}
|
3497 |
return results;
|
3498 |
};
|
|
|
3499 |
// Name
|
3500 |
Expr.find["NAME"] = support.getByName && function( tag, context ) {
|
3501 |
if ( typeof context.getElementsByName !== strundefined ) {
|
3502 |
return context.getElementsByName( name );
|
3503 |
}
|
3504 |
};
|
|
|
3505 |
// Class
|
3506 |
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
|
3507 |
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
|
3508 |
return context.getElementsByClassName( className );
|
3509 |
}
|
3510 |
};
|
|
|
3511 |
// QSA and matchesSelector support
|
|
|
3512 |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
3513 |
rbuggyMatches = [];
|
|
|
3514 |
// qSa(:focus) reports false when true (Chrome 21),
|
3515 |
// no need to also add to buggyMatches since matches checks buggyQSA
|
3516 |
// A support test would require too much code (would include document ready)
|
3517 |
rbuggyQSA = [ ":focus" ];
|
|
|
3518 |
if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
|
3519 |
// Build QSA regex
|
3520 |
// Regex strategy adopted from Diego Perini
|
@@ -3525,10 +4195,12 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3525 |
// since its presence should be enough
|
3526 |
// http://bugs.jquery.com/ticket/12359
|
3527 |
div.innerHTML = "<select><option selected=''></option></select>";
|
|
|
3528 |
// IE8 - Some boolean attributes are not treated correctly
|
3529 |
if ( !div.querySelectorAll("[selected]").length ) {
|
3530 |
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
|
3531 |
}
|
|
|
3532 |
// Webkit/Opera - :checked should return selected option elements
|
3533 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
3534 |
// IE8 throws error here and will not see later tests
|
@@ -3536,40 +4208,49 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3536 |
rbuggyQSA.push(":checked");
|
3537 |
}
|
3538 |
});
|
|
|
3539 |
assert(function( div ) {
|
|
|
3540 |
// Opera 10-12/IE8 - ^= $= *= and empty values
|
3541 |
// Should not select anything
|
3542 |
div.innerHTML = "<input type='hidden' i=''/>";
|
3543 |
if ( div.querySelectorAll("[i^='']").length ) {
|
3544 |
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
|
3545 |
}
|
|
|
3546 |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
|
3547 |
// IE8 throws error here and will not see later tests
|
3548 |
if ( !div.querySelectorAll(":enabled").length ) {
|
3549 |
rbuggyQSA.push( ":enabled", ":disabled" );
|
3550 |
}
|
|
|
3551 |
// Opera 10-11 does not throw on post-comma invalid pseudos
|
3552 |
div.querySelectorAll("*,:x");
|
3553 |
rbuggyQSA.push(",.*:");
|
3554 |
});
|
3555 |
}
|
|
|
3556 |
if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
|
3557 |
docElem.mozMatchesSelector ||
|
3558 |
docElem.webkitMatchesSelector ||
|
3559 |
docElem.oMatchesSelector ||
|
3560 |
docElem.msMatchesSelector) )) ) {
|
|
|
3561 |
assert(function( div ) {
|
3562 |
// Check to see if it's possible to do matchesSelector
|
3563 |
// on a disconnected node (IE 9)
|
3564 |
support.disconnectedMatch = matches.call( div, "div" );
|
|
|
3565 |
// This should fail with an exception
|
3566 |
// Gecko does not error, returns false instead
|
3567 |
matches.call( div, "[s!='']:x" );
|
3568 |
rbuggyMatches.push( "!=", pseudos );
|
3569 |
});
|
3570 |
}
|
|
|
3571 |
rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
|
3572 |
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
|
|
|
3573 |
// Element contains another
|
3574 |
// Purposefully does not implement inclusive descendent
|
3575 |
// As in, an element does not contain itself
|
@@ -3593,14 +4274,17 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3593 |
}
|
3594 |
return false;
|
3595 |
};
|
|
|
3596 |
// Document order sorting
|
3597 |
sortOrder = docElem.compareDocumentPosition ?
|
3598 |
function( a, b ) {
|
3599 |
var compare;
|
|
|
3600 |
if ( a === b ) {
|
3601 |
hasDuplicate = true;
|
3602 |
return 0;
|
3603 |
}
|
|
|
3604 |
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
|
3605 |
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
|
3606 |
if ( a === doc || contains( preferredDoc, a ) ) {
|
@@ -3613,6 +4297,7 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3613 |
}
|
3614 |
return compare & 4 ? -1 : 1;
|
3615 |
}
|
|
|
3616 |
return a.compareDocumentPosition ? -1 : 1;
|
3617 |
} :
|
3618 |
function( a, b ) {
|
@@ -3622,10 +4307,12 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3622 |
bup = b.parentNode,
|
3623 |
ap = [ a ],
|
3624 |
bp = [ b ];
|
|
|
3625 |
// Exit early if the nodes are identical
|
3626 |
if ( a === b ) {
|
3627 |
hasDuplicate = true;
|
3628 |
return 0;
|
|
|
3629 |
// Parentless nodes are either documents or disconnected
|
3630 |
} else if ( !aup || !bup ) {
|
3631 |
return a === doc ? -1 :
|
@@ -3633,10 +4320,12 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3633 |
aup ? -1 :
|
3634 |
bup ? 1 :
|
3635 |
0;
|
|
|
3636 |
// If the nodes are siblings, we can do a quick check
|
3637 |
} else if ( aup === bup ) {
|
3638 |
return siblingCheck( a, b );
|
3639 |
}
|
|
|
3640 |
// Otherwise we need full lists of their ancestors for comparison
|
3641 |
cur = a;
|
3642 |
while ( (cur = cur.parentNode) ) {
|
@@ -3646,39 +4335,49 @@ setDocument = Sizzle.setDocument = function( node ) {
|
|
3646 |
while ( (cur = cur.parentNode) ) {
|
3647 |
bp.unshift( cur );
|
3648 |
}
|
|
|
3649 |
// Walk down the tree looking for a discrepancy
|
3650 |
while ( ap[i] === bp[i] ) {
|
3651 |
i++;
|
3652 |
}
|
|
|
3653 |
return i ?
|
3654 |
// Do a sibling check if the nodes have a common ancestor
|
3655 |
siblingCheck( ap[i], bp[i] ) :
|
|
|
3656 |
// Otherwise nodes in our document sort first
|
3657 |
ap[i] === preferredDoc ? -1 :
|
3658 |
bp[i] === preferredDoc ? 1 :
|
3659 |
0;
|
3660 |
};
|
|
|
3661 |
// Always assume the presence of duplicates if sort doesn't
|
3662 |
// pass them to our comparison function (as in Google Chrome).
|
3663 |
hasDuplicate = false;
|
3664 |
[0, 0].sort( sortOrder );
|
3665 |
support.detectDuplicates = hasDuplicate;
|
|
|
3666 |
return document;
|
3667 |
};
|
|
|
3668 |
Sizzle.matches = function( expr, elements ) {
|
3669 |
return Sizzle( expr, null, null, elements );
|
3670 |
};
|
|
|
3671 |
Sizzle.matchesSelector = function( elem, expr ) {
|
3672 |
// Set document vars if needed
|
3673 |
if ( ( elem.ownerDocument || elem ) !== document ) {
|
3674 |
setDocument( elem );
|
3675 |
}
|
|
|
3676 |
// Make sure that attribute selectors are quoted
|
3677 |
expr = expr.replace( rattributeQuotes, "='$1']" );
|
|
|
3678 |
// rbuggyQSA always contains :focus, so no need for an existence check
|
3679 |
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
|
3680 |
try {
|
3681 |
var ret = matches.call( elem, expr );
|
|
|
3682 |
// IE 9's matchesSelector returns false on disconnected nodes
|
3683 |
if ( ret || support.disconnectedMatch ||
|
3684 |
// As well, disconnected nodes are said to be in a document
|
@@ -3688,8 +4387,10 @@ Sizzle.matchesSelector = function( elem, expr ) {
|
|
3688 |
}
|
3689 |
} catch(e) {}
|
3690 |
}
|
|
|
3691 |
return Sizzle( expr, document, null, [elem] ).length > 0;
|
3692 |
};
|
|
|
3693 |
Sizzle.contains = function( context, elem ) {
|
3694 |
// Set document vars if needed
|
3695 |
if ( ( context.ownerDocument || context ) !== document ) {
|
@@ -3697,12 +4398,15 @@ Sizzle.contains = function( context, elem ) {
|
|
3697 |
}
|
3698 |
return contains( context, elem );
|
3699 |
};
|
|
|
3700 |
Sizzle.attr = function( elem, name ) {
|
3701 |
var val;
|
|
|
3702 |
// Set document vars if needed
|
3703 |
if ( ( elem.ownerDocument || elem ) !== document ) {
|
3704 |
setDocument( elem );
|
3705 |
}
|
|
|
3706 |
if ( !documentIsXML ) {
|
3707 |
name = name.toLowerCase();
|
3708 |
}
|
@@ -3716,18 +4420,22 @@ Sizzle.attr = function( elem, name ) {
|
|
3716 |
name :
|
3717 |
val && val.specified ? val.value : null;
|
3718 |
};
|
|
|
3719 |
Sizzle.error = function( msg ) {
|
3720 |
throw new Error( "Syntax error, unrecognized expression: " + msg );
|
3721 |
};
|
|
|
3722 |
// Document sorting and removing duplicates
|
3723 |
Sizzle.uniqueSort = function( results ) {
|
3724 |
var elem,
|
3725 |
duplicates = [],
|
3726 |
i = 1,
|
3727 |
j = 0;
|
|
|
3728 |
// Unless we *know* we can detect duplicates, assume their presence
|
3729 |
hasDuplicate = !support.detectDuplicates;
|
3730 |
results.sort( sortOrder );
|
|
|
3731 |
if ( hasDuplicate ) {
|
3732 |
for ( ; (elem = results[i]); i++ ) {
|
3733 |
if ( elem === results[ i - 1 ] ) {
|
@@ -3738,15 +4446,19 @@ Sizzle.uniqueSort = function( results ) {
|
|
3738 |
results.splice( duplicates[ j ], 1 );
|
3739 |
}
|
3740 |
}
|
|
|
3741 |
return results;
|
3742 |
};
|
|
|
3743 |
function siblingCheck( a, b ) {
|
3744 |
var cur = b && a,
|
3745 |
diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
|
|
|
3746 |
// Use IE sourceIndex if available on both nodes
|
3747 |
if ( diff ) {
|
3748 |
return diff;
|
3749 |
}
|
|
|
3750 |
// Check if b follows a
|
3751 |
if ( cur ) {
|
3752 |
while ( (cur = cur.nextSibling) ) {
|
@@ -3755,8 +4467,10 @@ function siblingCheck( a, b ) {
|
|
3755 |
}
|
3756 |
}
|
3757 |
}
|
|
|
3758 |
return a ? 1 : -1;
|
3759 |
}
|
|
|
3760 |
// Returns a function to use in pseudos for input types
|
3761 |
function createInputPseudo( type ) {
|
3762 |
return function( elem ) {
|
@@ -3764,6 +4478,7 @@ function createInputPseudo( type ) {
|
|
3764 |
return name === "input" && elem.type === type;
|
3765 |
};
|
3766 |
}
|
|
|
3767 |
// Returns a function to use in pseudos for buttons
|
3768 |
function createButtonPseudo( type ) {
|
3769 |
return function( elem ) {
|
@@ -3771,6 +4486,7 @@ function createButtonPseudo( type ) {
|
|
3771 |
return (name === "input" || name === "button") && elem.type === type;
|
3772 |
};
|
3773 |
}
|
|
|
3774 |
// Returns a function to use in pseudos for positionals
|
3775 |
function createPositionalPseudo( fn ) {
|
3776 |
return markFunction(function( argument ) {
|
@@ -3779,6 +4495,7 @@ function createPositionalPseudo( fn ) {
|
|
3779 |
var j,
|
3780 |
matchIndexes = fn( [], seed.length, argument ),
|
3781 |
i = matchIndexes.length;
|
|
|
3782 |
// Match elements found at the specified indexes
|
3783 |
while ( i-- ) {
|
3784 |
if ( seed[ (j = matchIndexes[i]) ] ) {
|
@@ -3788,6 +4505,7 @@ function createPositionalPseudo( fn ) {
|
|
3788 |
});
|
3789 |
});
|
3790 |
}
|
|
|
3791 |
/**
|
3792 |
* Utility function for retrieving the text value of an array of DOM nodes
|
3793 |
* @param {Array|Element} elem
|
@@ -3797,6 +4515,7 @@ getText = Sizzle.getText = function( elem ) {
|
|
3797 |
ret = "",
|
3798 |
i = 0,
|
3799 |
nodeType = elem.nodeType;
|
|
|
3800 |
if ( !nodeType ) {
|
3801 |
// If no nodeType, this is expected to be an array
|
3802 |
for ( ; (node = elem[i]); i++ ) {
|
@@ -3818,30 +4537,42 @@ getText = Sizzle.getText = function( elem ) {
|
|
3818 |
return elem.nodeValue;
|
3819 |
}
|
3820 |
// Do not include comment or processing instruction nodes
|
|
|
3821 |
return ret;
|
3822 |
};
|
|
|
3823 |
Expr = Sizzle.selectors = {
|
|
|
3824 |
// Can be adjusted by the user
|
3825 |
cacheLength: 50,
|
|
|
3826 |
createPseudo: markFunction,
|
|
|
3827 |
match: matchExpr,
|
|
|
3828 |
find: {},
|
|
|
3829 |
relative: {
|
3830 |
">": { dir: "parentNode", first: true },
|
3831 |
" ": { dir: "parentNode" },
|
3832 |
"+": { dir: "previousSibling", first: true },
|
3833 |
"~": { dir: "previousSibling" }
|
3834 |
},
|
|
|
3835 |
preFilter: {
|
3836 |
"ATTR": function( match ) {
|
3837 |
match[1] = match[1].replace( runescape, funescape );
|
|
|
3838 |
// Move the given value to match[3] whether quoted or unquoted
|
3839 |
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
|
|
|
3840 |
if ( match[2] === "~=" ) {
|
3841 |
match[3] = " " + match[3] + " ";
|
3842 |
}
|
|
|
3843 |
return match.slice( 0, 4 );
|
3844 |
},
|
|
|
3845 |
"CHILD": function( match ) {
|
3846 |
/* matches from matchExpr["CHILD"]
|
3847 |
1 type (only|nth|...)
|
@@ -3854,72 +4585,91 @@ Expr = Sizzle.selectors = {
|
|
3854 |
8 y of y-component
|
3855 |
*/
|
3856 |
match[1] = match[1].toLowerCase();
|
|
|
3857 |
if ( match[1].slice( 0, 3 ) === "nth" ) {
|
3858 |
// nth-* requires argument
|
3859 |
if ( !match[3] ) {
|
3860 |
Sizzle.error( match[0] );
|
3861 |
}
|
|
|
3862 |
// numeric x and y parameters for Expr.filter.CHILD
|
3863 |
// remember that false/true cast respectively to 0/1
|
3864 |
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
|
3865 |
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
|
|
|
3866 |
// other types prohibit arguments
|
3867 |
} else if ( match[3] ) {
|
3868 |
Sizzle.error( match[0] );
|
3869 |
}
|
|
|
3870 |
return match;
|
3871 |
},
|
|
|
3872 |
"PSEUDO": function( match ) {
|
3873 |
var excess,
|
3874 |
unquoted = !match[5] && match[2];
|
|
|
3875 |
if ( matchExpr["CHILD"].test( match[0] ) ) {
|
3876 |
return null;
|
3877 |
}
|
|
|
3878 |
// Accept quoted arguments as-is
|
3879 |
if ( match[4] ) {
|
3880 |
match[2] = match[4];
|
|
|
3881 |
// Strip excess characters from unquoted arguments
|
3882 |
} else if ( unquoted && rpseudo.test( unquoted ) &&
|
3883 |
// Get excess from tokenize (recursively)
|
3884 |
(excess = tokenize( unquoted, true )) &&
|
3885 |
// advance to the next closing parenthesis
|
3886 |
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
|
|
|
3887 |
// excess is a negative index
|
3888 |
match[0] = match[0].slice( 0, excess );
|
3889 |
match[2] = unquoted.slice( 0, excess );
|
3890 |
}
|
|
|
3891 |
// Return only captures needed by the pseudo filter method (type and argument)
|
3892 |
return match.slice( 0, 3 );
|
3893 |
}
|
3894 |
},
|
|
|
3895 |
filter: {
|
|
|
3896 |
"TAG": function( nodeName ) {
|
3897 |
if ( nodeName === "*" ) {
|
3898 |
return function() { return true; };
|
3899 |
}
|
|
|
3900 |
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
|
3901 |
return function( elem ) {
|
3902 |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
|
3903 |
};
|
3904 |
},
|
|
|
3905 |
"CLASS": function( className ) {
|
3906 |
var pattern = classCache[ className + " " ];
|
|
|
3907 |
return pattern ||
|
3908 |
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
3909 |
classCache( className, function( elem ) {
|
3910 |
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
3911 |
});
|
3912 |
},
|
|
|
3913 |
"ATTR": function( name, operator, check ) {
|
3914 |
return function( elem ) {
|
3915 |
var result = Sizzle.attr( elem, name );
|
|
|
3916 |
if ( result == null ) {
|
3917 |
return operator === "!=";
|
3918 |
}
|
3919 |
if ( !operator ) {
|
3920 |
return true;
|
3921 |
}
|
|
|
3922 |
result += "";
|
|
|
3923 |
return operator === "=" ? result === check :
|
3924 |
operator === "!=" ? result !== check :
|
3925 |
operator === "^=" ? check && result.indexOf( check ) === 0 :
|
@@ -3930,22 +4680,28 @@ Expr = Sizzle.selectors = {
|
|
3930 |
false;
|
3931 |
};
|
3932 |
},
|
|
|
3933 |
"CHILD": function( type, what, argument, first, last ) {
|
3934 |
var simple = type.slice( 0, 3 ) !== "nth",
|
3935 |
forward = type.slice( -4 ) !== "last",
|
3936 |
ofType = what === "of-type";
|
|
|
3937 |
return first === 1 && last === 0 ?
|
|
|
3938 |
// Shortcut for :nth-*(n)
|
3939 |
function( elem ) {
|
3940 |
return !!elem.parentNode;
|
3941 |
} :
|
|
|
3942 |
function( elem, context, xml ) {
|
3943 |
var cache, outerCache, node, diff, nodeIndex, start,
|
3944 |
dir = simple !== forward ? "nextSibling" : "previousSibling",
|
3945 |
parent = elem.parentNode,
|
3946 |
name = ofType && elem.nodeName.toLowerCase(),
|
3947 |
useCache = !xml && !ofType;
|
|
|
3948 |
if ( parent ) {
|
|
|
3949 |
// :(first|last|only)-(child|of-type)
|
3950 |
if ( simple ) {
|
3951 |
while ( dir ) {
|
@@ -3960,7 +4716,9 @@ Expr = Sizzle.selectors = {
|
|
3960 |
}
|
3961 |
return true;
|
3962 |
}
|
|
|
3963 |
start = [ forward ? parent.firstChild : parent.lastChild ];
|
|
|
3964 |
// non-xml :nth-child(...) stores cache data on `parent`
|
3965 |
if ( forward && useCache ) {
|
3966 |
// Seek `elem` from a previously-cached index
|
@@ -3969,40 +4727,49 @@ Expr = Sizzle.selectors = {
|
|
3969 |
nodeIndex = cache[0] === dirruns && cache[1];
|
3970 |
diff = cache[0] === dirruns && cache[2];
|
3971 |
node = nodeIndex && parent.childNodes[ nodeIndex ];
|
|
|
3972 |
while ( (node = ++nodeIndex && node && node[ dir ] ||
|
|
|
3973 |
// Fallback to seeking `elem` from the start
|
3974 |
(diff = nodeIndex = 0) || start.pop()) ) {
|
|
|
3975 |
// When found, cache indexes on `parent` and break
|
3976 |
if ( node.nodeType === 1 && ++diff && node === elem ) {
|
3977 |
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
|
3978 |
break;
|
3979 |
}
|
3980 |
}
|
|
|
3981 |
// Use previously-cached element index if available
|
3982 |
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
|
3983 |
diff = cache[1];
|
|
|
3984 |
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
|
3985 |
} else {
|
3986 |
// Use the same loop as above to seek `elem` from the start
|
3987 |
while ( (node = ++nodeIndex && node && node[ dir ] ||
|
3988 |
(diff = nodeIndex = 0) || start.pop()) ) {
|
|
|
3989 |
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
|
3990 |
// Cache the index of each encountered element
|
3991 |
if ( useCache ) {
|
3992 |
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
|
3993 |
}
|
|
|
3994 |
if ( node === elem ) {
|
3995 |
break;
|
3996 |
}
|
3997 |
}
|
3998 |
}
|
3999 |
}
|
|
|
4000 |
// Incorporate the offset, then check against cycle size
|
4001 |
diff -= last;
|
4002 |
return diff === first || ( diff % first === 0 && diff / first >= 0 );
|
4003 |
}
|
4004 |
};
|
4005 |
},
|
|
|
4006 |
"PSEUDO": function( pseudo, argument ) {
|
4007 |
// pseudo-class names are case-insensitive
|
4008 |
// http://www.w3.org/TR/selectors/#pseudo-classes
|
@@ -4011,12 +4778,14 @@ Expr = Sizzle.selectors = {
|
|
4011 |
var args,
|
4012 |
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
|
4013 |
Sizzle.error( "unsupported pseudo: " + pseudo );
|
|
|
4014 |
// The user may use createPseudo to indicate that
|
4015 |
// arguments are needed to create the filter function
|
4016 |
// just as Sizzle does
|
4017 |
if ( fn[ expando ] ) {
|
4018 |
return fn( argument );
|
4019 |
}
|
|
|
4020 |
// But maintain support for old signatures
|
4021 |
if ( fn.length > 1 ) {
|
4022 |
args = [ pseudo, pseudo, "", argument ];
|
@@ -4034,9 +4803,12 @@ Expr = Sizzle.selectors = {
|
|
4034 |
return fn( elem, 0, args );
|
4035 |
};
|
4036 |
}
|
|
|
|
|
4037 |
return fn;
|
4038 |
}
|
4039 |
},
|
|
|
4040 |
pseudos: {
|
4041 |
// Potentially complex pseudos
|
4042 |
"not": markFunction(function( selector ) {
|
@@ -4046,11 +4818,13 @@ Expr = Sizzle.selectors = {
|
|
4046 |
var input = [],
|
4047 |
results = [],
|
4048 |
matcher = compile( selector.replace( rtrim, "$1" ) );
|
|
|
4049 |
return matcher[ expando ] ?
|
4050 |
markFunction(function( seed, matches, context, xml ) {
|
4051 |
var elem,
|
4052 |
unmatched = matcher( seed, null, xml, [] ),
|
4053 |
i = seed.length;
|
|
|
4054 |
// Match elements unmatched by `matcher`
|
4055 |
while ( i-- ) {
|
4056 |
if ( (elem = unmatched[i]) ) {
|
@@ -4064,16 +4838,19 @@ Expr = Sizzle.selectors = {
|
|
4064 |
return !results.pop();
|
4065 |
};
|
4066 |
}),
|
|
|
4067 |
"has": markFunction(function( selector ) {
|
4068 |
return function( elem ) {
|
4069 |
return Sizzle( selector, elem ).length > 0;
|
4070 |
};
|
4071 |
}),
|
|
|
4072 |
"contains": markFunction(function( text ) {
|
4073 |
return function( elem ) {
|
4074 |
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
|
4075 |
};
|
4076 |
}),
|
|
|
4077 |
// "Whether an element is represented by a :lang() selector
|
4078 |
// is based solely on the element's language value
|
4079 |
// being equal to the identifier C,
|
@@ -4093,6 +4870,7 @@ Expr = Sizzle.selectors = {
|
|
4093 |
if ( (elemLang = documentIsXML ?
|
4094 |
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
|
4095 |
elem.lang) ) {
|
|
|
4096 |
elemLang = elemLang.toLowerCase();
|
4097 |
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
|
4098 |
}
|
@@ -4100,38 +4878,47 @@ Expr = Sizzle.selectors = {
|
|
4100 |
return false;
|
4101 |
};
|
4102 |
}),
|
|
|
4103 |
// Miscellaneous
|
4104 |
"target": function( elem ) {
|
4105 |
var hash = window.location && window.location.hash;
|
4106 |
return hash && hash.slice( 1 ) === elem.id;
|
4107 |
},
|
|
|
4108 |
"root": function( elem ) {
|
4109 |
return elem === docElem;
|
4110 |
},
|
|
|
4111 |
"focus": function( elem ) {
|
4112 |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
4113 |
},
|
|
|
4114 |
// Boolean properties
|
4115 |
"enabled": function( elem ) {
|
4116 |
return elem.disabled === false;
|
4117 |
},
|
|
|
4118 |
"disabled": function( elem ) {
|
4119 |
return elem.disabled === true;
|
4120 |
},
|
|
|
4121 |
"checked": function( elem ) {
|
4122 |
// In CSS3, :checked should return both checked and selected elements
|
4123 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
4124 |
var nodeName = elem.nodeName.toLowerCase();
|
4125 |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
|
4126 |
},
|
|
|
4127 |
"selected": function( elem ) {
|
4128 |
// Accessing this property makes selected-by-default
|
4129 |
// options in Safari work properly
|
4130 |
if ( elem.parentNode ) {
|
4131 |
elem.parentNode.selectedIndex;
|
4132 |
}
|
|
|
4133 |
return elem.selected === true;
|
4134 |
},
|
|
|
4135 |
// Contents
|
4136 |
"empty": function( elem ) {
|
4137 |
// http://www.w3.org/TR/selectors/#empty-pseudo
|
@@ -4146,20 +4933,25 @@ Expr = Sizzle.selectors = {
|
|
4146 |
}
|
4147 |
return true;
|
4148 |
},
|
|
|
4149 |
"parent": function( elem ) {
|
4150 |
return !Expr.pseudos["empty"]( elem );
|
4151 |
},
|
|
|
4152 |
// Element/input types
|
4153 |
"header": function( elem ) {
|
4154 |
return rheader.test( elem.nodeName );
|
4155 |
},
|
|
|
4156 |
"input": function( elem ) {
|
4157 |
return rinputs.test( elem.nodeName );
|
4158 |
},
|
|
|
4159 |
"button": function( elem ) {
|
4160 |
var name = elem.nodeName.toLowerCase();
|
4161 |
return name === "input" && elem.type === "button" || name === "button";
|
4162 |
},
|
|
|
4163 |
"text": function( elem ) {
|
4164 |
var attr;
|
4165 |
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
|
@@ -4168,16 +4960,20 @@ Expr = Sizzle.selectors = {
|
|
4168 |
elem.type === "text" &&
|
4169 |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
|
4170 |
},
|
|
|
4171 |
// Position-in-collection
|
4172 |
"first": createPositionalPseudo(function() {
|
4173 |
return [ 0 ];
|
4174 |
}),
|
|
|
4175 |
"last": createPositionalPseudo(function( matchIndexes, length ) {
|
4176 |
return [ length - 1 ];
|
4177 |
}),
|
|
|
4178 |
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
4179 |
return [ argument < 0 ? argument + length : argument ];
|
4180 |
}),
|
|
|
4181 |
"even": createPositionalPseudo(function( matchIndexes, length ) {
|
4182 |
var i = 0;
|
4183 |
for ( ; i < length; i += 2 ) {
|
@@ -4185,6 +4981,7 @@ Expr = Sizzle.selectors = {
|
|
4185 |
}
|
4186 |
return matchIndexes;
|
4187 |
}),
|
|
|
4188 |
"odd": createPositionalPseudo(function( matchIndexes, length ) {
|
4189 |
var i = 1;
|
4190 |
for ( ; i < length; i += 2 ) {
|
@@ -4192,6 +4989,7 @@ Expr = Sizzle.selectors = {
|
|
4192 |
}
|
4193 |
return matchIndexes;
|
4194 |
}),
|
|
|
4195 |
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
4196 |
var i = argument < 0 ? argument + length : argument;
|
4197 |
for ( ; --i >= 0; ) {
|
@@ -4199,6 +4997,7 @@ Expr = Sizzle.selectors = {
|
|
4199 |
}
|
4200 |
return matchIndexes;
|
4201 |
}),
|
|
|
4202 |
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
4203 |
var i = argument < 0 ? argument + length : argument;
|
4204 |
for ( ; ++i < length; ) {
|
@@ -4208,6 +5007,7 @@ Expr = Sizzle.selectors = {
|
|
4208 |
})
|
4209 |
}
|
4210 |
};
|
|
|
4211 |
// Add button/input type pseudos
|
4212 |
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
|
4213 |
Expr.pseudos[ i ] = createInputPseudo( i );
|
@@ -4215,17 +5015,22 @@ for ( i in { radio: true, checkbox: true, file: true, password: true, image: tru
|
|
4215 |
for ( i in { submit: true, reset: true } ) {
|
4216 |
Expr.pseudos[ i ] = createButtonPseudo( i );
|
4217 |
}
|
|
|
4218 |
function tokenize( selector, parseOnly ) {
|
4219 |
var matched, match, tokens, type,
|
4220 |
soFar, groups, preFilters,
|
4221 |
cached = tokenCache[ selector + " " ];
|
|
|
4222 |
if ( cached ) {
|
4223 |
return parseOnly ? 0 : cached.slice( 0 );
|
4224 |
}
|
|
|
4225 |
soFar = selector;
|
4226 |
groups = [];
|
4227 |
preFilters = Expr.preFilter;
|
|
|
4228 |
while ( soFar ) {
|
|
|
4229 |
// Comma and first run
|
4230 |
if ( !matched || (match = rcomma.exec( soFar )) ) {
|
4231 |
if ( match ) {
|
@@ -4234,7 +5039,9 @@ function tokenize( selector, parseOnly ) {
|
|
4234 |
}
|
4235 |
groups.push( tokens = [] );
|
4236 |
}
|
|
|
4237 |
matched = false;
|
|
|
4238 |
// Combinators
|
4239 |
if ( (match = rcombinators.exec( soFar )) ) {
|
4240 |
matched = match.shift();
|
@@ -4245,6 +5052,7 @@ function tokenize( selector, parseOnly ) {
|
|
4245 |
} );
|
4246 |
soFar = soFar.slice( matched.length );
|
4247 |
}
|
|
|
4248 |
// Filters
|
4249 |
for ( type in Expr.filter ) {
|
4250 |
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
@@ -4258,10 +5066,12 @@ function tokenize( selector, parseOnly ) {
|
|
4258 |
soFar = soFar.slice( matched.length );
|
4259 |
}
|
4260 |
}
|
|
|
4261 |
if ( !matched ) {
|
4262 |
break;
|
4263 |
}
|
4264 |
}
|
|
|
4265 |
// Return the length of the invalid excess
|
4266 |
// if we're just parsing
|
4267 |
// Otherwise, throw an error or return tokens
|
@@ -4272,6 +5082,7 @@ function tokenize( selector, parseOnly ) {
|
|
4272 |
// Cache the tokens
|
4273 |
tokenCache( selector, groups ).slice( 0 );
|
4274 |
}
|
|
|
4275 |
function toSelector( tokens ) {
|
4276 |
var i = 0,
|
4277 |
len = tokens.length,
|
@@ -4281,10 +5092,12 @@ function toSelector( tokens ) {
|
|
4281 |
}
|
4282 |
return selector;
|
4283 |
}
|
|
|
4284 |
function addCombinator( matcher, combinator, base ) {
|
4285 |
var dir = combinator.dir,
|
4286 |
checkNonElements = base && dir === "parentNode",
|
4287 |
doneName = done++;
|
|
|
4288 |
return combinator.first ?
|
4289 |
// Check against closest ancestor/preceding element
|
4290 |
function( elem, context, xml ) {
|
@@ -4294,10 +5107,12 @@ function addCombinator( matcher, combinator, base ) {
|
|
4294 |
}
|
4295 |
}
|
4296 |
} :
|
|
|
4297 |
// Check against all ancestor/preceding elements
|
4298 |
function( elem, context, xml ) {
|
4299 |
var data, cache, outerCache,
|
4300 |
dirkey = dirruns + " " + doneName;
|
|
|
4301 |
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
|
4302 |
if ( xml ) {
|
4303 |
while ( (elem = elem[ dir ]) ) {
|
@@ -4327,6 +5142,7 @@ function addCombinator( matcher, combinator, base ) {
|
|
4327 |
}
|
4328 |
};
|
4329 |
}
|
|
|
4330 |
function elementMatcher( matchers ) {
|
4331 |
return matchers.length > 1 ?
|
4332 |
function( elem, context, xml ) {
|
@@ -4340,12 +5156,14 @@ function elementMatcher( matchers ) {
|
|
4340 |
} :
|
4341 |
matchers[0];
|
4342 |
}
|
|
|
4343 |
function condense( unmatched, map, filter, context, xml ) {
|
4344 |
var elem,
|
4345 |
newUnmatched = [],
|
4346 |
i = 0,
|
4347 |
len = unmatched.length,
|
4348 |
mapped = map != null;
|
|
|
4349 |
for ( ; i < len; i++ ) {
|
4350 |
if ( (elem = unmatched[i]) ) {
|
4351 |
if ( !filter || filter( elem, context, xml ) ) {
|
@@ -4356,8 +5174,10 @@ function condense( unmatched, map, filter, context, xml ) {
|
|
4356 |
}
|
4357 |
}
|
4358 |
}
|
|
|
4359 |
return newUnmatched;
|
4360 |
}
|
|
|
4361 |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
|
4362 |
if ( postFilter && !postFilter[ expando ] ) {
|
4363 |
postFilter = setMatcher( postFilter );
|
@@ -4370,28 +5190,36 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|
4370 |
preMap = [],
|
4371 |
postMap = [],
|
4372 |
preexisting = results.length,
|
|
|
4373 |
// Get initial elements from seed or context
|
4374 |
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
|
|
4375 |
// Prefilter to get matcher input, preserving a map for seed-results synchronization
|
4376 |
matcherIn = preFilter && ( seed || !selector ) ?
|
4377 |
condense( elems, preMap, preFilter, context, xml ) :
|
4378 |
elems,
|
|
|
4379 |
matcherOut = matcher ?
|
4380 |
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
|
4381 |
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
|
|
|
4382 |
// ...intermediate processing is necessary
|
4383 |
[] :
|
|
|
4384 |
// ...otherwise use results directly
|
4385 |
results :
|
4386 |
matcherIn;
|
|
|
4387 |
// Find primary matches
|
4388 |
if ( matcher ) {
|
4389 |
matcher( matcherIn, matcherOut, context, xml );
|
4390 |
}
|
|
|
4391 |
// Apply postFilter
|
4392 |
if ( postFilter ) {
|
4393 |
temp = condense( matcherOut, postMap );
|
4394 |
postFilter( temp, [], context, xml );
|
|
|
4395 |
// Un-match failing elements by moving them back to matcherIn
|
4396 |
i = temp.length;
|
4397 |
while ( i-- ) {
|
@@ -4400,6 +5228,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|
4400 |
}
|
4401 |
}
|
4402 |
}
|
|
|
4403 |
if ( seed ) {
|
4404 |
if ( postFinder || preFilter ) {
|
4405 |
if ( postFinder ) {
|
@@ -4414,15 +5243,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|
4414 |
}
|
4415 |
postFinder( null, (matcherOut = []), temp, xml );
|
4416 |
}
|
|
|
4417 |
// Move matched elements from seed to results to keep them synchronized
|
4418 |
i = matcherOut.length;
|
4419 |
while ( i-- ) {
|
4420 |
if ( (elem = matcherOut[i]) &&
|
4421 |
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
|
|
|
4422 |
seed[temp] = !(results[temp] = elem);
|
4423 |
}
|
4424 |
}
|
4425 |
}
|
|
|
4426 |
// Add elements to results, through postFinder if defined
|
4427 |
} else {
|
4428 |
matcherOut = condense(
|
@@ -4438,12 +5270,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
|
|
4438 |
}
|
4439 |
});
|
4440 |
}
|
|
|
4441 |
function matcherFromTokens( tokens ) {
|
4442 |
var checkContext, matcher, j,
|
4443 |
len = tokens.length,
|
4444 |
leadingRelative = Expr.relative[ tokens[0].type ],
|
4445 |
implicitRelative = leadingRelative || Expr.relative[" "],
|
4446 |
i = leadingRelative ? 1 : 0,
|
|
|
4447 |
// The foundational matcher ensures that elements are reachable from top-level context(s)
|
4448 |
matchContext = addCombinator( function( elem ) {
|
4449 |
return elem === checkContext;
|
@@ -4457,11 +5291,13 @@ function matcherFromTokens( tokens ) {
|
|
4457 |
matchContext( elem, context, xml ) :
|
4458 |
matchAnyContext( elem, context, xml ) );
|
4459 |
} ];
|
|
|
4460 |
for ( ; i < len; i++ ) {
|
4461 |
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
4462 |
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
|
4463 |
} else {
|
4464 |
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
|
|
4465 |
// Return special upon seeing a positional matcher
|
4466 |
if ( matcher[ expando ] ) {
|
4467 |
// Find the next relative operator (if any) for proper handling
|
@@ -4483,8 +5319,10 @@ function matcherFromTokens( tokens ) {
|
|
4483 |
matchers.push( matcher );
|
4484 |
}
|
4485 |
}
|
|
|
4486 |
return elementMatcher( matchers );
|
4487 |
}
|
|
|
4488 |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
4489 |
// A counter to specify which element is currently being matched
|
4490 |
var matcherCachedRuns = 0,
|
@@ -4502,10 +5340,12 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
|
4502 |
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
|
4503 |
// Use integer dirruns iff this is the outermost matcher
|
4504 |
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
|
|
|
4505 |
if ( outermost ) {
|
4506 |
outermostContext = context !== document && context;
|
4507 |
cachedruns = matcherCachedRuns;
|
4508 |
}
|
|
|
4509 |
// Add elements passing elementMatchers directly to results
|
4510 |
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
|
4511 |
for ( ; (elem = elems[i]) != null; i++ ) {
|
@@ -4522,18 +5362,21 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
|
4522 |
cachedruns = ++matcherCachedRuns;
|
4523 |
}
|
4524 |
}
|
|
|
4525 |
// Track unmatched elements for set filters
|
4526 |
if ( bySet ) {
|
4527 |
// They will have gone through all possible matchers
|
4528 |
if ( (elem = !matcher && elem) ) {
|
4529 |
matchedCount--;
|
4530 |
}
|
|
|
4531 |
// Lengthen the array for every element, matched or not
|
4532 |
if ( seed ) {
|
4533 |
unmatched.push( elem );
|
4534 |
}
|
4535 |
}
|
4536 |
}
|
|
|
4537 |
// Apply set filters to unmatched elements
|
4538 |
matchedCount += i;
|
4539 |
if ( bySet && i !== matchedCount ) {
|
@@ -4541,6 +5384,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
|
4541 |
while ( (matcher = setMatchers[j++]) ) {
|
4542 |
matcher( unmatched, setMatched, context, xml );
|
4543 |
}
|
|
|
4544 |
if ( seed ) {
|
4545 |
// Reintegrate element matches to eliminate the need for sorting
|
4546 |
if ( matchedCount > 0 ) {
|
@@ -4550,33 +5394,42 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
|
4550 |
}
|
4551 |
}
|
4552 |
}
|
|
|
4553 |
// Discard index placeholder values to get only actual matches
|
4554 |
setMatched = condense( setMatched );
|
4555 |
}
|
|
|
4556 |
// Add matches to results
|
4557 |
push.apply( results, setMatched );
|
|
|
4558 |
// Seedless set matches succeeding multiple successful matchers stipulate sorting
|
4559 |
if ( outermost && !seed && setMatched.length > 0 &&
|
4560 |
( matchedCount + setMatchers.length ) > 1 ) {
|
|
|
4561 |
Sizzle.uniqueSort( results );
|
4562 |
}
|
4563 |
}
|
|
|
4564 |
// Override manipulation of globals by nested matchers
|
4565 |
if ( outermost ) {
|
4566 |
dirruns = dirrunsUnique;
|
4567 |
outermostContext = contextBackup;
|
4568 |
}
|
|
|
4569 |
return unmatched;
|
4570 |
};
|
|
|
4571 |
return bySet ?
|
4572 |
markFunction( superMatcher ) :
|
4573 |
superMatcher;
|
4574 |
}
|
|
|
4575 |
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
4576 |
var i,
|
4577 |
setMatchers = [],
|
4578 |
elementMatchers = [],
|
4579 |
cached = compilerCache[ selector + " " ];
|
|
|
4580 |
if ( !cached ) {
|
4581 |
// Generate a function of recursive functions that can be used to check each element
|
4582 |
if ( !group ) {
|
@@ -4591,11 +5444,13 @@ compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
|
4591 |
elementMatchers.push( cached );
|
4592 |
}
|
4593 |
}
|
|
|
4594 |
// Cache the compiled function
|
4595 |
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
|
4596 |
}
|
4597 |
return cached;
|
4598 |
};
|
|
|
4599 |
function multipleContexts( selector, contexts, results ) {
|
4600 |
var i = 0,
|
4601 |
len = contexts.length;
|
@@ -4604,27 +5459,34 @@ function multipleContexts( selector, contexts, results ) {
|
|
4604 |
}
|
4605 |
return results;
|
4606 |
}
|
|
|
4607 |
function select( selector, context, results, seed ) {
|
4608 |
var i, tokens, token, type, find,
|
4609 |
match = tokenize( selector );
|
|
|
4610 |
if ( !seed ) {
|
4611 |
// Try to minimize operations if there is only one group
|
4612 |
if ( match.length === 1 ) {
|
|
|
4613 |
// Take a shortcut and set the context if the root selector is an ID
|
4614 |
tokens = match[0] = match[0].slice( 0 );
|
4615 |
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
|
4616 |
context.nodeType === 9 && !documentIsXML &&
|
4617 |
Expr.relative[ tokens[1].type ] ) {
|
|
|
4618 |
context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
|
4619 |
if ( !context ) {
|
4620 |
return results;
|
4621 |
}
|
|
|
4622 |
selector = selector.slice( tokens.shift().value.length );
|
4623 |
}
|
|
|
4624 |
// Fetch a seed set for right-to-left matching
|
4625 |
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
|
4626 |
while ( i-- ) {
|
4627 |
token = tokens[i];
|
|
|
4628 |
// Abort if we hit a combinator
|
4629 |
if ( Expr.relative[ (type = token.type) ] ) {
|
4630 |
break;
|
@@ -4635,6 +5497,7 @@ function select( selector, context, results, seed ) {
|
|
4635 |
token.matches[0].replace( runescape, funescape ),
|
4636 |
rsibling.test( tokens[0].type ) && context.parentNode || context
|
4637 |
)) ) {
|
|
|
4638 |
// If seed is empty or no tokens remain, we can return early
|
4639 |
tokens.splice( i, 1 );
|
4640 |
selector = seed.length && toSelector( tokens );
|
@@ -4642,12 +5505,14 @@ function select( selector, context, results, seed ) {
|
|
4642 |
push.apply( results, slice.call( seed, 0 ) );
|
4643 |
return results;
|
4644 |
}
|
|
|
4645 |
break;
|
4646 |
}
|
4647 |
}
|
4648 |
}
|
4649 |
}
|
4650 |
}
|
|
|
4651 |
// Compile and execute a filtering function
|
4652 |
// Provide `match` to avoid retokenization if we modified the selector above
|
4653 |
compile( selector, match )(
|
@@ -4659,14 +5524,18 @@ function select( selector, context, results, seed ) {
|
|
4659 |
);
|
4660 |
return results;
|
4661 |
}
|
|
|
4662 |
// Deprecated
|
4663 |
Expr.pseudos["nth"] = Expr.pseudos["eq"];
|
|
|
4664 |
// Easy API for creating new setFilters
|
4665 |
function setFilters() {}
|
4666 |
Expr.filters = setFilters.prototype = Expr.pseudos;
|
4667 |
Expr.setFilters = new setFilters();
|
|
|
4668 |
// Initialize with the default document
|
4669 |
setDocument();
|
|
|
4670 |
// Override sizzle attribute retrieval
|
4671 |
Sizzle.attr = jQuery.attr;
|
4672 |
jQuery.find = Sizzle;
|
@@ -4676,6 +5545,8 @@ jQuery.unique = Sizzle.uniqueSort;
|
|
4676 |
jQuery.text = Sizzle.getText;
|
4677 |
jQuery.isXMLDoc = Sizzle.isXML;
|
4678 |
jQuery.contains = Sizzle.contains;
|
|
|
|
|
4679 |
})( window );
|
4680 |
var runtil = /Until$/,
|
4681 |
rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
@@ -4688,10 +5559,12 @@ var runtil = /Until$/,
|
|
4688 |
next: true,
|
4689 |
prev: true
|
4690 |
};
|
|
|
4691 |
jQuery.fn.extend({
|
4692 |
find: function( selector ) {
|
4693 |
var i, ret, self,
|
4694 |
len = this.length;
|
|
|
4695 |
if ( typeof selector !== "string" ) {
|
4696 |
self = this;
|
4697 |
return this.pushStack( jQuery( selector ).filter(function() {
|
@@ -4702,19 +5575,23 @@ jQuery.fn.extend({
|
|
4702 |
}
|
4703 |
}) );
|
4704 |
}
|
|
|
4705 |
ret = [];
|
4706 |
for ( i = 0; i < len; i++ ) {
|
4707 |
jQuery.find( selector, this[ i ], ret );
|
4708 |
}
|
|
|
4709 |
// Needed because $( selector, context ) becomes $( context ).find( selector )
|
4710 |
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
|
4711 |
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
|
4712 |
return ret;
|
4713 |
},
|
|
|
4714 |
has: function( target ) {
|
4715 |
var i,
|
4716 |
targets = jQuery( target, this ),
|
4717 |
len = targets.length;
|
|
|
4718 |
return this.filter(function() {
|
4719 |
for ( i = 0; i < len; i++ ) {
|
4720 |
if ( jQuery.contains( this, targets[i] ) ) {
|
@@ -4723,12 +5600,15 @@ jQuery.fn.extend({
|
|
4723 |
}
|
4724 |
});
|
4725 |
},
|
|
|
4726 |
not: function( selector ) {
|
4727 |
return this.pushStack( winnow(this, selector, false) );
|
4728 |
},
|
|
|
4729 |
filter: function( selector ) {
|
4730 |
return this.pushStack( winnow(this, selector, true) );
|
4731 |
},
|
|
|
4732 |
is: function( selector ) {
|
4733 |
return !!selector && (
|
4734 |
typeof selector === "string" ?
|
@@ -4739,6 +5619,7 @@ jQuery.fn.extend({
|
|
4739 |
jQuery.filter( selector, this ).length > 0 :
|
4740 |
this.filter( selector ).length > 0 );
|
4741 |
},
|
|
|
4742 |
closest: function( selectors, context ) {
|
4743 |
var cur,
|
4744 |
i = 0,
|
@@ -4747,8 +5628,10 @@ jQuery.fn.extend({
|
|
4747 |
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
|
4748 |
jQuery( selectors, context || this.context ) :
|
4749 |
0;
|
|
|
4750 |
for ( ; i < l; i++ ) {
|
4751 |
cur = this[i];
|
|
|
4752 |
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
|
4753 |
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
|
4754 |
ret.push( cur );
|
@@ -4757,44 +5640,56 @@ jQuery.fn.extend({
|
|
4757 |
cur = cur.parentNode;
|
4758 |
}
|
4759 |
}
|
|
|
4760 |
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
|
4761 |
},
|
|
|
4762 |
// Determine the position of an element within
|
4763 |
// the matched set of elements
|
4764 |
index: function( elem ) {
|
|
|
4765 |
// No argument, return index in parent
|
4766 |
if ( !elem ) {
|
4767 |
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
|
4768 |
}
|
|
|
4769 |
// index in selector
|
4770 |
if ( typeof elem === "string" ) {
|
4771 |
return jQuery.inArray( this[0], jQuery( elem ) );
|
4772 |
}
|
|
|
4773 |
// Locate the position of the desired element
|
4774 |
return jQuery.inArray(
|
4775 |
// If it receives a jQuery object, the first element is used
|
4776 |
elem.jquery ? elem[0] : elem, this );
|
4777 |
},
|
|
|
4778 |
add: function( selector, context ) {
|
4779 |
var set = typeof selector === "string" ?
|
4780 |
jQuery( selector, context ) :
|
4781 |
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
|
4782 |
all = jQuery.merge( this.get(), set );
|
|
|
4783 |
return this.pushStack( jQuery.unique(all) );
|
4784 |
},
|
|
|
4785 |
addBack: function( selector ) {
|
4786 |
return this.add( selector == null ?
|
4787 |
this.prevObject : this.prevObject.filter(selector)
|
4788 |
);
|
4789 |
}
|
4790 |
});
|
|
|
4791 |
jQuery.fn.andSelf = jQuery.fn.addBack;
|
|
|
4792 |
function sibling( cur, dir ) {
|
4793 |
do {
|
4794 |
cur = cur[ dir ];
|
4795 |
} while ( cur && cur.nodeType !== 1 );
|
|
|
4796 |
return cur;
|
4797 |
}
|
|
|
4798 |
jQuery.each({
|
4799 |
parent: function( elem ) {
|
4800 |
var parent = elem.parentNode;
|
@@ -4838,31 +5733,40 @@ jQuery.each({
|
|
4838 |
}, function( name, fn ) {
|
4839 |
jQuery.fn[ name ] = function( until, selector ) {
|
4840 |
var ret = jQuery.map( this, fn, until );
|
|
|
4841 |
if ( !runtil.test( name ) ) {
|
4842 |
selector = until;
|
4843 |
}
|
|
|
4844 |
if ( selector && typeof selector === "string" ) {
|
4845 |
ret = jQuery.filter( selector, ret );
|
4846 |
}
|
|
|
4847 |
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
|
|
|
4848 |
if ( this.length > 1 && rparentsprev.test( name ) ) {
|
4849 |
ret = ret.reverse();
|
4850 |
}
|
|
|
4851 |
return this.pushStack( ret );
|
4852 |
};
|
4853 |
});
|
|
|
4854 |
jQuery.extend({
|
4855 |
filter: function( expr, elems, not ) {
|
4856 |
if ( not ) {
|
4857 |
expr = ":not(" + expr + ")";
|
4858 |
}
|
|
|
4859 |
return elems.length === 1 ?
|
4860 |
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
|
4861 |
jQuery.find.matches(expr, elems);
|
4862 |
},
|
|
|
4863 |
dir: function( elem, dir, until ) {
|
4864 |
var matched = [],
|
4865 |
cur = elem[ dir ];
|
|
|
4866 |
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
4867 |
if ( cur.nodeType === 1 ) {
|
4868 |
matched.push( cur );
|
@@ -4871,40 +5775,50 @@ jQuery.extend({
|
|
4871 |
}
|
4872 |
return matched;
|
4873 |
},
|
|
|
4874 |
sibling: function( n, elem ) {
|
4875 |
var r = [];
|
|
|
4876 |
for ( ; n; n = n.nextSibling ) {
|
4877 |
if ( n.nodeType === 1 && n !== elem ) {
|
4878 |
r.push( n );
|
4879 |
}
|
4880 |
}
|
|
|
4881 |
return r;
|
4882 |
}
|
4883 |
});
|
|
|
4884 |
// Implement the identical functionality for filter and not
|
4885 |
function winnow( elements, qualifier, keep ) {
|
|
|
4886 |
// Can't pass null or undefined to indexOf in Firefox 4
|
4887 |
// Set to 0 to skip string check
|
4888 |
qualifier = qualifier || 0;
|
|
|
4889 |
if ( jQuery.isFunction( qualifier ) ) {
|
4890 |
return jQuery.grep(elements, function( elem, i ) {
|
4891 |
var retVal = !!qualifier.call( elem, i, elem );
|
4892 |
return retVal === keep;
|
4893 |
});
|
|
|
4894 |
} else if ( qualifier.nodeType ) {
|
4895 |
return jQuery.grep(elements, function( elem ) {
|
4896 |
return ( elem === qualifier ) === keep;
|
4897 |
});
|
|
|
4898 |
} else if ( typeof qualifier === "string" ) {
|
4899 |
var filtered = jQuery.grep(elements, function( elem ) {
|
4900 |
return elem.nodeType === 1;
|
4901 |
});
|
|
|
4902 |
if ( isSimple.test( qualifier ) ) {
|
4903 |
return jQuery.filter(qualifier, filtered, !keep);
|
4904 |
} else {
|
4905 |
qualifier = jQuery.filter( qualifier, filtered );
|
4906 |
}
|
4907 |
}
|
|
|
4908 |
return jQuery.grep(elements, function( elem ) {
|
4909 |
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
|
4910 |
});
|
@@ -4912,6 +5826,7 @@ function winnow( elements, qualifier, keep ) {
|
|
4912 |
function createSafeFragment( document ) {
|
4913 |
var list = nodeNames.split( "|" ),
|
4914 |
safeFrag = document.createDocumentFragment();
|
|
|
4915 |
if ( safeFrag.createElement ) {
|
4916 |
while ( list.length ) {
|
4917 |
safeFrag.createElement(
|
@@ -4921,6 +5836,7 @@ function createSafeFragment( document ) {
|
|
4921 |
}
|
4922 |
return safeFrag;
|
4923 |
}
|
|
|
4924 |
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
|
4925 |
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
|
4926 |
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
|
@@ -4937,6 +5853,7 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
|
|
4937 |
rscriptType = /^$|\/(?:java|ecma)script/i,
|
4938 |
rscriptTypeMasked = /^true\/(.*)/,
|
4939 |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
|
|
|
4940 |
// We have to close these tags to support XHTML (#13200)
|
4941 |
wrapMap = {
|
4942 |
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
@@ -4947,15 +5864,18 @@ var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figca
|
|
4947 |
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
4948 |
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
4949 |
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
|
|
4950 |
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
4951 |
// unless wrapped in a div with non-breaking characters in front of it.
|
4952 |
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
|
4953 |
},
|
4954 |
safeFragment = createSafeFragment( document ),
|
4955 |
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
|
|
|
4956 |
wrapMap.optgroup = wrapMap.option;
|
4957 |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
4958 |
wrapMap.th = wrapMap.td;
|
|
|
4959 |
jQuery.fn.extend({
|
4960 |
text: function( value ) {
|
4961 |
return jQuery.access( this, function( value ) {
|
@@ -4964,50 +5884,64 @@ jQuery.fn.extend({
|
|
4964 |
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
|
4965 |
}, null, value, arguments.length );
|
4966 |
},
|
|
|
4967 |
wrapAll: function( html ) {
|
4968 |
if ( jQuery.isFunction( html ) ) {
|
4969 |
return this.each(function(i) {
|
4970 |
jQuery(this).wrapAll( html.call(this, i) );
|
4971 |
});
|
4972 |
}
|
|
|
4973 |
if ( this[0] ) {
|
4974 |
// The elements to wrap the target around
|
4975 |
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
|
|
|
4976 |
if ( this[0].parentNode ) {
|
4977 |
wrap.insertBefore( this[0] );
|
4978 |
}
|
|
|
4979 |
wrap.map(function() {
|
4980 |
var elem = this;
|
|
|
4981 |
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
|
4982 |
elem = elem.firstChild;
|
4983 |
}
|
|
|
4984 |
return elem;
|
4985 |
}).append( this );
|
4986 |
}
|
|
|
4987 |
return this;
|
4988 |
},
|
|
|
4989 |
wrapInner: function( html ) {
|
4990 |
if ( jQuery.isFunction( html ) ) {
|
4991 |
return this.each(function(i) {
|
4992 |
jQuery(this).wrapInner( html.call(this, i) );
|
4993 |
});
|
4994 |
}
|
|
|
4995 |
return this.each(function() {
|
4996 |
var self = jQuery( this ),
|
4997 |
contents = self.contents();
|
|
|
4998 |
if ( contents.length ) {
|
4999 |
contents.wrapAll( html );
|
|
|
5000 |
} else {
|
5001 |
self.append( html );
|
5002 |
}
|
5003 |
});
|
5004 |
},
|
|
|
5005 |
wrap: function( html ) {
|
5006 |
var isFunction = jQuery.isFunction( html );
|
|
|
5007 |
return this.each(function(i) {
|
5008 |
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
|
5009 |
});
|
5010 |
},
|
|
|
5011 |
unwrap: function() {
|
5012 |
return this.parent().each(function() {
|
5013 |
if ( !jQuery.nodeName( this, "body" ) ) {
|
@@ -5015,6 +5949,7 @@ jQuery.fn.extend({
|
|
5015 |
}
|
5016 |
}).end();
|
5017 |
},
|
|
|
5018 |
append: function() {
|
5019 |
return this.domManip(arguments, true, function( elem ) {
|
5020 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
@@ -5022,6 +5957,7 @@ jQuery.fn.extend({
|
|
5022 |
}
|
5023 |
});
|
5024 |
},
|
|
|
5025 |
prepend: function() {
|
5026 |
return this.domManip(arguments, true, function( elem ) {
|
5027 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
@@ -5029,13 +5965,16 @@ jQuery.fn.extend({
|
|
5029 |
}
|
5030 |
});
|
5031 |
},
|
|
|
5032 |
before: function() {
|
5033 |
return this.domManip( arguments, false, function( elem ) {
|
5034 |
if ( this.parentNode ) {
|
5035 |
this.parentNode.insertBefore( elem, this );
|
|
|
5036 |
}
|
5037 |
});
|
5038 |
},
|
|
|
5039 |
after: function() {
|
5040 |
return this.domManip( arguments, false, function( elem ) {
|
5041 |
if ( this.parentNode ) {
|
@@ -5043,15 +5982,18 @@ jQuery.fn.extend({
|
|
5043 |
}
|
5044 |
});
|
5045 |
},
|
|
|
5046 |
// keepData is for internal use only--do not document
|
5047 |
remove: function( selector, keepData ) {
|
5048 |
var elem,
|
5049 |
i = 0;
|
|
|
5050 |
for ( ; (elem = this[i]) != null; i++ ) {
|
5051 |
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
|
5052 |
if ( !keepData && elem.nodeType === 1 ) {
|
5053 |
jQuery.cleanData( getAll( elem ) );
|
5054 |
}
|
|
|
5055 |
if ( elem.parentNode ) {
|
5056 |
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
|
5057 |
setGlobalEval( getAll( elem, "script" ) );
|
@@ -5060,51 +6002,64 @@ jQuery.fn.extend({
|
|
5060 |
}
|
5061 |
}
|
5062 |
}
|
|
|
5063 |
return this;
|
5064 |
},
|
|
|
5065 |
empty: function() {
|
5066 |
var elem,
|
5067 |
i = 0;
|
|
|
5068 |
for ( ; (elem = this[i]) != null; i++ ) {
|
5069 |
// Remove element nodes and prevent memory leaks
|
5070 |
if ( elem.nodeType === 1 ) {
|
5071 |
jQuery.cleanData( getAll( elem, false ) );
|
5072 |
}
|
|
|
5073 |
// Remove any remaining nodes
|
5074 |
while ( elem.firstChild ) {
|
5075 |
elem.removeChild( elem.firstChild );
|
5076 |
}
|
|
|
5077 |
// If this is a select, ensure that it displays empty (#12336)
|
5078 |
// Support: IE<9
|
5079 |
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
|
5080 |
elem.options.length = 0;
|
5081 |
}
|
5082 |
}
|
|
|
5083 |
return this;
|
5084 |
},
|
|
|
5085 |
clone: function( dataAndEvents, deepDataAndEvents ) {
|
5086 |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
|
5087 |
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
|
|
|
5088 |
return this.map( function () {
|
5089 |
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
|
5090 |
});
|
5091 |
},
|
|
|
5092 |
html: function( value ) {
|
5093 |
return jQuery.access( this, function( value ) {
|
5094 |
var elem = this[0] || {},
|
5095 |
i = 0,
|
5096 |
l = this.length;
|
|
|
5097 |
if ( value === undefined ) {
|
5098 |
return elem.nodeType === 1 ?
|
5099 |
elem.innerHTML.replace( rinlinejQuery, "" ) :
|
5100 |
undefined;
|
5101 |
}
|
|
|
5102 |
// See if we can take a shortcut and just use innerHTML
|
5103 |
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
|
5104 |
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
|
5105 |
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
|
5106 |
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
|
|
|
5107 |
value = value.replace( rxhtmlTag, "<$1></$2>" );
|
|
|
5108 |
try {
|
5109 |
for (; i < l; i++ ) {
|
5110 |
// Remove element nodes and prevent memory leaks
|
@@ -5114,37 +6069,48 @@ jQuery.fn.extend({
|
|
5114 |
elem.innerHTML = value;
|
5115 |
}
|
5116 |
}
|
|
|
5117 |
elem = 0;
|
|
|
5118 |
// If using innerHTML throws an exception, use the fallback method
|
5119 |
} catch(e) {}
|
5120 |
}
|
|
|
5121 |
if ( elem ) {
|
5122 |
this.empty().append( value );
|
5123 |
}
|
5124 |
}, null, value, arguments.length );
|
5125 |
},
|
|
|
5126 |
replaceWith: function( value ) {
|
5127 |
var isFunc = jQuery.isFunction( value );
|
|
|
5128 |
// Make sure that the elements are removed from the DOM before they are inserted
|
5129 |
// this can help fix replacing a parent with child elements
|
5130 |
if ( !isFunc && typeof value !== "string" ) {
|
5131 |
value = jQuery( value ).not( this ).detach();
|
5132 |
}
|
|
|
5133 |
return this.domManip( [ value ], true, function( elem ) {
|
5134 |
var next = this.nextSibling,
|
5135 |
parent = this.parentNode;
|
|
|
5136 |
if ( parent ) {
|
5137 |
jQuery( this ).remove();
|
5138 |
parent.insertBefore( elem, next );
|
5139 |
}
|
5140 |
});
|
5141 |
},
|
|
|
5142 |
detach: function( selector ) {
|
5143 |
return this.remove( selector, true );
|
5144 |
},
|
|
|
5145 |
domManip: function( args, table, callback ) {
|
|
|
5146 |
// Flatten any nested arrays
|
5147 |
args = core_concat.apply( [], args );
|
|
|
5148 |
var first, node, hasScripts,
|
5149 |
scripts, doc, fragment,
|
5150 |
i = 0,
|
@@ -5153,6 +6119,7 @@ jQuery.fn.extend({
|
|
5153 |
iNoClone = l - 1,
|
5154 |
value = args[0],
|
5155 |
isFunction = jQuery.isFunction( value );
|
|
|
5156 |
// We can't cloneNode fragments that contain checked, in WebKit
|
5157 |
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
|
5158 |
return this.each(function( index ) {
|
@@ -5163,27 +6130,34 @@ jQuery.fn.extend({
|
|
5163 |
self.domManip( args, table, callback );
|
5164 |
});
|
5165 |
}
|
|
|
5166 |
if ( l ) {
|
5167 |
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
|
5168 |
first = fragment.firstChild;
|
|
|
5169 |
if ( fragment.childNodes.length === 1 ) {
|
5170 |
fragment = first;
|
5171 |
}
|
|
|
5172 |
if ( first ) {
|
5173 |
table = table && jQuery.nodeName( first, "tr" );
|
5174 |
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
|
5175 |
hasScripts = scripts.length;
|
|
|
5176 |
// Use the original fragment for the last item instead of the first because it can end up
|
5177 |
// being emptied incorrectly in certain situations (#8070).
|
5178 |
for ( ; i < l; i++ ) {
|
5179 |
node = fragment;
|
|
|
5180 |
if ( i !== iNoClone ) {
|
5181 |
node = jQuery.clone( node, true, true );
|
|
|
5182 |
// Keep references to cloned scripts for later restoration
|
5183 |
if ( hasScripts ) {
|
5184 |
jQuery.merge( scripts, getAll( node, "script" ) );
|
5185 |
}
|
5186 |
}
|
|
|
5187 |
callback.call(
|
5188 |
table && jQuery.nodeName( this[i], "table" ) ?
|
5189 |
findOrAppend( this[i], "tbody" ) :
|
@@ -5192,15 +6166,19 @@ jQuery.fn.extend({
|
|
5192 |
i
|
5193 |
);
|
5194 |
}
|
|
|
5195 |
if ( hasScripts ) {
|
5196 |
doc = scripts[ scripts.length - 1 ].ownerDocument;
|
|
|
5197 |
// Reenable scripts
|
5198 |
jQuery.map( scripts, restoreScript );
|
|
|
5199 |
// Evaluate executable scripts on first document insertion
|
5200 |
for ( i = 0; i < hasScripts; i++ ) {
|
5201 |
node = scripts[ i ];
|
5202 |
if ( rscriptType.test( node.type || "" ) &&
|
5203 |
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
|
|
|
5204 |
if ( node.src ) {
|
5205 |
// Hope ajax is available...
|
5206 |
jQuery.ajax({
|
@@ -5217,16 +6195,20 @@ jQuery.fn.extend({
|
|
5217 |
}
|
5218 |
}
|
5219 |
}
|
|
|
5220 |
// Fix #11809: Avoid leaking memory
|
5221 |
fragment = first = null;
|
5222 |
}
|
5223 |
}
|
|
|
5224 |
return this;
|
5225 |
}
|
5226 |
});
|
|
|
5227 |
function findOrAppend( elem, tag ) {
|
5228 |
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
|
5229 |
}
|
|
|
5230 |
// Replace/restore the type attribute of script elements for safe DOM manipulation
|
5231 |
function disableScript( elem ) {
|
5232 |
var attr = elem.getAttributeNode("type");
|
@@ -5242,6 +6224,7 @@ function restoreScript( elem ) {
|
|
5242 |
}
|
5243 |
return elem;
|
5244 |
}
|
|
|
5245 |
// Mark scripts as having already been evaluated
|
5246 |
function setGlobalEval( elems, refElements ) {
|
5247 |
var elem,
|
@@ -5250,54 +6233,69 @@ function setGlobalEval( elems, refElements ) {
|
|
5250 |
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
|
5251 |
}
|
5252 |
}
|
|
|
5253 |
function cloneCopyEvent( src, dest ) {
|
|
|
5254 |
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
|
5255 |
return;
|
5256 |
}
|
|
|
5257 |
var type, i, l,
|
5258 |
oldData = jQuery._data( src ),
|
5259 |
curData = jQuery._data( dest, oldData ),
|
5260 |
events = oldData.events;
|
|
|
5261 |
if ( events ) {
|
5262 |
delete curData.handle;
|
5263 |
curData.events = {};
|
|
|
5264 |
for ( type in events ) {
|
5265 |
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
|
5266 |
jQuery.event.add( dest, type, events[ type ][ i ] );
|
5267 |
}
|
5268 |
}
|
5269 |
}
|
|
|
5270 |
// make the cloned public data object a copy from the original
|
5271 |
if ( curData.data ) {
|
5272 |
curData.data = jQuery.extend( {}, curData.data );
|
5273 |
}
|
5274 |
}
|
|
|
5275 |
function fixCloneNodeIssues( src, dest ) {
|
5276 |
var nodeName, e, data;
|
|
|
5277 |
// We do not need to do anything for non-Elements
|
5278 |
if ( dest.nodeType !== 1 ) {
|
5279 |
return;
|
5280 |
}
|
|
|
5281 |
nodeName = dest.nodeName.toLowerCase();
|
|
|
5282 |
// IE6-8 copies events bound via attachEvent when using cloneNode.
|
5283 |
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
|
5284 |
data = jQuery._data( dest );
|
|
|
5285 |
for ( e in data.events ) {
|
5286 |
jQuery.removeEvent( dest, e, data.handle );
|
5287 |
}
|
|
|
5288 |
// Event data gets referenced instead of copied if the expando gets copied too
|
5289 |
dest.removeAttribute( jQuery.expando );
|
5290 |
}
|
|
|
5291 |
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
|
5292 |
if ( nodeName === "script" && dest.text !== src.text ) {
|
5293 |
disableScript( dest ).text = src.text;
|
5294 |
restoreScript( dest );
|
|
|
5295 |
// IE6-10 improperly clones children of object elements using classid.
|
5296 |
// IE10 throws NoModificationAllowedError if parent is null, #12132.
|
5297 |
} else if ( nodeName === "object" ) {
|
5298 |
if ( dest.parentNode ) {
|
5299 |
dest.outerHTML = src.outerHTML;
|
5300 |
}
|
|
|
5301 |
// This path appears unavoidable for IE9. When cloning an object
|
5302 |
// element in IE9, the outerHTML strategy above is not sufficient.
|
5303 |
// If the src has innerHTML and the destination does not,
|
@@ -5305,26 +6303,32 @@ function fixCloneNodeIssues( src, dest ) {
|
|
5305 |
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
|
5306 |
dest.innerHTML = src.innerHTML;
|
5307 |
}
|
|
|
5308 |
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
|
5309 |
// IE6-8 fails to persist the checked state of a cloned checkbox
|
5310 |
// or radio button. Worse, IE6-7 fail to give the cloned element
|
5311 |
// a checked appearance if the defaultChecked value isn't also set
|
|
|
5312 |
dest.defaultChecked = dest.checked = src.checked;
|
|
|
5313 |
// IE6-7 get confused and end up setting the value of a cloned
|
5314 |
// checkbox/radio button to an empty string instead of "on"
|
5315 |
if ( dest.value !== src.value ) {
|
5316 |
dest.value = src.value;
|
5317 |
}
|
|
|
5318 |
// IE6-8 fails to return the selected option to the default selected
|
5319 |
// state when cloning options
|
5320 |
} else if ( nodeName === "option" ) {
|
5321 |
dest.defaultSelected = dest.selected = src.defaultSelected;
|
|
|
5322 |
// IE6-8 fails to set the defaultValue to the correct value when
|
5323 |
// cloning other types of input fields
|
5324 |
} else if ( nodeName === "input" || nodeName === "textarea" ) {
|
5325 |
dest.defaultValue = src.defaultValue;
|
5326 |
}
|
5327 |
}
|
|
|
5328 |
jQuery.each({
|
5329 |
appendTo: "append",
|
5330 |
prependTo: "prepend",
|
@@ -5338,21 +6342,26 @@ jQuery.each({
|
|
5338 |
ret = [],
|
5339 |
insert = jQuery( selector ),
|
5340 |
last = insert.length - 1;
|
|
|
5341 |
for ( ; i <= last; i++ ) {
|
5342 |
elems = i === last ? this : this.clone(true);
|
5343 |
jQuery( insert[i] )[ original ]( elems );
|
|
|
5344 |
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
|
5345 |
core_push.apply( ret, elems.get() );
|
5346 |
}
|
|
|
5347 |
return this.pushStack( ret );
|
5348 |
};
|
5349 |
});
|
|
|
5350 |
function getAll( context, tag ) {
|
5351 |
var elems, elem,
|
5352 |
i = 0,
|
5353 |
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
|
5354 |
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
|
5355 |
undefined;
|
|
|
5356 |
if ( !found ) {
|
5357 |
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
|
5358 |
if ( !tag || jQuery.nodeName( elem, tag ) ) {
|
@@ -5362,32 +6371,40 @@ function getAll( context, tag ) {
|
|
5362 |
}
|
5363 |
}
|
5364 |
}
|
|
|
5365 |
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
|
5366 |
jQuery.merge( [ context ], found ) :
|
5367 |
found;
|
5368 |
}
|
|
|
5369 |
// Used in buildFragment, fixes the defaultChecked property
|
5370 |
function fixDefaultChecked( elem ) {
|
5371 |
if ( manipulation_rcheckableType.test( elem.type ) ) {
|
5372 |
elem.defaultChecked = elem.checked;
|
5373 |
}
|
5374 |
}
|
|
|
5375 |
jQuery.extend({
|
5376 |
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
|
5377 |
var destElements, node, clone, i, srcElements,
|
5378 |
inPage = jQuery.contains( elem.ownerDocument, elem );
|
|
|
5379 |
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
|
5380 |
clone = elem.cloneNode( true );
|
|
|
5381 |
// IE<=8 does not properly clone detached, unknown element nodes
|
5382 |
} else {
|
5383 |
fragmentDiv.innerHTML = elem.outerHTML;
|
5384 |
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
|
5385 |
}
|
|
|
5386 |
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
|
5387 |
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
|
|
|
5388 |
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
5389 |
destElements = getAll( clone );
|
5390 |
srcElements = getAll( elem );
|
|
|
5391 |
// Fix all IE cloning issues
|
5392 |
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
|
5393 |
// Ensure that the destination node is not null; Fixes #9587
|
@@ -5396,11 +6413,13 @@ jQuery.extend({
|
|
5396 |
}
|
5397 |
}
|
5398 |
}
|
|
|
5399 |
// Copy the events from the original to the clone
|
5400 |
if ( dataAndEvents ) {
|
5401 |
if ( deepDataAndEvents ) {
|
5402 |
srcElements = srcElements || getAll( elem );
|
5403 |
destElements = destElements || getAll( clone );
|
|
|
5404 |
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
|
5405 |
cloneCopyEvent( node, destElements[i] );
|
5406 |
}
|
@@ -5408,57 +6427,76 @@ jQuery.extend({
|
|
5408 |
cloneCopyEvent( elem, clone );
|
5409 |
}
|
5410 |
}
|
|
|
5411 |
// Preserve script evaluation history
|
5412 |
destElements = getAll( clone, "script" );
|
5413 |
if ( destElements.length > 0 ) {
|
5414 |
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
|
5415 |
}
|
|
|
5416 |
destElements = srcElements = node = null;
|
|
|
5417 |
// Return the cloned set
|
5418 |
return clone;
|
5419 |
},
|
|
|
5420 |
buildFragment: function( elems, context, scripts, selection ) {
|
5421 |
var j, elem, contains,
|
5422 |
tmp, tag, tbody, wrap,
|
5423 |
l = elems.length,
|
|
|
5424 |
// Ensure a safe fragment
|
5425 |
safe = createSafeFragment( context ),
|
|
|
5426 |
nodes = [],
|
5427 |
i = 0;
|
|
|
5428 |
for ( ; i < l; i++ ) {
|
5429 |
elem = elems[ i ];
|
|
|
5430 |
if ( elem || elem === 0 ) {
|
|
|
5431 |
// Add nodes directly
|
5432 |
if ( jQuery.type( elem ) === "object" ) {
|
5433 |
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
|
|
|
5434 |
// Convert non-html into a text node
|
5435 |
} else if ( !rhtml.test( elem ) ) {
|
5436 |
nodes.push( context.createTextNode( elem ) );
|
|
|
5437 |
// Convert html into DOM nodes
|
5438 |
} else {
|
5439 |
tmp = tmp || safe.appendChild( context.createElement("div") );
|
|
|
5440 |
// Deserialize a standard representation
|
5441 |
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
|
5442 |
wrap = wrapMap[ tag ] || wrapMap._default;
|
|
|
5443 |
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
|
|
|
5444 |
// Descend through wrappers to the right content
|
5445 |
j = wrap[0];
|
5446 |
while ( j-- ) {
|
5447 |
tmp = tmp.lastChild;
|
5448 |
}
|
|
|
5449 |
// Manually add leading whitespace removed by IE
|
5450 |
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
|
5451 |
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
|
5452 |
}
|
|
|
5453 |
// Remove IE's autoinserted <tbody> from table fragments
|
5454 |
if ( !jQuery.support.tbody ) {
|
|
|
5455 |
// String was a <table>, *may* have spurious <tbody>
|
5456 |
elem = tag === "table" && !rtbody.test( elem ) ?
|
5457 |
tmp.firstChild :
|
|
|
5458 |
// String was a bare <thead> or <tfoot>
|
5459 |
wrap[1] === "<table>" && !rtbody.test( elem ) ?
|
5460 |
tmp :
|
5461 |
0;
|
|
|
5462 |
j = elem && elem.childNodes.length;
|
5463 |
while ( j-- ) {
|
5464 |
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
|
@@ -5466,41 +6504,53 @@ jQuery.extend({
|
|
5466 |
}
|
5467 |
}
|
5468 |
}
|
|
|
5469 |
jQuery.merge( nodes, tmp.childNodes );
|
|
|
5470 |
// Fix #12392 for WebKit and IE > 9
|
5471 |
tmp.textContent = "";
|
|
|
5472 |
// Fix #12392 for oldIE
|
5473 |
while ( tmp.firstChild ) {
|
5474 |
tmp.removeChild( tmp.firstChild );
|
5475 |
}
|
|
|
5476 |
// Remember the top-level container for proper cleanup
|
5477 |
tmp = safe.lastChild;
|
5478 |
}
|
5479 |
}
|
5480 |
}
|
|
|
5481 |
// Fix #11356: Clear elements from fragment
|
5482 |
if ( tmp ) {
|
5483 |
safe.removeChild( tmp );
|
5484 |
}
|
|
|
5485 |
// Reset defaultChecked for any radios and checkboxes
|
5486 |
// about to be appended to the DOM in IE 6/7 (#8060)
|
5487 |
if ( !jQuery.support.appendChecked ) {
|
5488 |
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
|
5489 |
}
|
|
|
5490 |
i = 0;
|
5491 |
while ( (elem = nodes[ i++ ]) ) {
|
|
|
5492 |
// #4087 - If origin and destination elements are the same, and this is
|
5493 |
// that element, do not do anything
|
5494 |
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
|
5495 |
continue;
|
5496 |
}
|
|
|
5497 |
contains = jQuery.contains( elem.ownerDocument, elem );
|
|
|
5498 |
// Append to fragment
|
5499 |
tmp = getAll( safe.appendChild( elem ), "script" );
|
|
|
5500 |
// Preserve script evaluation history
|
5501 |
if ( contains ) {
|
5502 |
setGlobalEval( tmp );
|
5503 |
}
|
|
|
5504 |
// Capture executables
|
5505 |
if ( scripts ) {
|
5506 |
j = 0;
|
@@ -5511,9 +6561,12 @@ jQuery.extend({
|
|
5511 |
}
|
5512 |
}
|
5513 |
}
|
|
|
5514 |
tmp = null;
|
|
|
5515 |
return safe;
|
5516 |
},
|
|
|
5517 |
cleanData: function( elems, /* internal */ acceptData ) {
|
5518 |
var elem, type, id, data,
|
5519 |
i = 0,
|
@@ -5521,34 +6574,45 @@ jQuery.extend({
|
|
5521 |
cache = jQuery.cache,
|
5522 |
deleteExpando = jQuery.support.deleteExpando,
|
5523 |
special = jQuery.event.special;
|
|
|
5524 |
for ( ; (elem = elems[i]) != null; i++ ) {
|
|
|
5525 |
if ( acceptData || jQuery.acceptData( elem ) ) {
|
|
|
5526 |
id = elem[ internalKey ];
|
5527 |
data = id && cache[ id ];
|
|
|
5528 |
if ( data ) {
|
5529 |
if ( data.events ) {
|
5530 |
for ( type in data.events ) {
|
5531 |
if ( special[ type ] ) {
|
5532 |
jQuery.event.remove( elem, type );
|
|
|
5533 |
// This is a shortcut to avoid jQuery.event.remove's overhead
|
5534 |
} else {
|
5535 |
jQuery.removeEvent( elem, type, data.handle );
|
5536 |
}
|
5537 |
}
|
5538 |
}
|
|
|
5539 |
// Remove cache only if it was not already removed by jQuery.event.remove
|
5540 |
if ( cache[ id ] ) {
|
|
|
5541 |
delete cache[ id ];
|
|
|
5542 |
// IE does not allow us to delete expando properties from nodes,
|
5543 |
// nor does it have a removeAttribute function on Document nodes;
|
5544 |
// we must handle all of these cases
|
5545 |
if ( deleteExpando ) {
|
5546 |
delete elem[ internalKey ];
|
|
|
5547 |
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
|
5548 |
elem.removeAttribute( internalKey );
|
|
|
5549 |
} else {
|
5550 |
elem[ internalKey ] = null;
|
5551 |
}
|
|
|
5552 |
core_deletedIds.push( id );
|
5553 |
}
|
5554 |
}
|
@@ -5568,47 +6632,58 @@ var iframe, getStyles, curCSS,
|
|
5568 |
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
|
5569 |
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
|
5570 |
elemdisplay = { BODY: "block" },
|
|
|
5571 |
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
5572 |
cssNormalTransform = {
|
5573 |
letterSpacing: 0,
|
5574 |
fontWeight: 400
|
5575 |
},
|
|
|
5576 |
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
|
5577 |
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
|
|
|
5578 |
// return a css property mapped to a potentially vendor prefixed property
|
5579 |
function vendorPropName( style, name ) {
|
|
|
5580 |
// shortcut for names that are not vendor prefixed
|
5581 |
if ( name in style ) {
|
5582 |
return name;
|
5583 |
}
|
|
|
5584 |
// check for vendor prefixed names
|
5585 |
var capName = name.charAt(0).toUpperCase() + name.slice(1),
|
5586 |
origName = name,
|
5587 |
i = cssPrefixes.length;
|
|
|
5588 |
while ( i-- ) {
|
5589 |
name = cssPrefixes[ i ] + capName;
|
5590 |
if ( name in style ) {
|
5591 |
return name;
|
5592 |
}
|
5593 |
}
|
|
|
5594 |
return origName;
|
5595 |
}
|
|
|
5596 |
function isHidden( elem, el ) {
|
5597 |
// isHidden might be called from jQuery#filter function;
|
5598 |
// in that case, element will be second argument
|
5599 |
elem = el || elem;
|
5600 |
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
|
5601 |
}
|
|
|
5602 |
function showHide( elements, show ) {
|
5603 |
var display, elem, hidden,
|
5604 |
values = [],
|
5605 |
index = 0,
|
5606 |
length = elements.length;
|
|
|
5607 |
for ( ; index < length; index++ ) {
|
5608 |
elem = elements[ index ];
|
5609 |
if ( !elem.style ) {
|
5610 |
continue;
|
5611 |
}
|
|
|
5612 |
values[ index ] = jQuery._data( elem, "olddisplay" );
|
5613 |
display = elem.style.display;
|
5614 |
if ( show ) {
|
@@ -5617,6 +6692,7 @@ function showHide( elements, show ) {
|
|
5617 |
if ( !values[ index ] && display === "none" ) {
|
5618 |
elem.style.display = "";
|
5619 |
}
|
|
|
5620 |
// Set elements which have been overridden with display: none
|
5621 |
// in a stylesheet to whatever the default browser style is
|
5622 |
// for such an element
|
@@ -5624,14 +6700,17 @@ function showHide( elements, show ) {
|
|
5624 |
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
|
5625 |
}
|
5626 |
} else {
|
|
|
5627 |
if ( !values[ index ] ) {
|
5628 |
hidden = isHidden( elem );
|
|
|
5629 |
if ( display && display !== "none" || !hidden ) {
|
5630 |
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
|
5631 |
}
|
5632 |
}
|
5633 |
}
|
5634 |
}
|
|
|
5635 |
// Set the display of most of the elements in a second loop
|
5636 |
// to avoid the constant reflow
|
5637 |
for ( index = 0; index < length; index++ ) {
|
@@ -5643,22 +6722,28 @@ function showHide( elements, show ) {
|
|
5643 |
elem.style.display = show ? values[ index ] || "" : "none";
|
5644 |
}
|
5645 |
}
|
|
|
5646 |
return elements;
|
5647 |
}
|
|
|
5648 |
jQuery.fn.extend({
|
5649 |
css: function( name, value ) {
|
5650 |
return jQuery.access( this, function( elem, name, value ) {
|
5651 |
var len, styles,
|
5652 |
map = {},
|
5653 |
i = 0;
|
|
|
5654 |
if ( jQuery.isArray( name ) ) {
|
5655 |
styles = getStyles( elem );
|
5656 |
len = name.length;
|
|
|
5657 |
for ( ; i < len; i++ ) {
|
5658 |
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
|
5659 |
}
|
|
|
5660 |
return map;
|
5661 |
}
|
|
|
5662 |
return value !== undefined ?
|
5663 |
jQuery.style( elem, name, value ) :
|
5664 |
jQuery.css( elem, name );
|
@@ -5672,6 +6757,7 @@ jQuery.fn.extend({
|
|
5672 |
},
|
5673 |
toggle: function( state ) {
|
5674 |
var bool = typeof state === "boolean";
|
|
|
5675 |
return this.each(function() {
|
5676 |
if ( bool ? state : isHidden( this ) ) {
|
5677 |
jQuery( this ).show();
|
@@ -5681,6 +6767,7 @@ jQuery.fn.extend({
|
|
5681 |
});
|
5682 |
}
|
5683 |
});
|
|
|
5684 |
jQuery.extend({
|
5685 |
// Add in style property hooks for overriding the default
|
5686 |
// behavior of getting and setting a style property
|
@@ -5695,6 +6782,7 @@ jQuery.extend({
|
|
5695 |
}
|
5696 |
}
|
5697 |
},
|
|
|
5698 |
// Exclude the following css properties to add px
|
5699 |
cssNumber: {
|
5700 |
"columnCount": true,
|
@@ -5707,85 +6795,106 @@ jQuery.extend({
|
|
5707 |
"zIndex": true,
|
5708 |
"zoom": true
|
5709 |
},
|
|
|
5710 |
// Add in properties whose names you wish to fix before
|
5711 |
// setting or getting the value
|
5712 |
cssProps: {
|
5713 |
// normalize float css property
|
5714 |
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
|
5715 |
},
|
|
|
5716 |
// Get and set the style property on a DOM Node
|
5717 |
style: function( elem, name, value, extra ) {
|
5718 |
// Don't set styles on text and comment nodes
|
5719 |
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
5720 |
return;
|
5721 |
}
|
|
|
5722 |
// Make sure that we're working with the right name
|
5723 |
var ret, type, hooks,
|
5724 |
origName = jQuery.camelCase( name ),
|
5725 |
style = elem.style;
|
|
|
5726 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
|
|
|
5727 |
// gets hook for the prefixed version
|
5728 |
// followed by the unprefixed version
|
5729 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
|
|
5730 |
// Check if we're setting a value
|
5731 |
if ( value !== undefined ) {
|
5732 |
type = typeof value;
|
|
|
5733 |
// convert relative number strings (+= or -=) to relative numbers. #7345
|
5734 |
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
|
5735 |
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
|
5736 |
// Fixes bug #9237
|
5737 |
type = "number";
|
5738 |
}
|
|
|
5739 |
// Make sure that NaN and null values aren't set. See: #7116
|
5740 |
if ( value == null || type === "number" && isNaN( value ) ) {
|
5741 |
return;
|
5742 |
}
|
|
|
5743 |
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
5744 |
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
|
5745 |
value += "px";
|
5746 |
}
|
|
|
5747 |
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
|
5748 |
// but it would mean to define eight (for every problematic property) identical functions
|
5749 |
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
|
5750 |
style[ name ] = "inherit";
|
5751 |
}
|
|
|
5752 |
// If a hook was provided, use that value, otherwise just set the specified value
|
5753 |
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
|
|
|
5754 |
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
5755 |
// Fixes bug #5509
|
5756 |
try {
|
5757 |
style[ name ] = value;
|
5758 |
} catch(e) {}
|
5759 |
}
|
|
|
5760 |
} else {
|
5761 |
// If a hook was provided get the non-computed value from there
|
5762 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
5763 |
return ret;
|
5764 |
}
|
|
|
5765 |
// Otherwise just get the value from the style object
|
5766 |
return style[ name ];
|
5767 |
}
|
5768 |
},
|
|
|
5769 |
css: function( elem, name, extra, styles ) {
|
5770 |
var num, val, hooks,
|
5771 |
origName = jQuery.camelCase( name );
|
|
|
5772 |
// Make sure that we're working with the right name
|
5773 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
|
|
|
5774 |
// gets hook for the prefixed version
|
5775 |
// followed by the unprefixed version
|
5776 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
|
|
5777 |
// If a hook was provided get the computed value from there
|
5778 |
if ( hooks && "get" in hooks ) {
|
5779 |
val = hooks.get( elem, true, extra );
|
5780 |
}
|
|
|
5781 |
// Otherwise, if a way to get the computed value exists, use that
|
5782 |
if ( val === undefined ) {
|
5783 |
val = curCSS( elem, name, styles );
|
5784 |
}
|
|
|
5785 |
//convert "normal" to computed value
|
5786 |
if ( val === "normal" && name in cssNormalTransform ) {
|
5787 |
val = cssNormalTransform[ name ];
|
5788 |
}
|
|
|
5789 |
// Return, converting to number if forced or a qualifier was provided and val looks numeric
|
5790 |
if ( extra === "" || extra ) {
|
5791 |
num = parseFloat( val );
|
@@ -5793,99 +6902,123 @@ jQuery.extend({
|
|
5793 |
}
|
5794 |
return val;
|
5795 |
},
|
|
|
5796 |
// A method for quickly swapping in/out CSS properties to get correct calculations
|
5797 |
swap: function( elem, options, callback, args ) {
|
5798 |
var ret, name,
|
5799 |
old = {};
|
|
|
5800 |
// Remember the old values, and insert the new ones
|
5801 |
for ( name in options ) {
|
5802 |
old[ name ] = elem.style[ name ];
|
5803 |
elem.style[ name ] = options[ name ];
|
5804 |
}
|
|
|
5805 |
ret = callback.apply( elem, args || [] );
|
|
|
5806 |
// Revert the old values
|
5807 |
for ( name in options ) {
|
5808 |
elem.style[ name ] = old[ name ];
|
5809 |
}
|
|
|
5810 |
return ret;
|
5811 |
}
|
5812 |
});
|
|
|
5813 |
// NOTE: we've included the "window" in window.getComputedStyle
|
5814 |
// because jsdom on node.js will break without it.
|
5815 |
if ( window.getComputedStyle ) {
|
5816 |
getStyles = function( elem ) {
|
5817 |
return window.getComputedStyle( elem, null );
|
5818 |
};
|
|
|
5819 |
curCSS = function( elem, name, _computed ) {
|
5820 |
var width, minWidth, maxWidth,
|
5821 |
computed = _computed || getStyles( elem ),
|
|
|
5822 |
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
|
5823 |
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
|
5824 |
style = elem.style;
|
|
|
5825 |
if ( computed ) {
|
|
|
5826 |
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
5827 |
ret = jQuery.style( elem, name );
|
5828 |
}
|
|
|
5829 |
// A tribute to the "awesome hack by Dean Edwards"
|
5830 |
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
|
5831 |
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
|
5832 |
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
5833 |
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
|
|
|
5834 |
// Remember the original values
|
5835 |
width = style.width;
|
5836 |
minWidth = style.minWidth;
|
5837 |
maxWidth = style.maxWidth;
|
|
|
5838 |
// Put in the new values to get a computed value out
|
5839 |
style.minWidth = style.maxWidth = style.width = ret;
|
5840 |
ret = computed.width;
|
|
|
5841 |
// Revert the changed values
|
5842 |
style.width = width;
|
5843 |
style.minWidth = minWidth;
|
5844 |
style.maxWidth = maxWidth;
|
5845 |
}
|
5846 |
}
|
|
|
5847 |
return ret;
|
5848 |
};
|
5849 |
} else if ( document.documentElement.currentStyle ) {
|
5850 |
getStyles = function( elem ) {
|
5851 |
return elem.currentStyle;
|
5852 |
};
|
|
|
5853 |
curCSS = function( elem, name, _computed ) {
|
5854 |
var left, rs, rsLeft,
|
5855 |
computed = _computed || getStyles( elem ),
|
5856 |
ret = computed ? computed[ name ] : undefined,
|
5857 |
style = elem.style;
|
|
|
5858 |
// Avoid setting ret to empty string here
|
5859 |
// so we don't default to auto
|
5860 |
if ( ret == null && style && style[ name ] ) {
|
5861 |
ret = style[ name ];
|
5862 |
}
|
|
|
5863 |
// From the awesome hack by Dean Edwards
|
5864 |
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
|
|
5865 |
// If we're not dealing with a regular pixel number
|
5866 |
// but a number that has a weird ending, we need to convert it to pixels
|
5867 |
// but not position css attributes, as those are proportional to the parent element instead
|
5868 |
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
|
5869 |
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
|
|
|
5870 |
// Remember the original values
|
5871 |
left = style.left;
|
5872 |
rs = elem.runtimeStyle;
|
5873 |
rsLeft = rs && rs.left;
|
|
|
5874 |
// Put in the new values to get a computed value out
|
5875 |
if ( rsLeft ) {
|
5876 |
rs.left = elem.currentStyle.left;
|
5877 |
}
|
5878 |
style.left = name === "fontSize" ? "1em" : ret;
|
5879 |
ret = style.pixelLeft + "px";
|
|
|
5880 |
// Revert the changed values
|
5881 |
style.left = left;
|
5882 |
if ( rsLeft ) {
|
5883 |
rs.left = rsLeft;
|
5884 |
}
|
5885 |
}
|
|
|
5886 |
return ret === "" ? "auto" : ret;
|
5887 |
};
|
5888 |
}
|
|
|
5889 |
function setPositiveNumber( elem, value, subtract ) {
|
5890 |
var matches = rnumsplit.exec( value );
|
5891 |
return matches ?
|
@@ -5893,23 +7026,28 @@ function setPositiveNumber( elem, value, subtract ) {
|
|
5893 |
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
|
5894 |
value;
|
5895 |
}
|
|
|
5896 |
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
|
5897 |
var i = extra === ( isBorderBox ? "border" : "content" ) ?
|
5898 |
// If we already have the right measurement, avoid augmentation
|
5899 |
4 :
|
5900 |
// Otherwise initialize for horizontal or vertical properties
|
5901 |
name === "width" ? 1 : 0,
|
|
|
5902 |
val = 0;
|
|
|
5903 |
for ( ; i < 4; i += 2 ) {
|
5904 |
// both box models exclude margin, so add it if we want it
|
5905 |
if ( extra === "margin" ) {
|
5906 |
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
|
5907 |
}
|
|
|
5908 |
if ( isBorderBox ) {
|
5909 |
// border-box includes padding, so remove it if we want content
|
5910 |
if ( extra === "content" ) {
|
5911 |
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
5912 |
}
|
|
|
5913 |
// at this point, extra isn't border nor margin, so remove border
|
5914 |
if ( extra !== "margin" ) {
|
5915 |
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
@@ -5917,20 +7055,25 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
|
|
5917 |
} else {
|
5918 |
// at this point, extra isn't content, so add padding
|
5919 |
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
|
|
5920 |
// at this point, extra isn't content nor padding, so add border
|
5921 |
if ( extra !== "padding" ) {
|
5922 |
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
5923 |
}
|
5924 |
}
|
5925 |
}
|
|
|
5926 |
return val;
|
5927 |
}
|
|
|
5928 |
function getWidthOrHeight( elem, name, extra ) {
|
|
|
5929 |
// Start with offset property, which is equivalent to the border-box value
|
5930 |
var valueIsBorderBox = true,
|
5931 |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
5932 |
styles = getStyles( elem ),
|
5933 |
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
|
|
5934 |
// some non-html elements return undefined for offsetWidth, so check for null/undefined
|
5935 |
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
5936 |
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
|
@@ -5940,16 +7083,20 @@ function getWidthOrHeight( elem, name, extra ) {
|
|
5940 |
if ( val < 0 || val == null ) {
|
5941 |
val = elem.style[ name ];
|
5942 |
}
|
|
|
5943 |
// Computed unit is not pixels. Stop here and return.
|
5944 |
if ( rnumnonpx.test(val) ) {
|
5945 |
return val;
|
5946 |
}
|
|
|
5947 |
// we need the check for style in case a browser which returns unreliable values
|
5948 |
// for getComputedStyle silently falls back to the reliable elem.style
|
5949 |
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
|
|
|
5950 |
// Normalize "", auto, and prepare for extra
|
5951 |
val = parseFloat( val ) || 0;
|
5952 |
}
|
|
|
5953 |
// use the active box-sizing model to add/subtract irrelevant styles
|
5954 |
return ( val +
|
5955 |
augmentWidthOrHeight(
|
@@ -5961,12 +7108,15 @@ function getWidthOrHeight( elem, name, extra ) {
|
|
5961 |
)
|
5962 |
) + "px";
|
5963 |
}
|
|
|
5964 |
// Try to determine the default display value of an element
|
5965 |
function css_defaultDisplay( nodeName ) {
|
5966 |
var doc = document,
|
5967 |
display = elemdisplay[ nodeName ];
|
|
|
5968 |
if ( !display ) {
|
5969 |
display = actualDisplay( nodeName, doc );
|
|
|
5970 |
// If the simple way fails, read from inside an iframe
|
5971 |
if ( display === "none" || !display ) {
|
5972 |
// Use the already-created iframe if possible
|
@@ -5974,18 +7124,23 @@ function css_defaultDisplay( nodeName ) {
|
|
5974 |
jQuery("<iframe frameborder='0' width='0' height='0'/>")
|
5975 |
.css( "cssText", "display:block !important" )
|
5976 |
).appendTo( doc.documentElement );
|
|
|
5977 |
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
5978 |
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
|
5979 |
doc.write("<!doctype html><html><body>");
|
5980 |
doc.close();
|
|
|
5981 |
display = actualDisplay( nodeName, doc );
|
5982 |
iframe.detach();
|
5983 |
}
|
|
|
5984 |
// Store the correct default display
|
5985 |
elemdisplay[ nodeName ] = display;
|
5986 |
}
|
|
|
5987 |
return display;
|
5988 |
}
|
|
|
5989 |
// Called ONLY from within css_defaultDisplay
|
5990 |
function actualDisplay( name, doc ) {
|
5991 |
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
|
@@ -5993,6 +7148,7 @@ function actualDisplay( name, doc ) {
|
|
5993 |
elem.remove();
|
5994 |
return display;
|
5995 |
}
|
|
|
5996 |
jQuery.each([ "height", "width" ], function( i, name ) {
|
5997 |
jQuery.cssHooks[ name ] = {
|
5998 |
get: function( elem, computed, extra ) {
|
@@ -6006,6 +7162,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
|
|
6006 |
getWidthOrHeight( elem, name, extra );
|
6007 |
}
|
6008 |
},
|
|
|
6009 |
set: function( elem, value, extra ) {
|
6010 |
var styles = extra && getStyles( elem );
|
6011 |
return setPositiveNumber( elem, value, extra ?
|
@@ -6020,6 +7177,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
|
|
6020 |
}
|
6021 |
};
|
6022 |
});
|
|
|
6023 |
if ( !jQuery.support.opacity ) {
|
6024 |
jQuery.cssHooks.opacity = {
|
6025 |
get: function( elem, computed ) {
|
@@ -6028,28 +7186,34 @@ if ( !jQuery.support.opacity ) {
|
|
6028 |
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
|
6029 |
computed ? "1" : "";
|
6030 |
},
|
|
|
6031 |
set: function( elem, value ) {
|
6032 |
var style = elem.style,
|
6033 |
currentStyle = elem.currentStyle,
|
6034 |
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
|
6035 |
filter = currentStyle && currentStyle.filter || style.filter || "";
|
|
|
6036 |
// IE has trouble with opacity if it does not have layout
|
6037 |
// Force it by setting the zoom level
|
6038 |
style.zoom = 1;
|
|
|
6039 |
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
|
6040 |
// if value === "", then remove inline opacity #12685
|
6041 |
if ( ( value >= 1 || value === "" ) &&
|
6042 |
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
|
6043 |
style.removeAttribute ) {
|
|
|
6044 |
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
|
6045 |
// if "filter:" is present at all, clearType is disabled, we want to avoid this
|
6046 |
// style.removeAttribute is IE Only, but so apparently is this code path...
|
6047 |
style.removeAttribute( "filter" );
|
|
|
6048 |
// if there is no filter style applied in a css rule or unset inline opacity, we are done
|
6049 |
if ( value === "" || currentStyle && !currentStyle.filter ) {
|
6050 |
return;
|
6051 |
}
|
6052 |
}
|
|
|
6053 |
// otherwise, set new filter values
|
6054 |
style.filter = ralpha.test( filter ) ?
|
6055 |
filter.replace( ralpha, opacity ) :
|
@@ -6057,6 +7221,7 @@ if ( !jQuery.support.opacity ) {
|
|
6057 |
}
|
6058 |
};
|
6059 |
}
|
|
|
6060 |
// These hooks cannot be added until DOM ready because the support test
|
6061 |
// for it is not run until after DOM ready
|
6062 |
jQuery(function() {
|
@@ -6072,6 +7237,7 @@ jQuery(function() {
|
|
6072 |
}
|
6073 |
};
|
6074 |
}
|
|
|
6075 |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
6076 |
// getComputedStyle returns percent when specified for top/left/bottom/right
|
6077 |
// rather than make the css module depend on the offset module, we just check for it here
|
@@ -6090,7 +7256,9 @@ jQuery(function() {
|
|
6090 |
};
|
6091 |
});
|
6092 |
}
|
|
|
6093 |
});
|
|
|
6094 |
if ( jQuery.expr && jQuery.expr.filters ) {
|
6095 |
jQuery.expr.filters.hidden = function( elem ) {
|
6096 |
// Support: Opera <= 12.12
|
@@ -6098,10 +7266,12 @@ if ( jQuery.expr && jQuery.expr.filters ) {
|
|
6098 |
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
|
6099 |
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
|
6100 |
};
|
|
|
6101 |
jQuery.expr.filters.visible = function( elem ) {
|
6102 |
return !jQuery.expr.filters.hidden( elem );
|
6103 |
};
|
6104 |
}
|
|
|
6105 |
// These hooks are used by animate to expand properties
|
6106 |
jQuery.each({
|
6107 |
margin: "",
|
@@ -6112,15 +7282,19 @@ jQuery.each({
|
|
6112 |
expand: function( value ) {
|
6113 |
var i = 0,
|
6114 |
expanded = {},
|
|
|
6115 |
// assumes a single number if not a string
|
6116 |
parts = typeof value === "string" ? value.split(" ") : [ value ];
|
|
|
6117 |
for ( ; i < 4; i++ ) {
|
6118 |
expanded[ prefix + cssExpand[ i ] + suffix ] =
|
6119 |
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
|
6120 |
}
|
|
|
6121 |
return expanded;
|
6122 |
}
|
6123 |
};
|
|
|
6124 |
if ( !rmargin.test( prefix ) ) {
|
6125 |
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
|
6126 |
}
|
@@ -6130,6 +7304,7 @@ var r20 = /%20/g,
|
|
6130 |
rCRLF = /\r?\n/g,
|
6131 |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
|
6132 |
rsubmittable = /^(?:input|select|textarea|keygen)/i;
|
|
|
6133 |
jQuery.fn.extend({
|
6134 |
serialize: function() {
|
6135 |
return jQuery.param( this.serializeArray() );
|
@@ -6149,6 +7324,7 @@ jQuery.fn.extend({
|
|
6149 |
})
|
6150 |
.map(function( i, elem ){
|
6151 |
var val = jQuery( this ).val();
|
|
|
6152 |
return val == null ?
|
6153 |
null :
|
6154 |
jQuery.isArray( val ) ?
|
@@ -6159,6 +7335,7 @@ jQuery.fn.extend({
|
|
6159 |
}).get();
|
6160 |
}
|
6161 |
});
|
|
|
6162 |
//Serialize an array of form elements or a set of
|
6163 |
//key/values into a query string
|
6164 |
jQuery.param = function( a, traditional ) {
|
@@ -6169,16 +7346,19 @@ jQuery.param = function( a, traditional ) {
|
|
6169 |
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
|
6170 |
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
|
6171 |
};
|
|
|
6172 |
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
6173 |
if ( traditional === undefined ) {
|
6174 |
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
6175 |
}
|
|
|
6176 |
// If an array was passed in, assume that it is an array of form elements.
|
6177 |
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
|
6178 |
// Serialize the form elements
|
6179 |
jQuery.each( a, function() {
|
6180 |
add( this.name, this.value );
|
6181 |
});
|
|
|
6182 |
} else {
|
6183 |
// If traditional, encode the "old" way (the way 1.3.2 or older
|
6184 |
// did it), otherwise encode params recursively.
|
@@ -6186,27 +7366,33 @@ jQuery.param = function( a, traditional ) {
|
|
6186 |
buildParams( prefix, a[ prefix ], traditional, add );
|
6187 |
}
|
6188 |
}
|
|
|
6189 |
// Return the resulting serialization
|
6190 |
return s.join( "&" ).replace( r20, "+" );
|
6191 |
};
|
|
|
6192 |
function buildParams( prefix, obj, traditional, add ) {
|
6193 |
var name;
|
|
|
6194 |
if ( jQuery.isArray( obj ) ) {
|
6195 |
// Serialize array item.
|
6196 |
jQuery.each( obj, function( i, v ) {
|
6197 |
if ( traditional || rbracket.test( prefix ) ) {
|
6198 |
// Treat each array item as a scalar.
|
6199 |
add( prefix, v );
|
|
|
6200 |
} else {
|
6201 |
// Item is non-scalar (array or object), encode its numeric index.
|
6202 |
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
|
6203 |
}
|
6204 |
});
|
|
|
6205 |
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
|
6206 |
// Serialize object item.
|
6207 |
for ( name in obj ) {
|
6208 |
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
|
6209 |
}
|
|
|
6210 |
} else {
|
6211 |
// Serialize scalar item.
|
6212 |
add( prefix, obj );
|
@@ -6215,6 +7401,7 @@ function buildParams( prefix, obj, traditional, add ) {
|
|
6215 |
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
6216 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
6217 |
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
|
|
|
6218 |
// Handle event binding
|
6219 |
jQuery.fn[ name ] = function( data, fn ) {
|
6220 |
return arguments.length > 0 ?
|
@@ -6222,6 +7409,7 @@ jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblcl
|
|
6222 |
this.trigger( name );
|
6223 |
};
|
6224 |
});
|
|
|
6225 |
jQuery.fn.hover = function( fnOver, fnOut ) {
|
6226 |
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
6227 |
};
|
@@ -6230,6 +7418,7 @@ var
|
|
6230 |
ajaxLocParts,
|
6231 |
ajaxLocation,
|
6232 |
ajax_nonce = jQuery.now(),
|
|
|
6233 |
ajax_rquery = /\?/,
|
6234 |
rhash = /#.*$/,
|
6235 |
rts = /([?&])_=[^&]*/,
|
@@ -6239,8 +7428,10 @@ var
|
|
6239 |
rnoContent = /^(?:GET|HEAD)$/,
|
6240 |
rprotocol = /^\/\//,
|
6241 |
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
|
|
|
6242 |
// Keep a copy of the old load method
|
6243 |
_load = jQuery.fn.load,
|
|
|
6244 |
/* Prefilters
|
6245 |
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
6246 |
* 2) These are called:
|
@@ -6251,14 +7442,17 @@ var
|
|
6251 |
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
6252 |
*/
|
6253 |
prefilters = {},
|
|
|
6254 |
/* Transports bindings
|
6255 |
* 1) key is the dataType
|
6256 |
* 2) the catchall symbol "*" can be used
|
6257 |
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
6258 |
*/
|
6259 |
transports = {},
|
|
|
6260 |
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
6261 |
allTypes = "*/".concat("*");
|
|
|
6262 |
// #8138, IE may throw an exception when accessing
|
6263 |
// a field from window.location if document.domain has been set
|
6264 |
try {
|
@@ -6270,19 +7464,26 @@ try {
|
|
6270 |
ajaxLocation.href = "";
|
6271 |
ajaxLocation = ajaxLocation.href;
|
6272 |
}
|
|
|
6273 |
// Segment location into parts
|
6274 |
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
|
|
|
|
|
6275 |
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
6276 |
function addToPrefiltersOrTransports( structure ) {
|
|
|
6277 |
// dataTypeExpression is optional and defaults to "*"
|
6278 |
return function( dataTypeExpression, func ) {
|
|
|
6279 |
if ( typeof dataTypeExpression !== "string" ) {
|
6280 |
func = dataTypeExpression;
|
6281 |
dataTypeExpression = "*";
|
6282 |
}
|
|
|
6283 |
var dataType,
|
6284 |
i = 0,
|
6285 |
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
|
|
|
6286 |
if ( jQuery.isFunction( func ) ) {
|
6287 |
// For each dataType in the dataTypeExpression
|
6288 |
while ( (dataType = dataTypes[i++]) ) {
|
@@ -6290,6 +7491,7 @@ function addToPrefiltersOrTransports( structure ) {
|
|
6290 |
if ( dataType[0] === "+" ) {
|
6291 |
dataType = dataType.slice( 1 ) || "*";
|
6292 |
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
|
|
|
6293 |
// Otherwise append
|
6294 |
} else {
|
6295 |
(structure[ dataType ] = structure[ dataType ] || []).push( func );
|
@@ -6298,10 +7500,13 @@ function addToPrefiltersOrTransports( structure ) {
|
|
6298 |
}
|
6299 |
};
|
6300 |
}
|
|
|
6301 |
// Base inspection function for prefilters and transports
|
6302 |
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
|
|
6303 |
var inspected = {},
|
6304 |
seekingTransport = ( structure === transports );
|
|
|
6305 |
function inspect( dataType ) {
|
6306 |
var selected;
|
6307 |
inspected[ dataType ] = true;
|
@@ -6317,14 +7522,17 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
|
|
6317 |
});
|
6318 |
return selected;
|
6319 |
}
|
|
|
6320 |
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
6321 |
}
|
|
|
6322 |
// A special extend for ajax options
|
6323 |
// that takes "flat" options (not to be deep extended)
|
6324 |
// Fixes #9887
|
6325 |
function ajaxExtend( target, src ) {
|
6326 |
var deep, key,
|
6327 |
flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
|
|
6328 |
for ( key in src ) {
|
6329 |
if ( src[ key ] !== undefined ) {
|
6330 |
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
|
@@ -6333,57 +7541,74 @@ function ajaxExtend( target, src ) {
|
|
6333 |
if ( deep ) {
|
6334 |
jQuery.extend( true, target, deep );
|
6335 |
}
|
|
|
6336 |
return target;
|
6337 |
}
|
|
|
6338 |
jQuery.fn.load = function( url, params, callback ) {
|
6339 |
if ( typeof url !== "string" && _load ) {
|
6340 |
return _load.apply( this, arguments );
|
6341 |
}
|
|
|
6342 |
var selector, response, type,
|
6343 |
self = this,
|
6344 |
off = url.indexOf(" ");
|
|
|
6345 |
if ( off >= 0 ) {
|
6346 |
selector = url.slice( off, url.length );
|
6347 |
url = url.slice( 0, off );
|
6348 |
}
|
|
|
6349 |
// If it's a function
|
6350 |
if ( jQuery.isFunction( params ) ) {
|
|
|
6351 |
// We assume that it's the callback
|
6352 |
callback = params;
|
6353 |
params = undefined;
|
|
|
6354 |
// Otherwise, build a param string
|
6355 |
} else if ( params && typeof params === "object" ) {
|
6356 |
type = "POST";
|
6357 |
}
|
|
|
6358 |
// If we have elements to modify, make the request
|
6359 |
if ( self.length > 0 ) {
|
6360 |
jQuery.ajax({
|
6361 |
url: url,
|
|
|
6362 |
// if "type" variable is undefined, then "GET" method will be used
|
6363 |
type: type,
|
6364 |
dataType: "html",
|
6365 |
data: params
|
6366 |
}).done(function( responseText ) {
|
|
|
6367 |
// Save response for use in complete callback
|
6368 |
response = arguments;
|
|
|
6369 |
self.html( selector ?
|
|
|
6370 |
// If a selector was specified, locate the right elements in a dummy div
|
6371 |
// Exclude scripts to avoid IE 'Permission Denied' errors
|
6372 |
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
|
|
6373 |
// Otherwise use the full result
|
6374 |
responseText );
|
|
|
6375 |
}).complete( callback && function( jqXHR, status ) {
|
6376 |
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
|
6377 |
});
|
6378 |
}
|
|
|
6379 |
return this;
|
6380 |
};
|
|
|
6381 |
// Attach a bunch of functions for handling common AJAX events
|
6382 |
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
|
6383 |
jQuery.fn[ type ] = function( fn ){
|
6384 |
return this.on( type, fn );
|
6385 |
};
|
6386 |
});
|
|
|
6387 |
jQuery.each( [ "get", "post" ], function( i, method ) {
|
6388 |
jQuery[ method ] = function( url, data, callback, type ) {
|
6389 |
// shift arguments if data argument was omitted
|
@@ -6392,6 +7617,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
|
|
6392 |
callback = data;
|
6393 |
data = undefined;
|
6394 |
}
|
|
|
6395 |
return jQuery.ajax({
|
6396 |
url: url,
|
6397 |
type: method,
|
@@ -6401,12 +7627,16 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
|
|
6401 |
});
|
6402 |
};
|
6403 |
});
|
|
|
6404 |
jQuery.extend({
|
|
|
6405 |
// Counter for holding the number of active queries
|
6406 |
active: 0,
|
|
|
6407 |
// Last-Modified header cache for next request
|
6408 |
lastModified: {},
|
6409 |
etag: {},
|
|
|
6410 |
ajaxSettings: {
|
6411 |
url: ajaxLocation,
|
6412 |
type: "GET",
|
@@ -6426,6 +7656,7 @@ jQuery.extend({
|
|
6426 |
traditional: false,
|
6427 |
headers: {},
|
6428 |
*/
|
|
|
6429 |
accepts: {
|
6430 |
"*": allTypes,
|
6431 |
text: "text/plain",
|
@@ -6433,27 +7664,35 @@ jQuery.extend({
|
|
6433 |
xml: "application/xml, text/xml",
|
6434 |
json: "application/json, text/javascript"
|
6435 |
},
|
|
|
6436 |
contents: {
|
6437 |
xml: /xml/,
|
6438 |
html: /html/,
|
6439 |
json: /json/
|
6440 |
},
|
|
|
6441 |
responseFields: {
|
6442 |
xml: "responseXML",
|
6443 |
text: "responseText"
|
6444 |
},
|
|
|
6445 |
// Data converters
|
6446 |
// Keys separate source (or catchall "*") and destination types with a single space
|
6447 |
converters: {
|
|
|
6448 |
// Convert anything to text
|
6449 |
"* text": window.String,
|
|
|
6450 |
// Text to html (true = no transformation)
|
6451 |
"text html": true,
|
|
|
6452 |
// Evaluate text as a json expression
|
6453 |
"text json": jQuery.parseJSON,
|
|
|
6454 |
// Parse text as xml
|
6455 |
"text xml": jQuery.parseXML
|
6456 |
},
|
|
|
6457 |
// For options that shouldn't be deep extended:
|
6458 |
// you can add your own custom options here if
|
6459 |
// and when you create one that shouldn't be
|
@@ -6463,27 +7702,35 @@ jQuery.extend({
|
|
6463 |
context: true
|
6464 |
}
|
6465 |
},
|
|
|
6466 |
// Creates a full fledged settings object into target
|
6467 |
// with both ajaxSettings and settings fields.
|
6468 |
// If target is omitted, writes into ajaxSettings.
|
6469 |
ajaxSetup: function( target, settings ) {
|
6470 |
return settings ?
|
|
|
6471 |
// Building a settings object
|
6472 |
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
|
|
6473 |
// Extending ajaxSettings
|
6474 |
ajaxExtend( jQuery.ajaxSettings, target );
|
6475 |
},
|
|
|
6476 |
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
6477 |
ajaxTransport: addToPrefiltersOrTransports( transports ),
|
|
|
6478 |
// Main method
|
6479 |
ajax: function( url, options ) {
|
|
|
6480 |
// If url is an object, simulate pre-1.5 signature
|
6481 |
if ( typeof url === "object" ) {
|
6482 |
options = url;
|
6483 |
url = undefined;
|
6484 |
}
|
|
|
6485 |
// Force options to be an object
|
6486 |
options = options || {};
|
|
|
6487 |
var // Cross-domain detection vars
|
6488 |
parts,
|
6489 |
// Loop variable
|
@@ -6494,8 +7741,10 @@ jQuery.extend({
|
|
6494 |
responseHeadersString,
|
6495 |
// timeout handle
|
6496 |
timeoutTimer,
|
|
|
6497 |
// To know if global events are to be dispatched
|
6498 |
fireGlobals,
|
|
|
6499 |
transport,
|
6500 |
// Response headers
|
6501 |
responseHeaders,
|
@@ -6522,6 +7771,7 @@ jQuery.extend({
|
|
6522 |
// Fake xhr
|
6523 |
jqXHR = {
|
6524 |
readyState: 0,
|
|
|
6525 |
// Builds headers hashtable if needed
|
6526 |
getResponseHeader: function( key ) {
|
6527 |
var match;
|
@@ -6536,10 +7786,12 @@ jQuery.extend({
|
|
6536 |
}
|
6537 |
return match == null ? null : match;
|
6538 |
},
|
|
|
6539 |
// Raw string
|
6540 |
getAllResponseHeaders: function() {
|
6541 |
return state === 2 ? responseHeadersString : null;
|
6542 |
},
|
|
|
6543 |
// Caches the header
|
6544 |
setRequestHeader: function( name, value ) {
|
6545 |
var lname = name.toLowerCase();
|
@@ -6549,6 +7801,7 @@ jQuery.extend({
|
|
6549 |
}
|
6550 |
return this;
|
6551 |
},
|
|
|
6552 |
// Overrides response content-type header
|
6553 |
overrideMimeType: function( type ) {
|
6554 |
if ( !state ) {
|
@@ -6556,6 +7809,7 @@ jQuery.extend({
|
|
6556 |
}
|
6557 |
return this;
|
6558 |
},
|
|
|
6559 |
// Status-dependent callbacks
|
6560 |
statusCode: function( map ) {
|
6561 |
var code;
|
@@ -6572,6 +7826,7 @@ jQuery.extend({
|
|
6572 |
}
|
6573 |
return this;
|
6574 |
},
|
|
|
6575 |
// Cancel the request
|
6576 |
abort: function( statusText ) {
|
6577 |
var finalText = statusText || strAbort;
|
@@ -6582,19 +7837,24 @@ jQuery.extend({
|
|
6582 |
return this;
|
6583 |
}
|
6584 |
};
|
|
|
6585 |
// Attach deferreds
|
6586 |
deferred.promise( jqXHR ).complete = completeDeferred.add;
|
6587 |
jqXHR.success = jqXHR.done;
|
6588 |
jqXHR.error = jqXHR.fail;
|
|
|
6589 |
// Remove hash character (#7531: and string promotion)
|
6590 |
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
|
6591 |
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
6592 |
// We also use the url parameter if available
|
6593 |
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
|
|
|
6594 |
// Alias method option to type as per ticket #12004
|
6595 |
s.type = options.method || options.type || s.method || s.type;
|
|
|
6596 |
// Extract dataTypes list
|
6597 |
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
|
|
|
6598 |
// A cross-domain request is in order when we have a protocol:host:port mismatch
|
6599 |
if ( s.crossDomain == null ) {
|
6600 |
parts = rurl.exec( s.url.toLowerCase() );
|
@@ -6604,46 +7864,60 @@ jQuery.extend({
|
|
6604 |
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
|
6605 |
);
|
6606 |
}
|
|
|
6607 |
// Convert data if not already a string
|
6608 |
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
6609 |
s.data = jQuery.param( s.data, s.traditional );
|
6610 |
}
|
|
|
6611 |
// Apply prefilters
|
6612 |
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
|
|
6613 |
// If request was aborted inside a prefilter, stop there
|
6614 |
if ( state === 2 ) {
|
6615 |
return jqXHR;
|
6616 |
}
|
|
|
6617 |
// We can fire global events as of now if asked to
|
6618 |
fireGlobals = s.global;
|
|
|
6619 |
// Watch for a new set of requests
|
6620 |
if ( fireGlobals && jQuery.active++ === 0 ) {
|
6621 |
jQuery.event.trigger("ajaxStart");
|
6622 |
}
|
|
|
6623 |
// Uppercase the type
|
6624 |
s.type = s.type.toUpperCase();
|
|
|
6625 |
// Determine if request has content
|
6626 |
s.hasContent = !rnoContent.test( s.type );
|
|
|
6627 |
// Save the URL in case we're toying with the If-Modified-Since
|
6628 |
// and/or If-None-Match header later on
|
6629 |
cacheURL = s.url;
|
|
|
6630 |
// More options handling for requests with no content
|
6631 |
if ( !s.hasContent ) {
|
|
|
6632 |
// If data is available, append data to url
|
6633 |
if ( s.data ) {
|
6634 |
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
|
6635 |
// #9682: remove data so that it's not used in an eventual retry
|
6636 |
delete s.data;
|
6637 |
}
|
|
|
6638 |
// Add anti-cache in url if needed
|
6639 |
if ( s.cache === false ) {
|
6640 |
s.url = rts.test( cacheURL ) ?
|
|
|
6641 |
// If there is already a '_' parameter, set its value
|
6642 |
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
|
|
|
6643 |
// Otherwise add one to the end
|
6644 |
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
|
6645 |
}
|
6646 |
}
|
|
|
6647 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
6648 |
if ( s.ifModified ) {
|
6649 |
if ( jQuery.lastModified[ cacheURL ] ) {
|
@@ -6653,10 +7927,12 @@ jQuery.extend({
|
|
6653 |
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
6654 |
}
|
6655 |
}
|
|
|
6656 |
// Set the correct header, if data is being sent
|
6657 |
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
6658 |
jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
6659 |
}
|
|
|
6660 |
// Set the Accepts header for the server, depending on the dataType
|
6661 |
jqXHR.setRequestHeader(
|
6662 |
"Accept",
|
@@ -6664,28 +7940,35 @@ jQuery.extend({
|
|
6664 |
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
6665 |
s.accepts[ "*" ]
|
6666 |
);
|
|
|
6667 |
// Check for headers option
|
6668 |
for ( i in s.headers ) {
|
6669 |
jqXHR.setRequestHeader( i, s.headers[ i ] );
|
6670 |
}
|
|
|
6671 |
// Allow custom headers/mimetypes and early abort
|
6672 |
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
|
6673 |
// Abort if not done already and return
|
6674 |
return jqXHR.abort();
|
6675 |
}
|
|
|
6676 |
// aborting is no longer a cancellation
|
6677 |
strAbort = "abort";
|
|
|
6678 |
// Install callbacks on deferreds
|
6679 |
for ( i in { success: 1, error: 1, complete: 1 } ) {
|
6680 |
jqXHR[ i ]( s[ i ] );
|
6681 |
}
|
|
|
6682 |
// Get transport
|
6683 |
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
|
|
6684 |
// If no transport, we auto-abort
|
6685 |
if ( !transport ) {
|
6686 |
done( -1, "No Transport" );
|
6687 |
} else {
|
6688 |
jqXHR.readyState = 1;
|
|
|
6689 |
// Send global event
|
6690 |
if ( fireGlobals ) {
|
6691 |
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
@@ -6696,6 +7979,7 @@ jQuery.extend({
|
|
6696 |
jqXHR.abort("timeout");
|
6697 |
}, s.timeout );
|
6698 |
}
|
|
|
6699 |
try {
|
6700 |
state = 1;
|
6701 |
transport.send( requestHeaders, done );
|
@@ -6709,33 +7993,43 @@ jQuery.extend({
|
|
6709 |
}
|
6710 |
}
|
6711 |
}
|
|
|
6712 |
// Callback for when everything is done
|
6713 |
function done( status, nativeStatusText, responses, headers ) {
|
6714 |
var isSuccess, success, error, response, modified,
|
6715 |
statusText = nativeStatusText;
|
|
|
6716 |
// Called once
|
6717 |
if ( state === 2 ) {
|
6718 |
return;
|
6719 |
}
|
|
|
6720 |
// State is "done" now
|
6721 |
state = 2;
|
|
|
6722 |
// Clear timeout if it exists
|
6723 |
if ( timeoutTimer ) {
|
6724 |
clearTimeout( timeoutTimer );
|
6725 |
}
|
|
|
6726 |
// Dereference transport for early garbage collection
|
6727 |
// (no matter how long the jqXHR object will be used)
|
6728 |
transport = undefined;
|
|
|
6729 |
// Cache response headers
|
6730 |
responseHeadersString = headers || "";
|
|
|
6731 |
// Set readyState
|
6732 |
jqXHR.readyState = status > 0 ? 4 : 0;
|
|
|
6733 |
// Get response data
|
6734 |
if ( responses ) {
|
6735 |
response = ajaxHandleResponses( s, jqXHR, responses );
|
6736 |
}
|
|
|
6737 |
// If successful, handle type chaining
|
6738 |
if ( status >= 200 && status < 300 || status === 304 ) {
|
|
|
6739 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
6740 |
if ( s.ifModified ) {
|
6741 |
modified = jqXHR.getResponseHeader("Last-Modified");
|
@@ -6747,14 +8041,17 @@ jQuery.extend({
|
|
6747 |
jQuery.etag[ cacheURL ] = modified;
|
6748 |
}
|
6749 |
}
|
|
|
6750 |
// if no content
|
6751 |
if ( status === 204 ) {
|
6752 |
isSuccess = true;
|
6753 |
statusText = "nocontent";
|
|
|
6754 |
// if not modified
|
6755 |
} else if ( status === 304 ) {
|
6756 |
isSuccess = true;
|
6757 |
statusText = "notmodified";
|
|
|
6758 |
// If we have data, let's convert it
|
6759 |
} else {
|
6760 |
isSuccess = ajaxConvert( s, response );
|
@@ -6774,24 +8071,30 @@ jQuery.extend({
|
|
6774 |
}
|
6775 |
}
|
6776 |
}
|
|
|
6777 |
// Set data for the fake xhr object
|
6778 |
jqXHR.status = status;
|
6779 |
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
|
|
6780 |
// Success/Error
|
6781 |
if ( isSuccess ) {
|
6782 |
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
6783 |
} else {
|
6784 |
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
6785 |
}
|
|
|
6786 |
// Status-dependent callbacks
|
6787 |
jqXHR.statusCode( statusCode );
|
6788 |
statusCode = undefined;
|
|
|
6789 |
if ( fireGlobals ) {
|
6790 |
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
6791 |
[ jqXHR, s, isSuccess ? success : error ] );
|
6792 |
}
|
|
|
6793 |
// Complete
|
6794 |
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
|
|
6795 |
if ( fireGlobals ) {
|
6796 |
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
6797 |
// Handle the global AJAX counter
|
@@ -6800,15 +8103,19 @@ jQuery.extend({
|
|
6800 |
}
|
6801 |
}
|
6802 |
}
|
|
|
6803 |
return jqXHR;
|
6804 |
},
|
|
|
6805 |
getScript: function( url, callback ) {
|
6806 |
return jQuery.get( url, undefined, callback, "script" );
|
6807 |
},
|
|
|
6808 |
getJSON: function( url, data, callback ) {
|
6809 |
return jQuery.get( url, data, callback, "json" );
|
6810 |
}
|
6811 |
});
|
|
|
6812 |
/* Handles responses to an ajax request:
|
6813 |
* - sets all responseXXX fields accordingly
|
6814 |
* - finds the right dataType (mediates between content-type and expected dataType)
|
@@ -6819,12 +8126,14 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
|
|
6819 |
contents = s.contents,
|
6820 |
dataTypes = s.dataTypes,
|
6821 |
responseFields = s.responseFields;
|
|
|
6822 |
// Fill responseXXX fields
|
6823 |
for ( type in responseFields ) {
|
6824 |
if ( type in responses ) {
|
6825 |
jqXHR[ responseFields[type] ] = responses[ type ];
|
6826 |
}
|
6827 |
}
|
|
|
6828 |
// Remove auto dataType and get content-type in the process
|
6829 |
while( dataTypes[ 0 ] === "*" ) {
|
6830 |
dataTypes.shift();
|
@@ -6832,6 +8141,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
|
|
6832 |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
|
6833 |
}
|
6834 |
}
|
|
|
6835 |
// Check if we're dealing with a known content-type
|
6836 |
if ( ct ) {
|
6837 |
for ( type in contents ) {
|
@@ -6841,6 +8151,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
|
|
6841 |
}
|
6842 |
}
|
6843 |
}
|
|
|
6844 |
// Check to see if we have a response for the expected dataType
|
6845 |
if ( dataTypes[ 0 ] in responses ) {
|
6846 |
finalDataType = dataTypes[ 0 ];
|
@@ -6858,6 +8169,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
|
|
6858 |
// Or just use first one
|
6859 |
finalDataType = finalDataType || firstDataType;
|
6860 |
}
|
|
|
6861 |
// If we found a dataType
|
6862 |
// We add the dataType to the list if needed
|
6863 |
// and return the corresponding response
|
@@ -6868,6 +8180,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
|
|
6868 |
return responses[ finalDataType ];
|
6869 |
}
|
6870 |
}
|
|
|
6871 |
// Chain conversions given the request and the original response
|
6872 |
function ajaxConvert( s, response ) {
|
6873 |
var conv2, current, conv, tmp,
|
@@ -6876,30 +8189,39 @@ function ajaxConvert( s, response ) {
|
|
6876 |
// Work with a copy of dataTypes in case we need to modify it for conversion
|
6877 |
dataTypes = s.dataTypes.slice(),
|
6878 |
prev = dataTypes[ 0 ];
|
|
|
6879 |
// Apply the dataFilter if provided
|
6880 |
if ( s.dataFilter ) {
|
6881 |
response = s.dataFilter( response, s.dataType );
|
6882 |
}
|
|
|
6883 |
// Create converters map with lowercased keys
|
6884 |
if ( dataTypes[ 1 ] ) {
|
6885 |
for ( conv in s.converters ) {
|
6886 |
converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
6887 |
}
|
6888 |
}
|
|
|
6889 |
// Convert to each sequential dataType, tolerating list modification
|
6890 |
for ( ; (current = dataTypes[++i]); ) {
|
|
|
6891 |
// There's only work to do if current dataType is non-auto
|
6892 |
if ( current !== "*" ) {
|
|
|
6893 |
// Convert response if prev dataType is non-auto and differs from current
|
6894 |
if ( prev !== "*" && prev !== current ) {
|
|
|
6895 |
// Seek a direct converter
|
6896 |
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
|
|
6897 |
// If none found, seek a pair
|
6898 |
if ( !conv ) {
|
6899 |
for ( conv2 in converters ) {
|
|
|
6900 |
// If conv2 outputs current
|
6901 |
tmp = conv2.split(" ");
|
6902 |
if ( tmp[ 1 ] === current ) {
|
|
|
6903 |
// If prev can be converted to accepted input
|
6904 |
conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
6905 |
converters[ "* " + tmp[ 0 ] ];
|
@@ -6907,18 +8229,22 @@ function ajaxConvert( s, response ) {
|
|
6907 |
// Condense equivalence converters
|
6908 |
if ( conv === true ) {
|
6909 |
conv = converters[ conv2 ];
|
|
|
6910 |
// Otherwise, insert the intermediate dataType
|
6911 |
} else if ( converters[ conv2 ] !== true ) {
|
6912 |
current = tmp[ 0 ];
|
6913 |
dataTypes.splice( i--, 0, current );
|
6914 |
}
|
|
|
6915 |
break;
|
6916 |
}
|
6917 |
}
|
6918 |
}
|
6919 |
}
|
|
|
6920 |
// Apply converter (if not an equivalence)
|
6921 |
if ( conv !== true ) {
|
|
|
6922 |
// Unless errors are allowed to bubble, catch and return them
|
6923 |
if ( conv && s["throws"] ) {
|
6924 |
response = conv( response );
|
@@ -6931,10 +8257,12 @@ function ajaxConvert( s, response ) {
|
|
6931 |
}
|
6932 |
}
|
6933 |
}
|
|
|
6934 |
// Update prev for next iteration
|
6935 |
prev = current;
|
6936 |
}
|
6937 |
}
|
|
|
6938 |
return { state: "success", data: response };
|
6939 |
}
|
6940 |
// Install script dataType
|
@@ -6952,6 +8280,7 @@ jQuery.ajaxSetup({
|
|
6952 |
}
|
6953 |
}
|
6954 |
});
|
|
|
6955 |
// Handle cache's special case and global
|
6956 |
jQuery.ajaxPrefilter( "script", function( s ) {
|
6957 |
if ( s.cache === undefined ) {
|
@@ -6962,41 +8291,58 @@ jQuery.ajaxPrefilter( "script", function( s ) {
|
|
6962 |
s.global = false;
|
6963 |
}
|
6964 |
});
|
|
|
6965 |
// Bind script tag hack transport
|
6966 |
jQuery.ajaxTransport( "script", function(s) {
|
|
|
6967 |
// This transport only deals with cross domain requests
|
6968 |
if ( s.crossDomain ) {
|
|
|
6969 |
var script,
|
6970 |
head = document.head || jQuery("head")[0] || document.documentElement;
|
|
|
6971 |
return {
|
|
|
6972 |
send: function( _, callback ) {
|
|
|
6973 |
script = document.createElement("script");
|
|
|
6974 |
script.async = true;
|
|
|
6975 |
if ( s.scriptCharset ) {
|
6976 |
script.charset = s.scriptCharset;
|
6977 |
}
|
|
|
6978 |
script.src = s.url;
|
|
|
6979 |
// Attach handlers for all browsers
|
6980 |
script.onload = script.onreadystatechange = function( _, isAbort ) {
|
|
|
6981 |
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
|
|
|
6982 |
// Handle memory leak in IE
|
6983 |
script.onload = script.onreadystatechange = null;
|
|
|
6984 |
// Remove the script
|
6985 |
if ( script.parentNode ) {
|
6986 |
script.parentNode.removeChild( script );
|
6987 |
}
|
|
|
6988 |
// Dereference the script
|
6989 |
script = null;
|
|
|
6990 |
// Callback if not abort
|
6991 |
if ( !isAbort ) {
|
6992 |
callback( 200, "success" );
|
6993 |
}
|
6994 |
}
|
6995 |
};
|
|
|
6996 |
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
|
6997 |
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
6998 |
head.insertBefore( script, head.firstChild );
|
6999 |
},
|
|
|
7000 |
abort: function() {
|
7001 |
if ( script ) {
|
7002 |
script.onload( undefined, true );
|
@@ -7007,6 +8353,7 @@ jQuery.ajaxTransport( "script", function(s) {
|
|
7007 |
});
|
7008 |
var oldCallbacks = [],
|
7009 |
rjsonp = /(=)\?(?=&|$)|\?\?/;
|
|
|
7010 |
// Default jsonp settings
|
7011 |
jQuery.ajaxSetup({
|
7012 |
jsonp: "callback",
|
@@ -7016,25 +8363,31 @@ jQuery.ajaxSetup({
|
|
7016 |
return callback;
|
7017 |
}
|
7018 |
});
|
|
|
7019 |
// Detect, normalize options and install callbacks for jsonp requests
|
7020 |
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
|
|
7021 |
var callbackName, overwritten, responseContainer,
|
7022 |
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
7023 |
"url" :
|
7024 |
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
|
7025 |
);
|
|
|
7026 |
// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
7027 |
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
|
|
7028 |
// Get callback name, remembering preexisting value associated with it
|
7029 |
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
|
7030 |
s.jsonpCallback() :
|
7031 |
s.jsonpCallback;
|
|
|
7032 |
// Insert callback into url or form data
|
7033 |
if ( jsonProp ) {
|
7034 |
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
7035 |
} else if ( s.jsonp !== false ) {
|
7036 |
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
7037 |
}
|
|
|
7038 |
// Use data converter to retrieve json after script execution
|
7039 |
s.converters["script json"] = function() {
|
7040 |
if ( !responseContainer ) {
|
@@ -7042,30 +8395,38 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
|
7042 |
}
|
7043 |
return responseContainer[ 0 ];
|
7044 |
};
|
|
|
7045 |
// force json dataType
|
7046 |
s.dataTypes[ 0 ] = "json";
|
|
|
7047 |
// Install callback
|
7048 |
overwritten = window[ callbackName ];
|
7049 |
window[ callbackName ] = function() {
|
7050 |
responseContainer = arguments;
|
7051 |
};
|
|
|
7052 |
// Clean-up function (fires after converters)
|
7053 |
jqXHR.always(function() {
|
7054 |
// Restore preexisting value
|
7055 |
window[ callbackName ] = overwritten;
|
|
|
7056 |
// Save back as free
|
7057 |
if ( s[ callbackName ] ) {
|
7058 |
// make sure that re-using the options doesn't screw things around
|
7059 |
s.jsonpCallback = originalSettings.jsonpCallback;
|
|
|
7060 |
// save the callback name for future use
|
7061 |
oldCallbacks.push( callbackName );
|
7062 |
}
|
|
|
7063 |
// Call if it was a function and we have a response
|
7064 |
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
|
7065 |
overwritten( responseContainer[ 0 ] );
|
7066 |
}
|
|
|
7067 |
responseContainer = overwritten = undefined;
|
7068 |
});
|
|
|
7069 |
// Delegate to script
|
7070 |
return "script";
|
7071 |
}
|
@@ -7080,17 +8441,20 @@ var xhrCallbacks, xhrSupported,
|
|
7080 |
xhrCallbacks[ key ]( undefined, true );
|
7081 |
}
|
7082 |
};
|
|
|
7083 |
// Functions to create xhrs
|
7084 |
function createStandardXHR() {
|
7085 |
try {
|
7086 |
return new window.XMLHttpRequest();
|
7087 |
} catch( e ) {}
|
7088 |
}
|
|
|
7089 |
function createActiveXHR() {
|
7090 |
try {
|
7091 |
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
7092 |
} catch( e ) {}
|
7093 |
}
|
|
|
7094 |
// Create the request object
|
7095 |
// (This is still attached to ajaxSettings for backward compatibility)
|
7096 |
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
|
@@ -7105,21 +8469,28 @@ jQuery.ajaxSettings.xhr = window.ActiveXObject ?
|
|
7105 |
} :
|
7106 |
// For all other browsers, use the standard XMLHttpRequest object
|
7107 |
createStandardXHR;
|
|
|
7108 |
// Determine support properties
|
7109 |
xhrSupported = jQuery.ajaxSettings.xhr();
|
7110 |
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
7111 |
xhrSupported = jQuery.support.ajax = !!xhrSupported;
|
|
|
7112 |
// Create transport if the browser can provide an xhr
|
7113 |
if ( xhrSupported ) {
|
|
|
7114 |
jQuery.ajaxTransport(function( s ) {
|
7115 |
// Cross domain only allowed if supported through XMLHttpRequest
|
7116 |
if ( !s.crossDomain || jQuery.support.cors ) {
|
|
|
7117 |
var callback;
|
|
|
7118 |
return {
|
7119 |
send: function( headers, complete ) {
|
|
|
7120 |
// Get a new xhr
|
7121 |
var handle, i,
|
7122 |
xhr = s.xhr();
|
|
|
7123 |
// Open the socket
|
7124 |
// Passing null username, generates a login popup on Opera (#2865)
|
7125 |
if ( s.username ) {
|
@@ -7127,16 +8498,20 @@ if ( xhrSupported ) {
|
|
7127 |
} else {
|
7128 |
xhr.open( s.type, s.url, s.async );
|
7129 |
}
|
|
|
7130 |
// Apply custom fields if provided
|
7131 |
if ( s.xhrFields ) {
|
7132 |
for ( i in s.xhrFields ) {
|
7133 |
xhr[ i ] = s.xhrFields[ i ];
|
7134 |
}
|
7135 |
}
|
|
|
|
|
7136 |
// Override mime type if needed
|
7137 |
if ( s.mimeType && xhr.overrideMimeType ) {
|
7138 |
xhr.overrideMimeType( s.mimeType );
|
7139 |
}
|
|
|
7140 |
// X-Requested-With header
|
7141 |
// For cross-domain requests, seeing as conditions for a preflight are
|
7142 |
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
@@ -7145,27 +8520,34 @@ if ( xhrSupported ) {
|
|
7145 |
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
|
7146 |
headers["X-Requested-With"] = "XMLHttpRequest";
|
7147 |
}
|
|
|
7148 |
// Need an extra try/catch for cross domain requests in Firefox 3
|
7149 |
try {
|
7150 |
for ( i in headers ) {
|
7151 |
xhr.setRequestHeader( i, headers[ i ] );
|
7152 |
}
|
7153 |
} catch( err ) {}
|
|
|
7154 |
// Do send the request
|
7155 |
// This may raise an exception which is actually
|
7156 |
// handled in jQuery.ajax (so no try/catch here)
|
7157 |
xhr.send( ( s.hasContent && s.data ) || null );
|
|
|
7158 |
// Listener
|
7159 |
callback = function( _, isAbort ) {
|
7160 |
var status, responseHeaders, statusText, responses;
|
|
|
7161 |
// Firefox throws exceptions when accessing properties
|
7162 |
// of an xhr when a network error occurred
|
7163 |
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
|
7164 |
try {
|
|
|
7165 |
// Was never called and is aborted or complete
|
7166 |
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
|
|
7167 |
// Only called once
|
7168 |
callback = undefined;
|
|
|
7169 |
// Do not keep as active anymore
|
7170 |
if ( handle ) {
|
7171 |
xhr.onreadystatechange = jQuery.noop;
|
@@ -7173,6 +8555,7 @@ if ( xhrSupported ) {
|
|
7173 |
delete xhrCallbacks[ handle ];
|
7174 |
}
|
7175 |
}
|
|
|
7176 |
// If it's an abort
|
7177 |
if ( isAbort ) {
|
7178 |
// Abort it manually if needed
|
@@ -7183,11 +8566,13 @@ if ( xhrSupported ) {
|
|
7183 |
responses = {};
|
7184 |
status = xhr.status;
|
7185 |
responseHeaders = xhr.getAllResponseHeaders();
|
|
|
7186 |
// When requesting binary data, IE6-9 will throw an exception
|
7187 |
// on any attempt to access responseText (#11426)
|
7188 |
if ( typeof xhr.responseText === "string" ) {
|
7189 |
responses.text = xhr.responseText;
|
7190 |
}
|
|
|
7191 |
// Firefox throws an exception when accessing
|
7192 |
// statusText for faulty cross-domain requests
|
7193 |
try {
|
@@ -7196,7 +8581,9 @@ if ( xhrSupported ) {
|
|
7196 |
// We normalize with Webkit giving an empty statusText
|
7197 |
statusText = "";
|
7198 |
}
|
|
|
7199 |
// Filter status for non standard behaviors
|
|
|
7200 |
// If the request is local and we have data: assume a success
|
7201 |
// (success with no data won't get notified, that's the best we
|
7202 |
// can do given current implementations)
|
@@ -7213,11 +8600,13 @@ if ( xhrSupported ) {
|
|
7213 |
complete( -1, firefoxAccessException );
|
7214 |
}
|
7215 |
}
|
|
|
7216 |
// Call complete if needed
|
7217 |
if ( responses ) {
|
7218 |
complete( status, statusText, responses, responseHeaders );
|
7219 |
}
|
7220 |
};
|
|
|
7221 |
if ( !s.async ) {
|
7222 |
// if we're in sync mode we fire the callback
|
7223 |
callback();
|
@@ -7240,6 +8629,7 @@ if ( xhrSupported ) {
|
|
7240 |
xhr.onreadystatechange = callback;
|
7241 |
}
|
7242 |
},
|
|
|
7243 |
abort: function() {
|
7244 |
if ( callback ) {
|
7245 |
callback( undefined, true );
|
@@ -7263,26 +8653,32 @@ var fxNow, timerId,
|
|
7263 |
start = +target || 0,
|
7264 |
scale = 1,
|
7265 |
maxIterations = 20;
|
|
|
7266 |
if ( parts ) {
|
7267 |
end = +parts[2];
|
7268 |
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
|
|
|
7269 |
// We need to compute starting value
|
7270 |
if ( unit !== "px" && start ) {
|
7271 |
// Iteratively approximate from a nonzero starting point
|
7272 |
// Prefer the current property, because this process will be trivial if it uses the same units
|
7273 |
// Fallback to end or a simple constant
|
7274 |
start = jQuery.css( tween.elem, prop, true ) || end || 1;
|
|
|
7275 |
do {
|
7276 |
// If previous iteration zeroed out, double until we get *something*
|
7277 |
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
|
7278 |
scale = scale || ".5";
|
|
|
7279 |
// Adjust and apply
|
7280 |
start = start / scale;
|
7281 |
jQuery.style( tween.elem, prop, start + unit );
|
|
|
7282 |
// Update scale, tolerating zero or NaN from tween.cur()
|
7283 |
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
|
7284 |
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
|
7285 |
}
|
|
|
7286 |
tween.unit = unit;
|
7287 |
tween.start = start;
|
7288 |
// If a +=/-= token was provided, we're doing a relative animation
|
@@ -7291,6 +8687,7 @@ var fxNow, timerId,
|
|
7291 |
return tween;
|
7292 |
}]
|
7293 |
};
|
|
|
7294 |
// Animations created synchronously will run synchronously
|
7295 |
function createFxNow() {
|
7296 |
setTimeout(function() {
|
@@ -7298,6 +8695,7 @@ function createFxNow() {
|
|
7298 |
});
|
7299 |
return ( fxNow = jQuery.now() );
|
7300 |
}
|
|
|
7301 |
function createTweens( animation, props ) {
|
7302 |
jQuery.each( props, function( prop, value ) {
|
7303 |
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
|
@@ -7305,12 +8703,14 @@ function createTweens( animation, props ) {
|
|
7305 |
length = collection.length;
|
7306 |
for ( ; index < length; index++ ) {
|
7307 |
if ( collection[ index ].call( animation, prop, value ) ) {
|
|
|
7308 |
// we're done with this property
|
7309 |
return;
|
7310 |
}
|
7311 |
}
|
7312 |
});
|
7313 |
}
|
|
|
7314 |
function Animation( elem, properties, options ) {
|
7315 |
var result,
|
7316 |
stopped,
|
@@ -7331,10 +8731,13 @@ function Animation( elem, properties, options ) {
|
|
7331 |
percent = 1 - temp,
|
7332 |
index = 0,
|
7333 |
length = animation.tweens.length;
|
|
|
7334 |
for ( ; index < length ; index++ ) {
|
7335 |
animation.tweens[ index ].run( percent );
|
7336 |
}
|
|
|
7337 |
deferred.notifyWith( elem, [ animation, percent, remaining ]);
|
|
|
7338 |
if ( percent < 1 && length ) {
|
7339 |
return remaining;
|
7340 |
} else {
|
@@ -7369,6 +8772,7 @@ function Animation( elem, properties, options ) {
|
|
7369 |
for ( ; index < length ; index++ ) {
|
7370 |
animation.tweens[ index ].run( 1 );
|
7371 |
}
|
|
|
7372 |
// resolve when we played the last frame
|
7373 |
// otherwise, reject
|
7374 |
if ( gotoEnd ) {
|
@@ -7380,17 +8784,22 @@ function Animation( elem, properties, options ) {
|
|
7380 |
}
|
7381 |
}),
|
7382 |
props = animation.props;
|
|
|
7383 |
propFilter( props, animation.opts.specialEasing );
|
|
|
7384 |
for ( ; index < length ; index++ ) {
|
7385 |
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
|
7386 |
if ( result ) {
|
7387 |
return result;
|
7388 |
}
|
7389 |
}
|
|
|
7390 |
createTweens( animation, props );
|
|
|
7391 |
if ( jQuery.isFunction( animation.opts.start ) ) {
|
7392 |
animation.opts.start.call( elem, animation );
|
7393 |
}
|
|
|
7394 |
jQuery.fx.timer(
|
7395 |
jQuery.extend( tick, {
|
7396 |
elem: elem,
|
@@ -7398,14 +8807,17 @@ function Animation( elem, properties, options ) {
|
|
7398 |
queue: animation.opts.queue
|
7399 |
})
|
7400 |
);
|
|
|
7401 |
// attach callbacks from options
|
7402 |
return animation.progress( animation.opts.progress )
|
7403 |
.done( animation.opts.done, animation.opts.complete )
|
7404 |
.fail( animation.opts.fail )
|
7405 |
.always( animation.opts.always );
|
7406 |
}
|
|
|
7407 |
function propFilter( props, specialEasing ) {
|
7408 |
var value, name, index, easing, hooks;
|
|
|
7409 |
// camelCase, specialEasing and expand cssHook pass
|
7410 |
for ( index in props ) {
|
7411 |
name = jQuery.camelCase( index );
|
@@ -7415,14 +8827,17 @@ function propFilter( props, specialEasing ) {
|
|
7415 |
easing = value[ 1 ];
|
7416 |
value = props[ index ] = value[ 0 ];
|
7417 |
}
|
|
|
7418 |
if ( index !== name ) {
|
7419 |
props[ name ] = value;
|
7420 |
delete props[ index ];
|
7421 |
}
|
|
|
7422 |
hooks = jQuery.cssHooks[ name ];
|
7423 |
if ( hooks && "expand" in hooks ) {
|
7424 |
value = hooks.expand( value );
|
7425 |
delete props[ name ];
|
|
|
7426 |
// not quite $.extend, this wont overwrite keys already present.
|
7427 |
// also - reusing 'index' from above because we have the correct "name"
|
7428 |
for ( index in value ) {
|
@@ -7436,7 +8851,9 @@ function propFilter( props, specialEasing ) {
|
|
7436 |
}
|
7437 |
}
|
7438 |
}
|
|
|
7439 |
jQuery.Animation = jQuery.extend( Animation, {
|
|
|
7440 |
tweener: function( props, callback ) {
|
7441 |
if ( jQuery.isFunction( props ) ) {
|
7442 |
callback = props;
|
@@ -7444,15 +8861,18 @@ jQuery.Animation = jQuery.extend( Animation, {
|
|
7444 |
} else {
|
7445 |
props = props.split(" ");
|
7446 |
}
|
|
|
7447 |
var prop,
|
7448 |
index = 0,
|
7449 |
length = props.length;
|
|
|
7450 |
for ( ; index < length ; index++ ) {
|
7451 |
prop = props[ index ];
|
7452 |
tweeners[ prop ] = tweeners[ prop ] || [];
|
7453 |
tweeners[ prop ].unshift( callback );
|
7454 |
}
|
7455 |
},
|
|
|
7456 |
prefilter: function( callback, prepend ) {
|
7457 |
if ( prepend ) {
|
7458 |
animationPrefilters.unshift( callback );
|
@@ -7461,6 +8881,7 @@ jQuery.Animation = jQuery.extend( Animation, {
|
|
7461 |
}
|
7462 |
}
|
7463 |
});
|
|
|
7464 |
function defaultPrefilter( elem, props, opts ) {
|
7465 |
/*jshint validthis:true */
|
7466 |
var prop, index, length,
|
@@ -7471,6 +8892,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7471 |
orig = {},
|
7472 |
handled = [],
|
7473 |
hidden = elem.nodeType && isHidden( elem );
|
|
|
7474 |
// handle queue: false promises
|
7475 |
if ( !opts.queue ) {
|
7476 |
hooks = jQuery._queueHooks( elem, "fx" );
|
@@ -7484,6 +8906,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7484 |
};
|
7485 |
}
|
7486 |
hooks.unqueued++;
|
|
|
7487 |
anim.always(function() {
|
7488 |
// doing this makes sure that the complete handler will be called
|
7489 |
// before this completes
|
@@ -7495,6 +8918,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7495 |
});
|
7496 |
});
|
7497 |
}
|
|
|
7498 |
// height/width overflow pass
|
7499 |
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
|
7500 |
// Make sure that nothing sneaks out
|
@@ -7502,19 +8926,23 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7502 |
// change the overflow attribute when overflowX and
|
7503 |
// overflowY are set to the same value
|
7504 |
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
|
|
|
7505 |
// Set display property to inline-block for height/width
|
7506 |
// animations on inline elements that are having width/height animated
|
7507 |
if ( jQuery.css( elem, "display" ) === "inline" &&
|
7508 |
jQuery.css( elem, "float" ) === "none" ) {
|
|
|
7509 |
// inline-level elements accept inline-block;
|
7510 |
// block-level elements need to be inline with layout
|
7511 |
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
|
7512 |
style.display = "inline-block";
|
|
|
7513 |
} else {
|
7514 |
style.zoom = 1;
|
7515 |
}
|
7516 |
}
|
7517 |
}
|
|
|
7518 |
if ( opts.overflow ) {
|
7519 |
style.overflow = "hidden";
|
7520 |
if ( !jQuery.support.shrinkWrapBlocks ) {
|
@@ -7525,6 +8953,8 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7525 |
});
|
7526 |
}
|
7527 |
}
|
|
|
|
|
7528 |
// show/hide pass
|
7529 |
for ( index in props ) {
|
7530 |
value = props[ index ];
|
@@ -7537,12 +8967,14 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7537 |
handled.push( index );
|
7538 |
}
|
7539 |
}
|
|
|
7540 |
length = handled.length;
|
7541 |
if ( length ) {
|
7542 |
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
|
7543 |
if ( "hidden" in dataShow ) {
|
7544 |
hidden = dataShow.hidden;
|
7545 |
}
|
|
|
7546 |
// store state if its toggle - enables .stop().toggle() to "reverse"
|
7547 |
if ( toggle ) {
|
7548 |
dataShow.hidden = !hidden;
|
@@ -7565,6 +8997,7 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7565 |
prop = handled[ index ];
|
7566 |
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
|
7567 |
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
|
|
|
7568 |
if ( !( prop in dataShow ) ) {
|
7569 |
dataShow[ prop ] = tween.start;
|
7570 |
if ( hidden ) {
|
@@ -7575,10 +9008,12 @@ function defaultPrefilter( elem, props, opts ) {
|
|
7575 |
}
|
7576 |
}
|
7577 |
}
|
|
|
7578 |
function Tween( elem, options, prop, end, easing ) {
|
7579 |
return new Tween.prototype.init( elem, options, prop, end, easing );
|
7580 |
}
|
7581 |
jQuery.Tween = Tween;
|
|
|
7582 |
Tween.prototype = {
|
7583 |
constructor: Tween,
|
7584 |
init: function( elem, options, prop, end, easing, unit ) {
|
@@ -7592,6 +9027,7 @@ Tween.prototype = {
|
|
7592 |
},
|
7593 |
cur: function() {
|
7594 |
var hooks = Tween.propHooks[ this.prop ];
|
|
|
7595 |
return hooks && hooks.get ?
|
7596 |
hooks.get( this ) :
|
7597 |
Tween.propHooks._default.get( this );
|
@@ -7599,6 +9035,7 @@ Tween.prototype = {
|
|
7599 |
run: function( percent ) {
|
7600 |
var eased,
|
7601 |
hooks = Tween.propHooks[ this.prop ];
|
|
|
7602 |
if ( this.options.duration ) {
|
7603 |
this.pos = eased = jQuery.easing[ this.easing ](
|
7604 |
percent, this.options.duration * percent, 0, 1, this.options.duration
|
@@ -7607,9 +9044,11 @@ Tween.prototype = {
|
|
7607 |
this.pos = eased = percent;
|
7608 |
}
|
7609 |
this.now = ( this.end - this.start ) * eased + this.start;
|
|
|
7610 |
if ( this.options.step ) {
|
7611 |
this.options.step.call( this.elem, this.now, this );
|
7612 |
}
|
|
|
7613 |
if ( hooks && hooks.set ) {
|
7614 |
hooks.set( this );
|
7615 |
} else {
|
@@ -7618,15 +9057,19 @@ Tween.prototype = {
|
|
7618 |
return this;
|
7619 |
}
|
7620 |
};
|
|
|
7621 |
Tween.prototype.init.prototype = Tween.prototype;
|
|
|
7622 |
Tween.propHooks = {
|
7623 |
_default: {
|
7624 |
get: function( tween ) {
|
7625 |
var result;
|
|
|
7626 |
if ( tween.elem[ tween.prop ] != null &&
|
7627 |
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
7628 |
return tween.elem[ tween.prop ];
|
7629 |
}
|
|
|
7630 |
// passing an empty string as a 3rd parameter to .css will automatically
|
7631 |
// attempt a parseFloat and fallback to a string if the parse fails
|
7632 |
// so, simple values such as "10px" are parsed to Float.
|
@@ -7648,8 +9091,10 @@ Tween.propHooks = {
|
|
7648 |
}
|
7649 |
}
|
7650 |
};
|
|
|
7651 |
// Remove in 2.0 - this supports IE8's panic based approach
|
7652 |
// to setting things on disconnected nodes
|
|
|
7653 |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
7654 |
set: function( tween ) {
|
7655 |
if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
@@ -7657,6 +9102,7 @@ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
|
7657 |
}
|
7658 |
}
|
7659 |
};
|
|
|
7660 |
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
|
7661 |
var cssFn = jQuery.fn[ name ];
|
7662 |
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
@@ -7665,10 +9111,13 @@ jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
|
|
7665 |
this.animate( genFx( name, true ), speed, easing, callback );
|
7666 |
};
|
7667 |
});
|
|
|
7668 |
jQuery.fn.extend({
|
7669 |
fadeTo: function( speed, to, easing, callback ) {
|
|
|
7670 |
// show any hidden elements after setting opacity to 0
|
7671 |
return this.filter( isHidden ).css( "opacity", 0 ).show()
|
|
|
7672 |
// animate to the value specified
|
7673 |
.end().animate({ opacity: to }, speed, easing, callback );
|
7674 |
},
|
@@ -7687,6 +9136,7 @@ jQuery.fn.extend({
|
|
7687 |
}
|
7688 |
};
|
7689 |
doAnimation.finish = doAnimation;
|
|
|
7690 |
return empty || optall.queue === false ?
|
7691 |
this.each( doAnimation ) :
|
7692 |
this.queue( optall.queue, doAnimation );
|
@@ -7697,6 +9147,7 @@ jQuery.fn.extend({
|
|
7697 |
delete hooks.stop;
|
7698 |
stop( gotoEnd );
|
7699 |
};
|
|
|
7700 |
if ( typeof type !== "string" ) {
|
7701 |
gotoEnd = clearQueue;
|
7702 |
clearQueue = type;
|
@@ -7705,11 +9156,13 @@ jQuery.fn.extend({
|
|
7705 |
if ( clearQueue && type !== false ) {
|
7706 |
this.queue( type || "fx", [] );
|
7707 |
}
|
|
|
7708 |
return this.each(function() {
|
7709 |
var dequeue = true,
|
7710 |
index = type != null && type + "queueHooks",
|
7711 |
timers = jQuery.timers,
|
7712 |
data = jQuery._data( this );
|
|
|
7713 |
if ( index ) {
|
7714 |
if ( data[ index ] && data[ index ].stop ) {
|
7715 |
stopQueue( data[ index ] );
|
@@ -7721,6 +9174,7 @@ jQuery.fn.extend({
|
|
7721 |
}
|
7722 |
}
|
7723 |
}
|
|
|
7724 |
for ( index = timers.length; index--; ) {
|
7725 |
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
|
7726 |
timers[ index ].anim.stop( gotoEnd );
|
@@ -7728,6 +9182,7 @@ jQuery.fn.extend({
|
|
7728 |
timers.splice( index, 1 );
|
7729 |
}
|
7730 |
}
|
|
|
7731 |
// start the next in the queue if the last step wasn't forced
|
7732 |
// timers currently will call their complete callbacks, which will dequeue
|
7733 |
// but only if they were gotoEnd
|
@@ -7747,13 +9202,17 @@ jQuery.fn.extend({
|
|
7747 |
hooks = data[ type + "queueHooks" ],
|
7748 |
timers = jQuery.timers,
|
7749 |
length = queue ? queue.length : 0;
|
|
|
7750 |
// enable finishing flag on private data
|
7751 |
data.finish = true;
|
|
|
7752 |
// empty the queue first
|
7753 |
jQuery.queue( this, type, [] );
|
|
|
7754 |
if ( hooks && hooks.cur && hooks.cur.finish ) {
|
7755 |
hooks.cur.finish.call( this );
|
7756 |
}
|
|
|
7757 |
// look for any active animations, and finish them
|
7758 |
for ( index = timers.length; index--; ) {
|
7759 |
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
|
@@ -7761,22 +9220,26 @@ jQuery.fn.extend({
|
|
7761 |
timers.splice( index, 1 );
|
7762 |
}
|
7763 |
}
|
|
|
7764 |
// look for any animations in the old queue and finish them
|
7765 |
for ( index = 0; index < length; index++ ) {
|
7766 |
if ( queue[ index ] && queue[ index ].finish ) {
|
7767 |
queue[ index ].finish.call( this );
|
7768 |
}
|
7769 |
}
|
|
|
7770 |
// turn off finishing flag
|
7771 |
delete data.finish;
|
7772 |
});
|
7773 |
}
|
7774 |
});
|
|
|
7775 |
// Generate parameters to create a standard animation
|
7776 |
function genFx( type, includeWidth ) {
|
7777 |
var which,
|
7778 |
attrs = { height: type },
|
7779 |
i = 0;
|
|
|
7780 |
// if we include width, step value is 1 to do all cssExpand values,
|
7781 |
// if we don't include width, step value is 2 to skip over Left and Right
|
7782 |
includeWidth = includeWidth? 1 : 0;
|
@@ -7784,11 +9247,14 @@ function genFx( type, includeWidth ) {
|
|
7784 |
which = cssExpand[ i ];
|
7785 |
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
|
7786 |
}
|
|
|
7787 |
if ( includeWidth ) {
|
7788 |
attrs.opacity = attrs.width = type;
|
7789 |
}
|
|
|
7790 |
return attrs;
|
7791 |
}
|
|
|
7792 |
// Generate shortcuts for custom animations
|
7793 |
jQuery.each({
|
7794 |
slideDown: genFx("show"),
|
@@ -7802,6 +9268,7 @@ jQuery.each({
|
|
7802 |
return this.animate( props, speed, easing, callback );
|
7803 |
};
|
7804 |
});
|
|
|
7805 |
jQuery.speed = function( speed, easing, fn ) {
|
7806 |
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
|
7807 |
complete: fn || !fn && easing ||
|
@@ -7809,24 +9276,31 @@ jQuery.speed = function( speed, easing, fn ) {
|
|
7809 |
duration: speed,
|
7810 |
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
|
7811 |
};
|
|
|
7812 |
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
7813 |
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
|
|
|
7814 |
// normalize opt.queue - true/undefined/null -> "fx"
|
7815 |
if ( opt.queue == null || opt.queue === true ) {
|
7816 |
opt.queue = "fx";
|
7817 |
}
|
|
|
7818 |
// Queueing
|
7819 |
opt.old = opt.complete;
|
|
|
7820 |
opt.complete = function() {
|
7821 |
if ( jQuery.isFunction( opt.old ) ) {
|
7822 |
opt.old.call( this );
|
7823 |
}
|
|
|
7824 |
if ( opt.queue ) {
|
7825 |
jQuery.dequeue( this, opt.queue );
|
7826 |
}
|
7827 |
};
|
|
|
7828 |
return opt;
|
7829 |
};
|
|
|
7830 |
jQuery.easing = {
|
7831 |
linear: function( p ) {
|
7832 |
return p;
|
@@ -7835,13 +9309,16 @@ jQuery.easing = {
|
|
7835 |
return 0.5 - Math.cos( p*Math.PI ) / 2;
|
7836 |
}
|
7837 |
};
|
|
|
7838 |
jQuery.timers = [];
|
7839 |
jQuery.fx = Tween.prototype.init;
|
7840 |
jQuery.fx.tick = function() {
|
7841 |
var timer,
|
7842 |
timers = jQuery.timers,
|
7843 |
i = 0;
|
|
|
7844 |
fxNow = jQuery.now();
|
|
|
7845 |
for ( ; i < timers.length; i++ ) {
|
7846 |
timer = timers[ i ];
|
7847 |
// Checks the timer has not already been removed
|
@@ -7849,34 +9326,42 @@ jQuery.fx.tick = function() {
|
|
7849 |
timers.splice( i--, 1 );
|
7850 |
}
|
7851 |
}
|
|
|
7852 |
if ( !timers.length ) {
|
7853 |
jQuery.fx.stop();
|
7854 |
}
|
7855 |
fxNow = undefined;
|
7856 |
};
|
|
|
7857 |
jQuery.fx.timer = function( timer ) {
|
7858 |
if ( timer() && jQuery.timers.push( timer ) ) {
|
7859 |
jQuery.fx.start();
|
7860 |
}
|
7861 |
};
|
|
|
7862 |
jQuery.fx.interval = 13;
|
|
|
7863 |
jQuery.fx.start = function() {
|
7864 |
if ( !timerId ) {
|
7865 |
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
|
7866 |
}
|
7867 |
};
|
|
|
7868 |
jQuery.fx.stop = function() {
|
7869 |
clearInterval( timerId );
|
7870 |
timerId = null;
|
7871 |
};
|
|
|
7872 |
jQuery.fx.speeds = {
|
7873 |
slow: 600,
|
7874 |
fast: 200,
|
7875 |
// Default speed
|
7876 |
_default: 400
|
7877 |
};
|
|
|
7878 |
// Back Compat <1.8 extension point
|
7879 |
jQuery.fx.step = {};
|
|
|
7880 |
if ( jQuery.expr && jQuery.expr.filters ) {
|
7881 |
jQuery.expr.filters.animated = function( elem ) {
|
7882 |
return jQuery.grep(jQuery.timers, function( fn ) {
|
@@ -7892,18 +9377,23 @@ jQuery.fn.offset = function( options ) {
|
|
7892 |
jQuery.offset.setOffset( this, options, i );
|
7893 |
});
|
7894 |
}
|
|
|
7895 |
var docElem, win,
|
7896 |
box = { top: 0, left: 0 },
|
7897 |
elem = this[ 0 ],
|
7898 |
doc = elem && elem.ownerDocument;
|
|
|
7899 |
if ( !doc ) {
|
7900 |
return;
|
7901 |
}
|
|
|
7902 |
docElem = doc.documentElement;
|
|
|
7903 |
// Make sure it's not a disconnected DOM node
|
7904 |
if ( !jQuery.contains( docElem, elem ) ) {
|
7905 |
return box;
|
7906 |
}
|
|
|
7907 |
// If we don't have gBCR, just use 0,0 rather than error
|
7908 |
// BlackBerry 5, iOS 3 (original iPhone)
|
7909 |
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
|
@@ -7915,19 +9405,24 @@ jQuery.fn.offset = function( options ) {
|
|
7915 |
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
|
7916 |
};
|
7917 |
};
|
|
|
7918 |
jQuery.offset = {
|
|
|
7919 |
setOffset: function( elem, options, i ) {
|
7920 |
var position = jQuery.css( elem, "position" );
|
|
|
7921 |
// set position first, in-case top/left are set even on static elem
|
7922 |
if ( position === "static" ) {
|
7923 |
elem.style.position = "relative";
|
7924 |
}
|
|
|
7925 |
var curElem = jQuery( elem ),
|
7926 |
curOffset = curElem.offset(),
|
7927 |
curCSSTop = jQuery.css( elem, "top" ),
|
7928 |
curCSSLeft = jQuery.css( elem, "left" ),
|
7929 |
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
|
7930 |
props = {}, curPosition = {}, curTop, curLeft;
|
|
|
7931 |
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
|
7932 |
if ( calculatePosition ) {
|
7933 |
curPosition = curElem.position();
|
@@ -7937,15 +9432,18 @@ jQuery.offset = {
|
|
7937 |
curTop = parseFloat( curCSSTop ) || 0;
|
7938 |
curLeft = parseFloat( curCSSLeft ) || 0;
|
7939 |
}
|
|
|
7940 |
if ( jQuery.isFunction( options ) ) {
|
7941 |
options = options.call( elem, i, curOffset );
|
7942 |
}
|
|
|
7943 |
if ( options.top != null ) {
|
7944 |
props.top = ( options.top - curOffset.top ) + curTop;
|
7945 |
}
|
7946 |
if ( options.left != null ) {
|
7947 |
props.left = ( options.left - curOffset.left ) + curLeft;
|
7948 |
}
|
|
|
7949 |
if ( "using" in options ) {
|
7950 |
options.using.call( elem, props );
|
7951 |
} else {
|
@@ -7953,14 +9451,19 @@ jQuery.offset = {
|
|
7953 |
}
|
7954 |
}
|
7955 |
};
|
|
|
|
|
7956 |
jQuery.fn.extend({
|
|
|
7957 |
position: function() {
|
7958 |
if ( !this[ 0 ] ) {
|
7959 |
return;
|
7960 |
}
|
|
|
7961 |
var offsetParent, offset,
|
7962 |
parentOffset = { top: 0, left: 0 },
|
7963 |
elem = this[ 0 ];
|
|
|
7964 |
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
|
7965 |
if ( jQuery.css( elem, "position" ) === "fixed" ) {
|
7966 |
// we assume that getBoundingClientRect is available when computed position is fixed
|
@@ -7968,15 +9471,18 @@ jQuery.fn.extend({
|
|
7968 |
} else {
|
7969 |
// Get *real* offsetParent
|
7970 |
offsetParent = this.offsetParent();
|
|
|
7971 |
// Get correct offsets
|
7972 |
offset = this.offset();
|
7973 |
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
|
7974 |
parentOffset = offsetParent.offset();
|
7975 |
}
|
|
|
7976 |
// Add offsetParent borders
|
7977 |
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
|
7978 |
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
|
7979 |
}
|
|
|
7980 |
// Subtract parent offsets and element margins
|
7981 |
// note: when an element has margin: auto the offsetLeft and marginLeft
|
7982 |
// are the same in Safari causing offset.left to incorrectly be 0
|
@@ -7985,6 +9491,7 @@ jQuery.fn.extend({
|
|
7985 |
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
|
7986 |
};
|
7987 |
},
|
|
|
7988 |
offsetParent: function() {
|
7989 |
return this.map(function() {
|
7990 |
var offsetParent = this.offsetParent || document.documentElement;
|
@@ -7995,28 +9502,35 @@ jQuery.fn.extend({
|
|
7995 |
});
|
7996 |
}
|
7997 |
});
|
|
|
|
|
7998 |
// Create scrollLeft and scrollTop methods
|
7999 |
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
|
8000 |
var top = /Y/.test( prop );
|
|
|
8001 |
jQuery.fn[ method ] = function( val ) {
|
8002 |
return jQuery.access( this, function( elem, method, val ) {
|
8003 |
var win = getWindow( elem );
|
|
|
8004 |
if ( val === undefined ) {
|
8005 |
return win ? (prop in win) ? win[ prop ] :
|
8006 |
win.document.documentElement[ method ] :
|
8007 |
elem[ method ];
|
8008 |
}
|
|
|
8009 |
if ( win ) {
|
8010 |
win.scrollTo(
|
8011 |
!top ? val : jQuery( win ).scrollLeft(),
|
8012 |
top ? val : jQuery( win ).scrollTop()
|
8013 |
);
|
|
|
8014 |
} else {
|
8015 |
elem[ method ] = val;
|
8016 |
}
|
8017 |
}, method, val, arguments.length, null );
|
8018 |
};
|
8019 |
});
|
|
|
8020 |
function getWindow( elem ) {
|
8021 |
return jQuery.isWindow( elem ) ?
|
8022 |
elem :
|
@@ -8031,17 +9545,21 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
|
8031 |
jQuery.fn[ funcName ] = function( margin, value ) {
|
8032 |
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
8033 |
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
|
|
8034 |
return jQuery.access( this, function( elem, type, value ) {
|
8035 |
var doc;
|
|
|
8036 |
if ( jQuery.isWindow( elem ) ) {
|
8037 |
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
|
8038 |
// isn't a whole lot we can do. See pull request at this URL for discussion:
|
8039 |
// https://github.com/jquery/jquery/pull/764
|
8040 |
return elem.document.documentElement[ "client" + name ];
|
8041 |
}
|
|
|
8042 |
// Get document width or height
|
8043 |
if ( elem.nodeType === 9 ) {
|
8044 |
doc = elem.documentElement;
|
|
|
8045 |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
|
8046 |
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
|
8047 |
return Math.max(
|
@@ -8050,9 +9568,11 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
|
8050 |
doc[ "client" + name ]
|
8051 |
);
|
8052 |
}
|
|
|
8053 |
return value === undefined ?
|
8054 |
// Get width or height on the element, requesting but not forcing parseFloat
|
8055 |
jQuery.css( elem, type, extra ) :
|
|
|
8056 |
// Set width or height on the element
|
8057 |
jQuery.style( elem, type, value, extra );
|
8058 |
}, type, chainable ? margin : undefined, chainable, null );
|
@@ -8061,9 +9581,11 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
|
|
8061 |
});
|
8062 |
// Limit scope pollution from any deprecated API
|
8063 |
// (function() {
|
|
|
8064 |
// })();
|
8065 |
// Expose jQuery to the global object
|
8066 |
window.jQuery = window.$ = jQuery;
|
|
|
8067 |
// Expose jQuery as an AMD module, but only for AMD loaders that
|
8068 |
// understand the issues with loading multiple versions of jQuery
|
8069 |
// in a page that all might call define(). The loader will indicate
|
@@ -8079,4 +9601,5 @@ window.jQuery = window.$ = jQuery;
|
|
8079 |
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
8080 |
define( "jquery", [], function () { return jQuery; } );
|
8081 |
}
|
8082 |
-
|
|
12 |
* Date: 2013-2-4
|
13 |
*/
|
14 |
(function( window, undefined ) {
|
15 |
+
|
16 |
// Can't do this because several apps including ASP.NET trace
|
17 |
// the stack via arguments.caller.callee and Firefox dies if
|
18 |
// you try to trace through "use strict" call chains. (#13335)
|
21 |
var
|
22 |
// The deferred used on DOM ready
|
23 |
readyList,
|
24 |
+
|
25 |
// A central reference to the root jQuery(document)
|
26 |
rootjQuery,
|
27 |
+
|
28 |
// Support: IE<9
|
29 |
// For `typeof node.method` instead of `node.method !== undefined`
|
30 |
core_strundefined = typeof undefined,
|
31 |
+
|
32 |
// Use the correct document accordingly with window argument (sandbox)
|
33 |
document = window.document,
|
34 |
location = window.location,
|
35 |
+
|
36 |
// Map over jQuery in case of overwrite
|
37 |
_jQuery = window.jQuery,
|
38 |
+
|
39 |
// Map over the $ in case of overwrite
|
40 |
_$ = window.$,
|
41 |
+
|
42 |
// [[Class]] -> type pairs
|
43 |
class2type = {},
|
44 |
+
|
45 |
// List of deleted data cache ids, so we can reuse them
|
46 |
core_deletedIds = [],
|
47 |
+
|
48 |
core_version = "1.9.1",
|
49 |
+
|
50 |
// Save a reference to some core methods
|
51 |
core_concat = core_deletedIds.concat,
|
52 |
core_push = core_deletedIds.push,
|
55 |
core_toString = class2type.toString,
|
56 |
core_hasOwn = class2type.hasOwnProperty,
|
57 |
core_trim = core_version.trim,
|
58 |
+
|
59 |
// Define a local copy of jQuery
|
60 |
jQuery = function( selector, context ) {
|
61 |
// The jQuery object is actually just the init constructor 'enhanced'
|
62 |
return new jQuery.fn.init( selector, context, rootjQuery );
|
63 |
},
|
64 |
+
|
65 |
// Used for matching numbers
|
66 |
core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
|
67 |
+
|
68 |
// Used for splitting on whitespace
|
69 |
core_rnotwhite = /\S+/g,
|
70 |
+
|
71 |
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
|
72 |
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
73 |
+
|
74 |
// A simple way to check for HTML strings
|
75 |
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
|
76 |
// Strict HTML recognition (#11290: must start with <)
|
77 |
rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
|
78 |
+
|
79 |
// Match a standalone tag
|
80 |
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
|
81 |
+
|
82 |
// JSON RegExp
|
83 |
rvalidchars = /^[\],:{}\s]*$/,
|
84 |
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
|
85 |
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
|
86 |
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
|
87 |
+
|
88 |
// Matches dashed string for camelizing
|
89 |
rmsPrefix = /^-ms-/,
|
90 |
rdashAlpha = /-([\da-z])/gi,
|
91 |
+
|
92 |
// Used by jQuery.camelCase as callback to replace()
|
93 |
fcamelCase = function( all, letter ) {
|
94 |
return letter.toUpperCase();
|
95 |
},
|
96 |
+
|
97 |
// The ready event handler
|
98 |
completed = function( event ) {
|
99 |
+
|
100 |
// readyState === "complete" is good enough for us to call the dom ready in oldIE
|
101 |
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
|
102 |
detach();
|
108 |
if ( document.addEventListener ) {
|
109 |
document.removeEventListener( "DOMContentLoaded", completed, false );
|
110 |
window.removeEventListener( "load", completed, false );
|
111 |
+
|
112 |
} else {
|
113 |
document.detachEvent( "onreadystatechange", completed );
|
114 |
window.detachEvent( "onload", completed );
|
115 |
}
|
116 |
};
|
117 |
+
|
118 |
jQuery.fn = jQuery.prototype = {
|
119 |
// The current version of jQuery being used
|
120 |
jquery: core_version,
|
121 |
+
|
122 |
constructor: jQuery,
|
123 |
init: function( selector, context, rootjQuery ) {
|
124 |
var match, elem;
|
125 |
+
|
126 |
// HANDLE: $(""), $(null), $(undefined), $(false)
|
127 |
if ( !selector ) {
|
128 |
return this;
|
129 |
}
|
130 |
+
|
131 |
// Handle HTML strings
|
132 |
if ( typeof selector === "string" ) {
|
133 |
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
|
134 |
// Assume that strings that start and end with <> are HTML and skip the regex check
|
135 |
match = [ null, selector, null ];
|
136 |
+
|
137 |
} else {
|
138 |
match = rquickExpr.exec( selector );
|
139 |
}
|
140 |
+
|
141 |
// Match html or make sure no context is specified for #id
|
142 |
if ( match && (match[1] || !context) ) {
|
143 |
+
|
144 |
// HANDLE: $(html) -> $(array)
|
145 |
if ( match[1] ) {
|
146 |
context = context instanceof jQuery ? context[0] : context;
|
147 |
+
|
148 |
// scripts is true for back-compat
|
149 |
jQuery.merge( this, jQuery.parseHTML(
|
150 |
match[1],
|
151 |
context && context.nodeType ? context.ownerDocument || context : document,
|
152 |
true
|
153 |
) );
|
154 |
+
|
155 |
// HANDLE: $(html, props)
|
156 |
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
|
157 |
for ( match in context ) {
|
158 |
// Properties of context are called as methods if possible
|
159 |
if ( jQuery.isFunction( this[ match ] ) ) {
|
160 |
this[ match ]( context[ match ] );
|
161 |
+
|
162 |
// ...and otherwise set as attributes
|
163 |
} else {
|
164 |
this.attr( match, context[ match ] );
|
165 |
}
|
166 |
}
|
167 |
}
|
168 |
+
|
169 |
return this;
|
170 |
+
|
171 |
// HANDLE: $(#id)
|
172 |
} else {
|
173 |
elem = document.getElementById( match[2] );
|
174 |
+
|
175 |
// Check parentNode to catch when Blackberry 4.6 returns
|
176 |
// nodes that are no longer in the document #6963
|
177 |
if ( elem && elem.parentNode ) {
|
180 |
if ( elem.id !== match[2] ) {
|
181 |
return rootjQuery.find( selector );
|
182 |
}
|
183 |
+
|
184 |
// Otherwise, we inject the element directly into the jQuery object
|
185 |
this.length = 1;
|
186 |
this[0] = elem;
|
187 |
}
|
188 |
+
|
189 |
this.context = document;
|
190 |
this.selector = selector;
|
191 |
return this;
|
192 |
}
|
193 |
+
|
194 |
// HANDLE: $(expr, $(...))
|
195 |
} else if ( !context || context.jquery ) {
|
196 |
return ( context || rootjQuery ).find( selector );
|
197 |
+
|
198 |
// HANDLE: $(expr, context)
|
199 |
// (which is just equivalent to: $(context).find(expr)
|
200 |
} else {
|
201 |
return this.constructor( context ).find( selector );
|
202 |
}
|
203 |
+
|
204 |
// HANDLE: $(DOMElement)
|
205 |
} else if ( selector.nodeType ) {
|
206 |
this.context = this[0] = selector;
|
207 |
this.length = 1;
|
208 |
return this;
|
209 |
+
|
210 |
// HANDLE: $(function)
|
211 |
// Shortcut for document ready
|
212 |
} else if ( jQuery.isFunction( selector ) ) {
|
213 |
return rootjQuery.ready( selector );
|
214 |
}
|
215 |
+
|
216 |
if ( selector.selector !== undefined ) {
|
217 |
this.selector = selector.selector;
|
218 |
this.context = selector.context;
|
219 |
}
|
220 |
+
|
221 |
return jQuery.makeArray( selector, this );
|
222 |
},
|
223 |
+
|
224 |
// Start with an empty selector
|
225 |
selector: "",
|
226 |
+
|
227 |
// The default length of a jQuery object is 0
|
228 |
length: 0,
|
229 |
+
|
230 |
// The number of elements contained in the matched element set
|
231 |
size: function() {
|
232 |
return this.length;
|
233 |
},
|
234 |
+
|
235 |
toArray: function() {
|
236 |
return core_slice.call( this );
|
237 |
},
|
238 |
+
|
239 |
// Get the Nth element in the matched element set OR
|
240 |
// Get the whole matched element set as a clean array
|
241 |
get: function( num ) {
|
242 |
return num == null ?
|
243 |
+
|
244 |
// Return a 'clean' array
|
245 |
this.toArray() :
|
246 |
+
|
247 |
// Return just the object
|
248 |
( num < 0 ? this[ this.length + num ] : this[ num ] );
|
249 |
},
|
250 |
+
|
251 |
// Take an array of elements and push it onto the stack
|
252 |
// (returning the new matched element set)
|
253 |
pushStack: function( elems ) {
|
254 |
+
|
255 |
// Build a new jQuery matched element set
|
256 |
var ret = jQuery.merge( this.constructor(), elems );
|
257 |
+
|
258 |
// Add the old object onto the stack (as a reference)
|
259 |
ret.prevObject = this;
|
260 |
ret.context = this.context;
|
261 |
+
|
262 |
// Return the newly-formed element set
|
263 |
return ret;
|
264 |
},
|
265 |
+
|
266 |
// Execute a callback for every element in the matched set.
|
267 |
// (You can seed the arguments with an array of args, but this is
|
268 |
// only used internally.)
|
269 |
each: function( callback, args ) {
|
270 |
return jQuery.each( this, callback, args );
|
271 |
},
|
272 |
+
|
273 |
ready: function( fn ) {
|
274 |
// Add the callback
|
275 |
jQuery.ready.promise().done( fn );
|
276 |
+
|
277 |
return this;
|
278 |
},
|
279 |
+
|
280 |
slice: function() {
|
281 |
return this.pushStack( core_slice.apply( this, arguments ) );
|
282 |
},
|
283 |
+
|
284 |
first: function() {
|
285 |
return this.eq( 0 );
|
286 |
},
|
287 |
+
|
288 |
last: function() {
|
289 |
return this.eq( -1 );
|
290 |
},
|
291 |
+
|
292 |
eq: function( i ) {
|
293 |
var len = this.length,
|
294 |
j = +i + ( i < 0 ? len : 0 );
|
295 |
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
|
296 |
},
|
297 |
+
|
298 |
map: function( callback ) {
|
299 |
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
300 |
return callback.call( elem, i, elem );
|
301 |
}));
|
302 |
},
|
303 |
+
|
304 |
end: function() {
|
305 |
return this.prevObject || this.constructor(null);
|
306 |
},
|
307 |
+
|
308 |
// For internal use only.
|
309 |
// Behaves like an Array's method, not like a jQuery method.
|
310 |
push: core_push,
|
311 |
sort: [].sort,
|
312 |
splice: [].splice
|
313 |
};
|
314 |
+
|
315 |
// Give the init function the jQuery prototype for later instantiation
|
316 |
jQuery.fn.init.prototype = jQuery.fn;
|
317 |
+
|
318 |
jQuery.extend = jQuery.fn.extend = function() {
|
319 |
var src, copyIsArray, copy, name, options, clone,
|
320 |
target = arguments[0] || {},
|
321 |
i = 1,
|
322 |
length = arguments.length,
|
323 |
deep = false;
|
324 |
+
|
325 |
// Handle a deep copy situation
|
326 |
if ( typeof target === "boolean" ) {
|
327 |
deep = target;
|
329 |
// skip the boolean and the target
|
330 |
i = 2;
|
331 |
}
|
332 |
+
|
333 |
// Handle case when target is a string or something (possible in deep copy)
|
334 |
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
335 |
target = {};
|
336 |
}
|
337 |
+
|
338 |
// extend jQuery itself if only one argument is passed
|
339 |
if ( length === i ) {
|
340 |
target = this;
|
341 |
--i;
|
342 |
}
|
343 |
+
|
344 |
for ( ; i < length; i++ ) {
|
345 |
// Only deal with non-null/undefined values
|
346 |
if ( (options = arguments[ i ]) != null ) {
|
348 |
for ( name in options ) {
|
349 |
src = target[ name ];
|
350 |
copy = options[ name ];
|
351 |
+
|
352 |
// Prevent never-ending loop
|
353 |
if ( target === copy ) {
|
354 |
continue;
|
355 |
}
|
356 |
+
|
357 |
// Recurse if we're merging plain objects or arrays
|
358 |
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
359 |
if ( copyIsArray ) {
|
360 |
copyIsArray = false;
|
361 |
clone = src && jQuery.isArray(src) ? src : [];
|
362 |
+
|
363 |
} else {
|
364 |
clone = src && jQuery.isPlainObject(src) ? src : {};
|
365 |
}
|
366 |
+
|
367 |
// Never move original objects, clone them
|
368 |
target[ name ] = jQuery.extend( deep, clone, copy );
|
369 |
+
|
370 |
// Don't bring in undefined values
|
371 |
} else if ( copy !== undefined ) {
|
372 |
target[ name ] = copy;
|
374 |
}
|
375 |
}
|
376 |
}
|
377 |
+
|
378 |
// Return the modified object
|
379 |
return target;
|
380 |
};
|
381 |
+
|
382 |
jQuery.extend({
|
383 |
noConflict: function( deep ) {
|
384 |
if ( window.$ === jQuery ) {
|
385 |
window.$ = _$;
|
386 |
}
|
387 |
+
|
388 |
if ( deep && window.jQuery === jQuery ) {
|
389 |
window.jQuery = _jQuery;
|
390 |
}
|
391 |
+
|
392 |
return jQuery;
|
393 |
},
|
394 |
+
|
395 |
// Is the DOM ready to be used? Set to true once it occurs.
|
396 |
isReady: false,
|
397 |
+
|
398 |
// A counter to track how many items to wait for before
|
399 |
// the ready event fires. See #6781
|
400 |
readyWait: 1,
|
401 |
+
|
402 |
// Hold (or release) the ready event
|
403 |
holdReady: function( hold ) {
|
404 |
if ( hold ) {
|
407 |
jQuery.ready( true );
|
408 |
}
|
409 |
},
|
410 |
+
|
411 |
// Handle when the DOM is ready
|
412 |
ready: function( wait ) {
|
413 |
+
|
414 |
// Abort if there are pending holds or we're already ready
|
415 |
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
|
416 |
return;
|
417 |
}
|
418 |
+
|
419 |
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
|
420 |
if ( !document.body ) {
|
421 |
return setTimeout( jQuery.ready );
|
422 |
}
|
423 |
+
|
424 |
// Remember that the DOM is ready
|
425 |
jQuery.isReady = true;
|
426 |
+
|
427 |
// If a normal DOM Ready event fired, decrement, and wait if need be
|
428 |
if ( wait !== true && --jQuery.readyWait > 0 ) {
|
429 |
return;
|
430 |
}
|
431 |
+
|
432 |
// If there are functions bound, to execute
|
433 |
readyList.resolveWith( document, [ jQuery ] );
|
434 |
+
|
435 |
// Trigger any bound ready events
|
436 |
if ( jQuery.fn.trigger ) {
|
437 |
jQuery( document ).trigger("ready").off("ready");
|
438 |
}
|
439 |
},
|
440 |
+
|
441 |
// See test/unit/core.js for details concerning isFunction.
|
442 |
// Since version 1.3, DOM methods and functions like alert
|
443 |
// aren't supported. They return false on IE (#2968).
|
444 |
isFunction: function( obj ) {
|
445 |
return jQuery.type(obj) === "function";
|
446 |
},
|
447 |
+
|
448 |
isArray: Array.isArray || function( obj ) {
|
449 |
return jQuery.type(obj) === "array";
|
450 |
},
|
451 |
+
|
452 |
isWindow: function( obj ) {
|
453 |
return obj != null && obj == obj.window;
|
454 |
},
|
455 |
+
|
456 |
isNumeric: function( obj ) {
|
457 |
return !isNaN( parseFloat(obj) ) && isFinite( obj );
|
458 |
},
|
459 |
+
|
460 |
type: function( obj ) {
|
461 |
if ( obj == null ) {
|
462 |
return String( obj );
|
465 |
class2type[ core_toString.call(obj) ] || "object" :
|
466 |
typeof obj;
|
467 |
},
|
468 |
+
|
469 |
isPlainObject: function( obj ) {
|
470 |
// Must be an Object.
|
471 |
// Because of IE, we also have to check the presence of the constructor property.
|
473 |
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
|
474 |
return false;
|
475 |
}
|
476 |
+
|
477 |
try {
|
478 |
// Not own constructor property must be Object
|
479 |
if ( obj.constructor &&
|
485 |
// IE8,9 Will throw exceptions on certain host objects #9897
|
486 |
return false;
|
487 |
}
|
488 |
+
|
489 |
// Own properties are enumerated firstly, so to speed up,
|
490 |
// if last one is own, then all properties are own.
|
491 |
+
|
492 |
var key;
|
493 |
for ( key in obj ) {}
|
494 |
+
|
495 |
return key === undefined || core_hasOwn.call( obj, key );
|
496 |
},
|
497 |
+
|
498 |
isEmptyObject: function( obj ) {
|
499 |
var name;
|
500 |
for ( name in obj ) {
|
502 |
}
|
503 |
return true;
|
504 |
},
|
505 |
+
|
506 |
error: function( msg ) {
|
507 |
throw new Error( msg );
|
508 |
},
|
509 |
+
|
510 |
// data: string of html
|
511 |
// context (optional): If specified, the fragment will be created in this context, defaults to document
|
512 |
// keepScripts (optional): If true, will include scripts passed in the html string
|
519 |
context = false;
|
520 |
}
|
521 |
context = context || document;
|
522 |
+
|
523 |
var parsed = rsingleTag.exec( data ),
|
524 |
scripts = !keepScripts && [];
|
525 |
+
|
526 |
// Single tag
|
527 |
if ( parsed ) {
|
528 |
return [ context.createElement( parsed[1] ) ];
|
529 |
}
|
530 |
+
|
531 |
parsed = jQuery.buildFragment( [ data ], context, scripts );
|
532 |
if ( scripts ) {
|
533 |
jQuery( scripts ).remove();
|
534 |
}
|
535 |
return jQuery.merge( [], parsed.childNodes );
|
536 |
},
|
537 |
+
|
538 |
parseJSON: function( data ) {
|
539 |
// Attempt to parse using the native JSON parser first
|
540 |
if ( window.JSON && window.JSON.parse ) {
|
541 |
return window.JSON.parse( data );
|
542 |
}
|
543 |
+
|
544 |
if ( data === null ) {
|
545 |
return data;
|
546 |
}
|
547 |
+
|
548 |
if ( typeof data === "string" ) {
|
549 |
+
|
550 |
// Make sure leading/trailing whitespace is removed (IE can't handle it)
|
551 |
data = jQuery.trim( data );
|
552 |
+
|
553 |
if ( data ) {
|
554 |
// Make sure the incoming data is actual JSON
|
555 |
// Logic borrowed from http://json.org/json2.js
|
556 |
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
|
557 |
.replace( rvalidtokens, "]" )
|
558 |
.replace( rvalidbraces, "")) ) {
|
559 |
+
|
560 |
return ( new Function( "return " + data ) )();
|
561 |
}
|
562 |
}
|
563 |
}
|
564 |
+
|
565 |
jQuery.error( "Invalid JSON: " + data );
|
566 |
},
|
567 |
+
|
568 |
// Cross-browser xml parsing
|
569 |
parseXML: function( data ) {
|
570 |
var xml, tmp;
|
588 |
}
|
589 |
return xml;
|
590 |
},
|
591 |
+
|
592 |
noop: function() {},
|
593 |
+
|
594 |
// Evaluates a script in a global context
|
595 |
// Workarounds based on findings by Jim Driscoll
|
596 |
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
|
604 |
} )( data );
|
605 |
}
|
606 |
},
|
607 |
+
|
608 |
// Convert dashed to camelCase; used by the css and data modules
|
609 |
// Microsoft forgot to hump their vendor prefix (#9572)
|
610 |
camelCase: function( string ) {
|
611 |
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
612 |
},
|
613 |
+
|
614 |
nodeName: function( elem, name ) {
|
615 |
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
616 |
},
|
617 |
+
|
618 |
// args is for internal usage only
|
619 |
each: function( obj, callback, args ) {
|
620 |
var value,
|
621 |
i = 0,
|
622 |
length = obj.length,
|
623 |
isArray = isArraylike( obj );
|
624 |
+
|
625 |
if ( args ) {
|
626 |
if ( isArray ) {
|
627 |
for ( ; i < length; i++ ) {
|
628 |
value = callback.apply( obj[ i ], args );
|
629 |
+
|
630 |
if ( value === false ) {
|
631 |
break;
|
632 |
}
|
634 |
} else {
|
635 |
for ( i in obj ) {
|
636 |
value = callback.apply( obj[ i ], args );
|
637 |
+
|
638 |
if ( value === false ) {
|
639 |
break;
|
640 |
}
|
641 |
}
|
642 |
}
|
643 |
+
|
644 |
// A special, fast, case for the most common use of each
|
645 |
} else {
|
646 |
if ( isArray ) {
|
647 |
for ( ; i < length; i++ ) {
|
648 |
value = callback.call( obj[ i ], i, obj[ i ] );
|
649 |
+
|
650 |
if ( value === false ) {
|
651 |
break;
|
652 |
}
|
654 |
} else {
|
655 |
for ( i in obj ) {
|
656 |
value = callback.call( obj[ i ], i, obj[ i ] );
|
657 |
+
|
658 |
if ( value === false ) {
|
659 |
break;
|
660 |
}
|
661 |
}
|
662 |
}
|
663 |
}
|
664 |
+
|
665 |
return obj;
|
666 |
},
|
667 |
+
|
668 |
// Use native String.trim function wherever possible
|
669 |
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
|
670 |
function( text ) {
|
672 |
"" :
|
673 |
core_trim.call( text );
|
674 |
} :
|
675 |
+
|
676 |
// Otherwise use our own trimming functionality
|
677 |
function( text ) {
|
678 |
return text == null ?
|
679 |
"" :
|
680 |
( text + "" ).replace( rtrim, "" );
|
681 |
},
|
682 |
+
|
683 |
// results is for internal usage only
|
684 |
makeArray: function( arr, results ) {
|
685 |
var ret = results || [];
|
686 |
+
|
687 |
if ( arr != null ) {
|
688 |
if ( isArraylike( Object(arr) ) ) {
|
689 |
jQuery.merge( ret,
|
694 |
core_push.call( ret, arr );
|
695 |
}
|
696 |
}
|
697 |
+
|
698 |
return ret;
|
699 |
},
|
700 |
+
|
701 |
inArray: function( elem, arr, i ) {
|
702 |
var len;
|
703 |
+
|
704 |
if ( arr ) {
|
705 |
if ( core_indexOf ) {
|
706 |
return core_indexOf.call( arr, elem, i );
|
707 |
}
|
708 |
+
|
709 |
len = arr.length;
|
710 |
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
|
711 |
+
|
712 |
for ( ; i < len; i++ ) {
|
713 |
// Skip accessing in sparse arrays
|
714 |
if ( i in arr && arr[ i ] === elem ) {
|
716 |
}
|
717 |
}
|
718 |
}
|
719 |
+
|
720 |
return -1;
|
721 |
},
|
722 |
+
|
723 |
merge: function( first, second ) {
|
724 |
var l = second.length,
|
725 |
i = first.length,
|
726 |
j = 0;
|
727 |
+
|
728 |
if ( typeof l === "number" ) {
|
729 |
for ( ; j < l; j++ ) {
|
730 |
first[ i++ ] = second[ j ];
|
734 |
first[ i++ ] = second[ j++ ];
|
735 |
}
|
736 |
}
|
737 |
+
|
738 |
first.length = i;
|
739 |
+
|
740 |
return first;
|
741 |
},
|
742 |
+
|
743 |
grep: function( elems, callback, inv ) {
|
744 |
var retVal,
|
745 |
ret = [],
|
746 |
i = 0,
|
747 |
length = elems.length;
|
748 |
inv = !!inv;
|
749 |
+
|
750 |
// Go through the array, only saving the items
|
751 |
// that pass the validator function
|
752 |
for ( ; i < length; i++ ) {
|
755 |
ret.push( elems[ i ] );
|
756 |
}
|
757 |
}
|
758 |
+
|
759 |
return ret;
|
760 |
},
|
761 |
+
|
762 |
// arg is for internal usage only
|
763 |
map: function( elems, callback, arg ) {
|
764 |
var value,
|
766 |
length = elems.length,
|
767 |
isArray = isArraylike( elems ),
|
768 |
ret = [];
|
769 |
+
|
770 |
// Go through the array, translating each of the items to their
|
771 |
if ( isArray ) {
|
772 |
for ( ; i < length; i++ ) {
|
773 |
value = callback( elems[ i ], i, arg );
|
774 |
+
|
775 |
if ( value != null ) {
|
776 |
ret[ ret.length ] = value;
|
777 |
}
|
778 |
}
|
779 |
+
|
780 |
// Go through every key on the object,
|
781 |
} else {
|
782 |
for ( i in elems ) {
|
783 |
value = callback( elems[ i ], i, arg );
|
784 |
+
|
785 |
if ( value != null ) {
|
786 |
ret[ ret.length ] = value;
|
787 |
}
|
788 |
}
|
789 |
}
|
790 |
+
|
791 |
// Flatten any nested arrays
|
792 |
return core_concat.apply( [], ret );
|
793 |
},
|
794 |
+
|
795 |
// A global GUID counter for objects
|
796 |
guid: 1,
|
797 |
+
|
798 |
// Bind a function to a context, optionally partially applying any
|
799 |
// arguments.
|
800 |
proxy: function( fn, context ) {
|
801 |
var args, proxy, tmp;
|
802 |
+
|
803 |
if ( typeof context === "string" ) {
|
804 |
tmp = fn[ context ];
|
805 |
context = fn;
|
806 |
fn = tmp;
|
807 |
}
|
808 |
+
|
809 |
// Quick check to determine if target is callable, in the spec
|
810 |
// this throws a TypeError, but we will just return undefined.
|
811 |
if ( !jQuery.isFunction( fn ) ) {
|
812 |
return undefined;
|
813 |
}
|
814 |
+
|
815 |
// Simulated bind
|
816 |
args = core_slice.call( arguments, 2 );
|
817 |
proxy = function() {
|
818 |
return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
|
819 |
};
|
820 |
+
|
821 |
// Set the guid of unique handler to the same of original handler, so it can be removed
|
822 |
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
|
823 |
+
|
824 |
return proxy;
|
825 |
},
|
826 |
+
|
827 |
// Multifunctional method to get and set values of a collection
|
828 |
// The value/s can optionally be executed if it's a function
|
829 |
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
830 |
var i = 0,
|
831 |
length = elems.length,
|
832 |
bulk = key == null;
|
833 |
+
|
834 |
// Sets many values
|
835 |
if ( jQuery.type( key ) === "object" ) {
|
836 |
chainable = true;
|
837 |
for ( i in key ) {
|
838 |
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
|
839 |
}
|
840 |
+
|
841 |
// Sets one value
|
842 |
} else if ( value !== undefined ) {
|
843 |
chainable = true;
|
844 |
+
|
845 |
if ( !jQuery.isFunction( value ) ) {
|
846 |
raw = true;
|
847 |
}
|
848 |
+
|
849 |
if ( bulk ) {
|
850 |
// Bulk operations run against the entire set
|
851 |
if ( raw ) {
|
852 |
fn.call( elems, value );
|
853 |
fn = null;
|
854 |
+
|
855 |
// ...except when executing function values
|
856 |
} else {
|
857 |
bulk = fn;
|
860 |
};
|
861 |
}
|
862 |
}
|
863 |
+
|
864 |
if ( fn ) {
|
865 |
for ( ; i < length; i++ ) {
|
866 |
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
|
867 |
}
|
868 |
}
|
869 |
}
|
870 |
+
|
871 |
return chainable ?
|
872 |
elems :
|
873 |
+
|
874 |
// Gets
|
875 |
bulk ?
|
876 |
fn.call( elems ) :
|
877 |
length ? fn( elems[0], key ) : emptyGet;
|
878 |
},
|
879 |
+
|
880 |
now: function() {
|
881 |
return ( new Date() ).getTime();
|
882 |
}
|
883 |
});
|
884 |
+
|
885 |
jQuery.ready.promise = function( obj ) {
|
886 |
if ( !readyList ) {
|
887 |
+
|
888 |
readyList = jQuery.Deferred();
|
889 |
+
|
890 |
// Catch cases where $(document).ready() is called after the browser event has already occurred.
|
891 |
// we once tried to use readyState "interactive" here, but it caused issues like the one
|
892 |
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
|
893 |
if ( document.readyState === "complete" ) {
|
894 |
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
895 |
setTimeout( jQuery.ready );
|
896 |
+
|
897 |
// Standards-based browsers support DOMContentLoaded
|
898 |
} else if ( document.addEventListener ) {
|
899 |
// Use the handy event callback
|
900 |
document.addEventListener( "DOMContentLoaded", completed, false );
|
901 |
+
|
902 |
// A fallback to window.onload, that will always work
|
903 |
window.addEventListener( "load", completed, false );
|
904 |
+
|
905 |
// If IE event model is used
|
906 |
} else {
|
907 |
// Ensure firing before onload, maybe late but safe also for iframes
|
908 |
document.attachEvent( "onreadystatechange", completed );
|
909 |
+
|
910 |
// A fallback to window.onload, that will always work
|
911 |
window.attachEvent( "onload", completed );
|
912 |
+
|
913 |
// If IE and not a frame
|
914 |
// continually check to see if the document is ready
|
915 |
var top = false;
|
916 |
+
|
917 |
try {
|
918 |
top = window.frameElement == null && document.documentElement;
|
919 |
} catch(e) {}
|
920 |
+
|
921 |
if ( top && top.doScroll ) {
|
922 |
(function doScrollCheck() {
|
923 |
if ( !jQuery.isReady ) {
|
924 |
+
|
925 |
try {
|
926 |
// Use the trick by Diego Perini
|
927 |
// http://javascript.nwbox.com/IEContentLoaded/
|
929 |
} catch(e) {
|
930 |
return setTimeout( doScrollCheck, 50 );
|
931 |
}
|
932 |
+
|
933 |
// detach all dom ready events
|
934 |
detach();
|
935 |
+
|
936 |
// and execute any waiting functions
|
937 |
jQuery.ready();
|
938 |
}
|
942 |
}
|
943 |
return readyList.promise( obj );
|
944 |
};
|
945 |
+
|
946 |
// Populate the class2type map
|
947 |
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
|
948 |
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
949 |
});
|
950 |
+
|
951 |
function isArraylike( obj ) {
|
952 |
var length = obj.length,
|
953 |
type = jQuery.type( obj );
|
954 |
+
|
955 |
if ( jQuery.isWindow( obj ) ) {
|
956 |
return false;
|
957 |
}
|
958 |
+
|
959 |
if ( obj.nodeType === 1 && length ) {
|
960 |
return true;
|
961 |
}
|
962 |
+
|
963 |
return type === "array" || type !== "function" &&
|
964 |
( length === 0 ||
|
965 |
typeof length === "number" && length > 0 && ( length - 1 ) in obj );
|
966 |
}
|
967 |
+
|
968 |
// All jQuery objects should point back to these
|
969 |
rootjQuery = jQuery(document);
|
970 |
// String to Object options format cache
|
971 |
var optionsCache = {};
|
972 |
+
|
973 |
// Convert String-formatted options into Object-formatted ones and store in cache
|
974 |
function createOptions( options ) {
|
975 |
var object = optionsCache[ options ] = {};
|
978 |
});
|
979 |
return object;
|
980 |
}
|
981 |
+
|
982 |
/*
|
983 |
* Create a callback list using the following parameters:
|
984 |
*
|
1002 |
*
|
1003 |
*/
|
1004 |
jQuery.Callbacks = function( options ) {
|
1005 |
+
|
1006 |
// Convert options from String-formatted to Object-formatted if needed
|
1007 |
// (we check in cache first)
|
1008 |
options = typeof options === "string" ?
|
1009 |
( optionsCache[ options ] || createOptions( options ) ) :
|
1010 |
jQuery.extend( {}, options );
|
1011 |
+
|
1012 |
var // Flag to know if list is currently firing
|
1013 |
firing,
|
1014 |
// Last fire value (for non-forgettable lists)
|
1160 |
return !!fired;
|
1161 |
}
|
1162 |
};
|
1163 |
+
|
1164 |
return self;
|
1165 |
};
|
1166 |
jQuery.extend({
|
1167 |
+
|
1168 |
Deferred: function( func ) {
|
1169 |
var tuples = [
|
1170 |
// action, add listener, listener list, final state
|
1210 |
}
|
1211 |
},
|
1212 |
deferred = {};
|
1213 |
+
|
1214 |
// Keep pipe for back-compat
|
1215 |
promise.pipe = promise.then;
|
1216 |
+
|
1217 |
// Add list-specific methods
|
1218 |
jQuery.each( tuples, function( i, tuple ) {
|
1219 |
var list = tuple[ 2 ],
|
1220 |
stateString = tuple[ 3 ];
|
1221 |
+
|
1222 |
// promise[ done | fail | progress ] = list.add
|
1223 |
promise[ tuple[1] ] = list.add;
|
1224 |
+
|
1225 |
// Handle state
|
1226 |
if ( stateString ) {
|
1227 |
list.add(function() {
|
1228 |
// state = [ resolved | rejected ]
|
1229 |
state = stateString;
|
1230 |
+
|
1231 |
// [ reject_list | resolve_list ].disable; progress_list.lock
|
1232 |
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
|
1233 |
}
|
1234 |
+
|
1235 |
// deferred[ resolve | reject | notify ]
|
1236 |
deferred[ tuple[0] ] = function() {
|
1237 |
deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
|
1239 |
};
|
1240 |
deferred[ tuple[0] + "With" ] = list.fireWith;
|
1241 |
});
|
1242 |
+
|
1243 |
// Make the deferred a promise
|
1244 |
promise.promise( deferred );
|
1245 |
+
|
1246 |
// Call given func if any
|
1247 |
if ( func ) {
|
1248 |
func.call( deferred, deferred );
|
1249 |
}
|
1250 |
+
|
1251 |
// All done!
|
1252 |
return deferred;
|
1253 |
},
|
1254 |
+
|
1255 |
// Deferred helper
|
1256 |
when: function( subordinate /* , ..., subordinateN */ ) {
|
1257 |
var i = 0,
|
1258 |
resolveValues = core_slice.call( arguments ),
|
1259 |
length = resolveValues.length,
|
1260 |
+
|
1261 |
// the count of uncompleted subordinates
|
1262 |
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
|
1263 |
+
|
1264 |
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
|
1265 |
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
|
1266 |
+
|
1267 |
// Update function for both resolve and progress values
|
1268 |
updateFunc = function( i, contexts, values ) {
|
1269 |
return function( value ) {
|
1276 |
}
|
1277 |
};
|
1278 |
},
|
1279 |
+
|
1280 |
progressValues, progressContexts, resolveContexts;
|
1281 |
+
|
1282 |
// add listeners to Deferred subordinates; treat others as resolved
|
1283 |
if ( length > 1 ) {
|
1284 |
progressValues = new Array( length );
|
1295 |
}
|
1296 |
}
|
1297 |
}
|
1298 |
+
|
1299 |
// if we're not waiting on anything, resolve the master
|
1300 |
if ( !remaining ) {
|
1301 |
deferred.resolveWith( resolveContexts, resolveValues );
|
1302 |
}
|
1303 |
+
|
1304 |
return deferred.promise();
|
1305 |
}
|
1306 |
});
|
1307 |
jQuery.support = (function() {
|
1308 |
+
|
1309 |
var support, all, a,
|
1310 |
input, select, fragment,
|
1311 |
opt, eventName, isSupported, i,
|
1312 |
div = document.createElement("div");
|
1313 |
+
|
1314 |
// Setup
|
1315 |
div.setAttribute( "className", "t" );
|
1316 |
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
|
1317 |
+
|
1318 |
// Support tests won't run in some limited or non-browser environments
|
1319 |
all = div.getElementsByTagName("*");
|
1320 |
a = div.getElementsByTagName("a")[ 0 ];
|
1321 |
if ( !all || !a || !all.length ) {
|
1322 |
return {};
|
1323 |
}
|
1324 |
+
|
1325 |
// First batch of tests
|
1326 |
select = document.createElement("select");
|
1327 |
opt = select.appendChild( document.createElement("option") );
|
1328 |
input = div.getElementsByTagName("input")[ 0 ];
|
1329 |
+
|
1330 |
a.style.cssText = "top:1px;float:left;opacity:.5";
|
1331 |
support = {
|
1332 |
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
|
1333 |
getSetAttribute: div.className !== "t",
|
1334 |
+
|
1335 |
// IE strips leading whitespace when .innerHTML is used
|
1336 |
leadingWhitespace: div.firstChild.nodeType === 3,
|
1337 |
+
|
1338 |
// Make sure that tbody elements aren't automatically inserted
|
1339 |
// IE will insert them into empty tables
|
1340 |
tbody: !div.getElementsByTagName("tbody").length,
|
1341 |
+
|
1342 |
// Make sure that link elements get serialized correctly by innerHTML
|
1343 |
// This requires a wrapper element in IE
|
1344 |
htmlSerialize: !!div.getElementsByTagName("link").length,
|
1345 |
+
|
1346 |
// Get the style information from getAttribute
|
1347 |
// (IE uses .cssText instead)
|
1348 |
style: /top/.test( a.getAttribute("style") ),
|
1349 |
+
|
1350 |
// Make sure that URLs aren't manipulated
|
1351 |
// (IE normalizes it by default)
|
1352 |
hrefNormalized: a.getAttribute("href") === "/a",
|
1353 |
+
|
1354 |
// Make sure that element opacity exists
|
1355 |
// (IE uses filter instead)
|
1356 |
// Use a regex to work around a WebKit issue. See #5145
|
1357 |
opacity: /^0.5/.test( a.style.opacity ),
|
1358 |
+
|
1359 |
// Verify style float existence
|
1360 |
// (IE uses styleFloat instead of cssFloat)
|
1361 |
+
|
1362 |
+
|
1363 |
cssFloat: !!a.style.cssFloat,
|
1364 |
+
|
1365 |
// Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
|
1366 |
checkOn: !!input.value,
|
1367 |
+
|
1368 |
// Make sure that a selected-by-default option has a working selected property.
|
1369 |
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
|
1370 |
optSelected: opt.selected,
|
1371 |
+
|
1372 |
// Tests for enctype support on a form (#6743)
|
1373 |
enctype: !!document.createElement("form").enctype,
|
1374 |
+
|
1375 |
// Makes sure cloning an html5 element does not cause problems
|
1376 |
// Where outerHTML is undefined, this still works
|
1377 |
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
|
1378 |
+
|
1379 |
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
|
1380 |
boxModel: document.compatMode === "CSS1Compat",
|
1381 |
+
|
1382 |
// Will be defined later
|
1383 |
deleteExpando: true,
|
1384 |
noCloneEvent: true,
|
1388 |
boxSizingReliable: true,
|
1389 |
pixelPosition: false
|
1390 |
};
|
1391 |
+
|
1392 |
// Make sure checked status is properly cloned
|
1393 |
input.checked = true;
|
1394 |
support.noCloneChecked = input.cloneNode( true ).checked;
|
1395 |
+
|
1396 |
// Make sure that the options inside disabled selects aren't marked as disabled
|
1397 |
// (WebKit marks them as disabled)
|
1398 |
select.disabled = true;
|
1399 |
support.optDisabled = !opt.disabled;
|
1400 |
+
|
1401 |
// Support: IE<9
|
1402 |
try {
|
1403 |
delete div.test;
|
1404 |
} catch( e ) {
|
1405 |
support.deleteExpando = false;
|
1406 |
}
|
1407 |
+
|
1408 |
// Check if we can trust getAttribute("value")
|
1409 |
input = document.createElement("input");
|
1410 |
input.setAttribute( "value", "" );
|
1411 |
support.input = input.getAttribute( "value" ) === "";
|
1412 |
+
|
1413 |
// Check if an input maintains its value after becoming a radio
|
1414 |
input.value = "t";
|
1415 |
input.setAttribute( "type", "radio" );
|
1416 |
support.radioValue = input.value === "t";
|
1417 |
+
|
1418 |
// #11217 - WebKit loses check when the name is after the checked attribute
|
1419 |
input.setAttribute( "checked", "t" );
|
1420 |
input.setAttribute( "name", "t" );
|
1421 |
+
|
1422 |
fragment = document.createDocumentFragment();
|
1423 |
fragment.appendChild( input );
|
1424 |
+
|
1425 |
// Check if a disconnected checkbox will retain its checked
|
1426 |
// value of true after appended to the DOM (IE6/7)
|
1427 |
support.appendChecked = input.checked;
|
1428 |
+
|
1429 |
// WebKit doesn't clone checked state correctly in fragments
|
1430 |
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
1431 |
+
|
1432 |
// Support: IE<9
|
1433 |
// Opera does not clone events (and typeof div.attachEvent === undefined).
|
1434 |
// IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
|
1436 |
div.attachEvent( "onclick", function() {
|
1437 |
support.noCloneEvent = false;
|
1438 |
});
|
1439 |
+
|
1440 |
div.cloneNode( true ).click();
|
1441 |
}
|
1442 |
+
|
1443 |
// Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
|
1444 |
// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
|
1445 |
for ( i in { submit: true, change: true, focusin: true }) {
|
1446 |
div.setAttribute( eventName = "on" + i, "t" );
|
1447 |
+
|
1448 |
support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
|
1449 |
}
|
1450 |
+
|
1451 |
div.style.backgroundClip = "content-box";
|
1452 |
div.cloneNode( true ).style.backgroundClip = "";
|
1453 |
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
1454 |
+
|
1455 |
// Run tests that need a body at doc ready
|
1456 |
jQuery(function() {
|
1457 |
var container, marginDiv, tds,
|
1458 |
divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
|
1459 |
body = document.getElementsByTagName("body")[0];
|
1460 |
+
|
1461 |
if ( !body ) {
|
1462 |
// Return for frameset docs that don't have a body
|
1463 |
return;
|
1464 |
}
|
1465 |
+
|
1466 |
container = document.createElement("div");
|
1467 |
container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
|
1468 |
+
|
1469 |
body.appendChild( container ).appendChild( div );
|
1470 |
+
|
1471 |
// Support: IE8
|
1472 |
// Check if table cells still have offsetWidth/Height when they are set
|
1473 |
// to display:none and there are still other visible table cells in a
|
1479 |
tds = div.getElementsByTagName("td");
|
1480 |
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
|
1481 |
isSupported = ( tds[ 0 ].offsetHeight === 0 );
|
1482 |
+
|
1483 |
tds[ 0 ].style.display = "";
|
1484 |
tds[ 1 ].style.display = "none";
|
1485 |
+
|
1486 |
// Support: IE8
|
1487 |
// Check if empty table cells still have offsetWidth/Height
|
1488 |
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
|
1489 |
+
|
1490 |
// Check box-sizing and margin behavior
|
1491 |
div.innerHTML = "";
|
1492 |
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
|
1493 |
support.boxSizing = ( div.offsetWidth === 4 );
|
1494 |
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
|
1495 |
+
|
1496 |
// Use window.getComputedStyle because jsdom on node.js will break without it.
|
1497 |
if ( window.getComputedStyle ) {
|
1498 |
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
|
1499 |
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
|
1500 |
+
|
1501 |
// Check if div with explicit width and no margin-right incorrectly
|
1502 |
// gets computed margin-right based on width of container. (#3333)
|
1503 |
// Fails in WebKit before Feb 2011 nightlies
|
1506 |
marginDiv.style.cssText = div.style.cssText = divReset;
|
1507 |
marginDiv.style.marginRight = marginDiv.style.width = "0";
|
1508 |
div.style.width = "1px";
|
1509 |
+
|
1510 |
support.reliableMarginRight =
|
1511 |
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
|
1512 |
}
|
1513 |
+
|
1514 |
if ( typeof div.style.zoom !== core_strundefined ) {
|
1515 |
// Support: IE<8
|
1516 |
// Check if natively block-level elements act like inline-block
|
1519 |
div.innerHTML = "";
|
1520 |
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
|
1521 |
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
|
1522 |
+
|
1523 |
// Support: IE6
|
1524 |
// Check if elements with layout shrink-wrap their children
|
1525 |
div.style.display = "block";
|
1526 |
div.innerHTML = "<div></div>";
|
1527 |
div.firstChild.style.width = "5px";
|
1528 |
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
|
1529 |
+
|
1530 |
if ( support.inlineBlockNeedsLayout ) {
|
1531 |
// Prevent IE 6 from affecting layout for positioned elements #11048
|
1532 |
// Prevent IE from shrinking the body in IE 7 mode #12869
|
1534 |
body.style.zoom = 1;
|
1535 |
}
|
1536 |
}
|
1537 |
+
|
1538 |
body.removeChild( container );
|
1539 |
+
|
1540 |
// Null elements to avoid leaks in IE
|
1541 |
container = div = tds = marginDiv = null;
|
1542 |
});
|
1543 |
+
|
1544 |
// Null elements to avoid leaks in IE
|
1545 |
all = select = fragment = opt = a = input = null;
|
1546 |
+
|
1547 |
return support;
|
1548 |
})();
|
1549 |
+
|
1550 |
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
|
1551 |
rmultiDash = /([A-Z])/g;
|
1552 |
+
|
1553 |
function internalData( elem, name, data, pvt /* Internal Use Only */ ){
|
1554 |
if ( !jQuery.acceptData( elem ) ) {
|
1555 |
return;
|
1556 |
}
|
1557 |
+
|
1558 |
var thisCache, ret,
|
1559 |
internalKey = jQuery.expando,
|
1560 |
getByName = typeof name === "string",
|
1561 |
+
|
1562 |
// We have to handle DOM nodes and JS objects differently because IE6-7
|
1563 |
// can't GC object references properly across the DOM-JS boundary
|
1564 |
isNode = elem.nodeType,
|
1565 |
+
|
1566 |
// Only DOM nodes need the global jQuery cache; JS object data is
|
1567 |
// attached directly to the object so GC can occur automatically
|
1568 |
cache = isNode ? jQuery.cache : elem,
|
1569 |
+
|
1570 |
// Only defining an ID for JS objects if its cache already exists allows
|
1571 |
// the code to shortcut on the same path as a DOM node with no cache
|
1572 |
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
|
1573 |
+
|
1574 |
// Avoid doing any more work than we need to when trying to get data on an
|
1575 |
// object that has no data at all
|
1576 |
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
|
1577 |
return;
|
1578 |
}
|
1579 |
+
|
1580 |
if ( !id ) {
|
1581 |
// Only DOM nodes need a new unique ID for each element since their data
|
1582 |
// ends up in the global cache
|
1586 |
id = internalKey;
|
1587 |
}
|
1588 |
}
|
1589 |
+
|
1590 |
if ( !cache[ id ] ) {
|
1591 |
cache[ id ] = {};
|
1592 |
+
|
1593 |
// Avoids exposing jQuery metadata on plain JS objects when the object
|
1594 |
// is serialized using JSON.stringify
|
1595 |
if ( !isNode ) {
|
1596 |
cache[ id ].toJSON = jQuery.noop;
|
1597 |
}
|
1598 |
}
|
1599 |
+
|
1600 |
// An object can be passed to jQuery.data instead of a key/value pair; this gets
|
1601 |
// shallow copied over onto the existing cache
|
1602 |
if ( typeof name === "object" || typeof name === "function" ) {
|
1606 |
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
|
1607 |
}
|
1608 |
}
|
1609 |
+
|
1610 |
thisCache = cache[ id ];
|
1611 |
+
|
1612 |
// jQuery data() is stored in a separate object inside the object's internal data
|
1613 |
// cache in order to avoid key collisions between internal data and user-defined
|
1614 |
// data.
|
1616 |
if ( !thisCache.data ) {
|
1617 |
thisCache.data = {};
|
1618 |
}
|
1619 |
+
|
1620 |
thisCache = thisCache.data;
|
1621 |
}
|
1622 |
+
|
1623 |
if ( data !== undefined ) {
|
1624 |
thisCache[ jQuery.camelCase( name ) ] = data;
|
1625 |
}
|
1626 |
+
|
1627 |
// Check for both converted-to-camel and non-converted data property names
|
1628 |
// If a data property was specified
|
1629 |
if ( getByName ) {
|
1630 |
+
|
1631 |
// First Try to find as-is property data
|
1632 |
ret = thisCache[ name ];
|
1633 |
+
|
1634 |
// Test for null|undefined property data
|
1635 |
if ( ret == null ) {
|
1636 |
+
|
1637 |
// Try to find the camelCased property
|
1638 |
ret = thisCache[ jQuery.camelCase( name ) ];
|
1639 |
}
|
1640 |
} else {
|
1641 |
ret = thisCache;
|
1642 |
}
|
1643 |
+
|
1644 |
return ret;
|
1645 |
}
|
1646 |
+
|
1647 |
function internalRemoveData( elem, name, pvt ) {
|
1648 |
if ( !jQuery.acceptData( elem ) ) {
|
1649 |
return;
|
1650 |
}
|
1651 |
+
|
1652 |
var i, l, thisCache,
|
1653 |
isNode = elem.nodeType,
|
1654 |
+
|
1655 |
// See jQuery.data for more information
|
1656 |
cache = isNode ? jQuery.cache : elem,
|
1657 |
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
|
1658 |
+
|
1659 |
// If there is already no cache entry for this object, there is no
|
1660 |
// purpose in continuing
|
1661 |
if ( !cache[ id ] ) {
|
1662 |
return;
|
1663 |
}
|
1664 |
+
|
1665 |
if ( name ) {
|
1666 |
+
|
1667 |
thisCache = pvt ? cache[ id ] : cache[ id ].data;
|
1668 |
+
|
1669 |
if ( thisCache ) {
|
1670 |
+
|
1671 |
// Support array or space separated string names for data keys
|
1672 |
if ( !jQuery.isArray( name ) ) {
|
1673 |
+
|
1674 |
// try the string as a key before any manipulation
|
1675 |
if ( name in thisCache ) {
|
1676 |
name = [ name ];
|
1677 |
} else {
|
1678 |
+
|
1679 |
// split the camel cased version by spaces unless a key with the spaces exists
|
1680 |
name = jQuery.camelCase( name );
|
1681 |
if ( name in thisCache ) {
|
1693 |
// This will only penalize the array argument path.
|
1694 |
name = name.concat( jQuery.map( name, jQuery.camelCase ) );
|
1695 |
}
|
1696 |
+
|
1697 |
for ( i = 0, l = name.length; i < l; i++ ) {
|
1698 |
delete thisCache[ name[i] ];
|
1699 |
}
|
1700 |
+
|
1701 |
// If there is no data left in the cache, we want to continue
|
1702 |
// and let the cache object itself get destroyed
|
1703 |
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
|
1705 |
}
|
1706 |
}
|
1707 |
}
|
1708 |
+
|
1709 |
// See jQuery.data for more information
|
1710 |
if ( !pvt ) {
|
1711 |
delete cache[ id ].data;
|
1712 |
+
|
1713 |
// Don't destroy the parent cache unless the internal data object
|
1714 |
// had been the only thing left in it
|
1715 |
if ( !isEmptyDataObject( cache[ id ] ) ) {
|
1716 |
return;
|
1717 |
}
|
1718 |
}
|
1719 |
+
|
1720 |
// Destroy the cache
|
1721 |
if ( isNode ) {
|
1722 |
jQuery.cleanData( [ elem ], true );
|
1723 |
+
|
1724 |
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
|
1725 |
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
|
1726 |
delete cache[ id ];
|
1727 |
+
|
1728 |
// When all else fails, null
|
1729 |
} else {
|
1730 |
cache[ id ] = null;
|
1731 |
}
|
1732 |
}
|
1733 |
+
|
1734 |
jQuery.extend({
|
1735 |
cache: {},
|
1736 |
+
|
1737 |
// Unique for each copy of jQuery on the page
|
1738 |
// Non-digits removed to match rinlinejQuery
|
1739 |
expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
|
1740 |
+
|
1741 |
// The following elements throw uncatchable exceptions if you
|
1742 |
// attempt to add expando properties to them.
|
1743 |
noData: {
|
1746 |
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
|
1747 |
"applet": true
|
1748 |
},
|
1749 |
+
|
1750 |
hasData: function( elem ) {
|
1751 |
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
|
1752 |
return !!elem && !isEmptyDataObject( elem );
|
1753 |
},
|
1754 |
+
|
1755 |
data: function( elem, name, data ) {
|
1756 |
return internalData( elem, name, data );
|
1757 |
},
|
1758 |
+
|
1759 |
removeData: function( elem, name ) {
|
1760 |
return internalRemoveData( elem, name );
|
1761 |
},
|
1762 |
+
|
1763 |
// For internal use only.
|
1764 |
_data: function( elem, name, data ) {
|
1765 |
return internalData( elem, name, data, true );
|
1766 |
},
|
1767 |
+
|
1768 |
_removeData: function( elem, name ) {
|
1769 |
return internalRemoveData( elem, name, true );
|
1770 |
},
|
1771 |
+
|
1772 |
// A method for determining if a DOM node can handle the data expando
|
1773 |
acceptData: function( elem ) {
|
1774 |
// Do not set data on non-element because it will not be cleared (#8335).
|
1775 |
if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
|
1776 |
return false;
|
1777 |
}
|
1778 |
+
|
1779 |
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
|
1780 |
+
|
1781 |
// nodes accept data unless otherwise specified; rejection can be conditional
|
1782 |
return !noData || noData !== true && elem.getAttribute("classid") === noData;
|
1783 |
}
|
1784 |
});
|
1785 |
+
|
1786 |
jQuery.fn.extend({
|
1787 |
data: function( key, value ) {
|
1788 |
var attrs, name,
|
1789 |
elem = this[0],
|
1790 |
i = 0,
|
1791 |
data = null;
|
1792 |
+
|
1793 |
// Gets all values
|
1794 |
if ( key === undefined ) {
|
1795 |
if ( this.length ) {
|
1796 |
data = jQuery.data( elem );
|
1797 |
+
|
1798 |
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
|
1799 |
attrs = elem.attributes;
|
1800 |
for ( ; i < attrs.length; i++ ) {
|
1801 |
name = attrs[i].name;
|
1802 |
+
|
1803 |
if ( !name.indexOf( "data-" ) ) {
|
1804 |
name = jQuery.camelCase( name.slice(5) );
|
1805 |
+
|
1806 |
dataAttr( elem, name, data[ name ] );
|
1807 |
}
|
1808 |
}
|
1809 |
jQuery._data( elem, "parsedAttrs", true );
|
1810 |
}
|
1811 |
}
|
1812 |
+
|
1813 |
return data;
|
1814 |
}
|
1815 |
+
|
1816 |
// Sets multiple values
|
1817 |
if ( typeof key === "object" ) {
|
1818 |
return this.each(function() {
|
1819 |
jQuery.data( this, key );
|
1820 |
});
|
1821 |
}
|
1822 |
+
|
1823 |
return jQuery.access( this, function( value ) {
|
1824 |
+
|
1825 |
if ( value === undefined ) {
|
1826 |
// Try to fetch any internally stored data first
|
1827 |
return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
|
1828 |
}
|
1829 |
+
|
1830 |
this.each(function() {
|
1831 |
jQuery.data( this, key, value );
|
1832 |
});
|
1833 |
}, null, value, arguments.length > 1, null, true );
|
1834 |
},
|
1835 |
+
|
1836 |
removeData: function( key ) {
|
1837 |
return this.each(function() {
|
1838 |
jQuery.removeData( this, key );
|
1839 |
});
|
1840 |
}
|
1841 |
});
|
1842 |
+
|
1843 |
function dataAttr( elem, key, data ) {
|
1844 |
// If nothing was found internally, try to fetch any
|
1845 |
// data from the HTML5 data-* attribute
|
1846 |
if ( data === undefined && elem.nodeType === 1 ) {
|
1847 |
+
|
1848 |
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
|
1849 |
+
|
1850 |
data = elem.getAttribute( name );
|
1851 |
+
|
1852 |
if ( typeof data === "string" ) {
|
1853 |
try {
|
1854 |
data = data === "true" ? true :
|
1859 |
rbrace.test( data ) ? jQuery.parseJSON( data ) :
|
1860 |
data;
|
1861 |
} catch( e ) {}
|
1862 |
+
|
1863 |
// Make sure we set the data so it isn't changed later
|
1864 |
jQuery.data( elem, key, data );
|
1865 |
+
|
1866 |
} else {
|
1867 |
data = undefined;
|
1868 |
}
|
1869 |
}
|
1870 |
+
|
1871 |
return data;
|
1872 |
}
|
1873 |
+
|
1874 |
// checks a cache object for emptiness
|
1875 |
function isEmptyDataObject( obj ) {
|
1876 |
var name;
|
1877 |
for ( name in obj ) {
|
1878 |
+
|
1879 |
// if the public data object is empty, the private is still empty
|
1880 |
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
|
1881 |
continue;
|
1884 |
return false;
|
1885 |
}
|
1886 |
}
|
1887 |
+
|
1888 |
return true;
|
1889 |
}
|
1890 |
jQuery.extend({
|
1891 |
queue: function( elem, type, data ) {
|
1892 |
var queue;
|
1893 |
+
|
1894 |
if ( elem ) {
|
1895 |
type = ( type || "fx" ) + "queue";
|
1896 |
queue = jQuery._data( elem, type );
|
1897 |
+
|
1898 |
// Speed up dequeue by getting out quickly if this is just a lookup
|
1899 |
if ( data ) {
|
1900 |
if ( !queue || jQuery.isArray(data) ) {
|
1906 |
return queue || [];
|
1907 |
}
|
1908 |
},
|
1909 |
+
|
1910 |
dequeue: function( elem, type ) {
|
1911 |
type = type || "fx";
|
1912 |
+
|
1913 |
var queue = jQuery.queue( elem, type ),
|
1914 |
startLength = queue.length,
|
1915 |
fn = queue.shift(),
|
1917 |
next = function() {
|
1918 |
jQuery.dequeue( elem, type );
|
1919 |
};
|
1920 |
+
|
1921 |
// If the fx queue is dequeued, always remove the progress sentinel
|
1922 |
if ( fn === "inprogress" ) {
|
1923 |
fn = queue.shift();
|
1924 |
startLength--;
|
1925 |
}
|
1926 |
+
|
1927 |
hooks.cur = fn;
|
1928 |
if ( fn ) {
|
1929 |
+
|
1930 |
// Add a progress sentinel to prevent the fx queue from being
|
1931 |
// automatically dequeued
|
1932 |
if ( type === "fx" ) {
|
1933 |
queue.unshift( "inprogress" );
|
1934 |
}
|
1935 |
+
|
1936 |
// clear up the last queue stop function
|
1937 |
delete hooks.stop;
|
1938 |
fn.call( elem, next, hooks );
|
1939 |
}
|
1940 |
+
|
1941 |
if ( !startLength && hooks ) {
|
1942 |
hooks.empty.fire();
|
1943 |
}
|
1944 |
},
|
1945 |
+
|
1946 |
// not intended for public consumption - generates a queueHooks object, or returns the current one
|
1947 |
_queueHooks: function( elem, type ) {
|
1948 |
var key = type + "queueHooks";
|
1954 |
});
|
1955 |
}
|
1956 |
});
|
1957 |
+
|
1958 |
jQuery.fn.extend({
|
1959 |
queue: function( type, data ) {
|
1960 |
var setter = 2;
|
1961 |
+
|
1962 |
if ( typeof type !== "string" ) {
|
1963 |
data = type;
|
1964 |
type = "fx";
|
1965 |
setter--;
|
1966 |
}
|
1967 |
+
|
1968 |
if ( arguments.length < setter ) {
|
1969 |
return jQuery.queue( this[0], type );
|
1970 |
}
|
1971 |
+
|
1972 |
return data === undefined ?
|
1973 |
this :
|
1974 |
this.each(function() {
|
1975 |
var queue = jQuery.queue( this, type, data );
|
1976 |
+
|
1977 |
// ensure a hooks for this queue
|
1978 |
jQuery._queueHooks( this, type );
|
1979 |
+
|
1980 |
if ( type === "fx" && queue[0] !== "inprogress" ) {
|
1981 |
jQuery.dequeue( this, type );
|
1982 |
}
|
1992 |
delay: function( time, type ) {
|
1993 |
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
|
1994 |
type = type || "fx";
|
1995 |
+
|
1996 |
return this.queue( type, function( next, hooks ) {
|
1997 |
var timeout = setTimeout( next, time );
|
1998 |
hooks.stop = function() {
|
2016 |
defer.resolveWith( elements, [ elements ] );
|
2017 |
}
|
2018 |
};
|
2019 |
+
|
2020 |
if ( typeof type !== "string" ) {
|
2021 |
obj = type;
|
2022 |
type = undefined;
|
2023 |
}
|
2024 |
type = type || "fx";
|
2025 |
+
|
2026 |
while( i-- ) {
|
2027 |
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
|
2028 |
if ( tmp && tmp.empty ) {
|
2043 |
ruseDefault = /^(?:checked|selected)$/i,
|
2044 |
getSetAttribute = jQuery.support.getSetAttribute,
|
2045 |
getSetInput = jQuery.support.input;
|
2046 |
+
|
2047 |
jQuery.fn.extend({
|
2048 |
attr: function( name, value ) {
|
2049 |
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
|
2050 |
},
|
2051 |
+
|
2052 |
removeAttr: function( name ) {
|
2053 |
return this.each(function() {
|
2054 |
jQuery.removeAttr( this, name );
|
2055 |
});
|
2056 |
},
|
2057 |
+
|
2058 |
prop: function( name, value ) {
|
2059 |
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
|
2060 |
},
|
2061 |
+
|
2062 |
removeProp: function( name ) {
|
2063 |
name = jQuery.propFix[ name ] || name;
|
2064 |
return this.each(function() {
|
2069 |
} catch( e ) {}
|
2070 |
});
|
2071 |
},
|
2072 |
+
|
2073 |
addClass: function( value ) {
|
2074 |
var classes, elem, cur, clazz, j,
|
2075 |
i = 0,
|
2076 |
len = this.length,
|
2077 |
proceed = typeof value === "string" && value;
|
2078 |
+
|
2079 |
if ( jQuery.isFunction( value ) ) {
|
2080 |
return this.each(function( j ) {
|
2081 |
jQuery( this ).addClass( value.call( this, j, this.className ) );
|
2082 |
});
|
2083 |
}
|
2084 |
+
|
2085 |
if ( proceed ) {
|
2086 |
// The disjunction here is for better compressibility (see removeClass)
|
2087 |
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
2088 |
+
|
2089 |
for ( ; i < len; i++ ) {
|
2090 |
elem = this[ i ];
|
2091 |
cur = elem.nodeType === 1 && ( elem.className ?
|
2092 |
( " " + elem.className + " " ).replace( rclass, " " ) :
|
2093 |
" "
|
2094 |
);
|
2095 |
+
|
2096 |
if ( cur ) {
|
2097 |
j = 0;
|
2098 |
while ( (clazz = classes[j++]) ) {
|
2101 |
}
|
2102 |
}
|
2103 |
elem.className = jQuery.trim( cur );
|
2104 |
+
|
2105 |
}
|
2106 |
}
|
2107 |
}
|
2108 |
+
|
2109 |
return this;
|
2110 |
},
|
2111 |
+
|
2112 |
removeClass: function( value ) {
|
2113 |
var classes, elem, cur, clazz, j,
|
2114 |
i = 0,
|
2115 |
len = this.length,
|
2116 |
proceed = arguments.length === 0 || typeof value === "string" && value;
|
2117 |
+
|
2118 |
if ( jQuery.isFunction( value ) ) {
|
2119 |
return this.each(function( j ) {
|
2120 |
jQuery( this ).removeClass( value.call( this, j, this.className ) );
|
2122 |
}
|
2123 |
if ( proceed ) {
|
2124 |
classes = ( value || "" ).match( core_rnotwhite ) || [];
|
2125 |
+
|
2126 |
for ( ; i < len; i++ ) {
|
2127 |
elem = this[ i ];
|
2128 |
// This expression is here for better compressibility (see addClass)
|
2130 |
( " " + elem.className + " " ).replace( rclass, " " ) :
|
2131 |
""
|
2132 |
);
|
2133 |
+
|
2134 |
if ( cur ) {
|
2135 |
j = 0;
|
2136 |
while ( (clazz = classes[j++]) ) {
|
2143 |
}
|
2144 |
}
|
2145 |
}
|
2146 |
+
|
2147 |
return this;
|
2148 |
},
|
2149 |
+
|
2150 |
toggleClass: function( value, stateVal ) {
|
2151 |
var type = typeof value,
|
2152 |
isBool = typeof stateVal === "boolean";
|
2153 |
+
|
2154 |
if ( jQuery.isFunction( value ) ) {
|
2155 |
return this.each(function( i ) {
|
2156 |
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
|
2157 |
});
|
2158 |
}
|
2159 |
+
|
2160 |
return this.each(function() {
|
2161 |
if ( type === "string" ) {
|
2162 |
// toggle individual class names
|
2165 |
self = jQuery( this ),
|
2166 |
state = stateVal,
|
2167 |
classNames = value.match( core_rnotwhite ) || [];
|
2168 |
+
|
2169 |
while ( (className = classNames[ i++ ]) ) {
|
2170 |
// check each className given, space separated list
|
2171 |
state = isBool ? state : !self.hasClass( className );
|
2172 |
self[ state ? "addClass" : "removeClass" ]( className );
|
2173 |
}
|
2174 |
+
|
2175 |
// Toggle whole class name
|
2176 |
} else if ( type === core_strundefined || type === "boolean" ) {
|
2177 |
if ( this.className ) {
|
2178 |
// store className if set
|
2179 |
jQuery._data( this, "__className__", this.className );
|
2180 |
}
|
2181 |
+
|
2182 |
// If the element has a class name or if we're passed "false",
|
2183 |
// then remove the whole classname (if there was one, the above saved it).
|
2184 |
// Otherwise bring back whatever was previously saved (if anything),
|
2187 |
}
|
2188 |
});
|
2189 |
},
|
2190 |
+
|
2191 |
hasClass: function( selector ) {
|
2192 |
var className = " " + selector + " ",
|
2193 |
i = 0,
|
2197 |
return true;
|
2198 |
}
|
2199 |
}
|
2200 |
+
|
2201 |
return false;
|
2202 |
},
|
2203 |
+
|
2204 |
val: function( value ) {
|
2205 |
var ret, hooks, isFunction,
|
2206 |
elem = this[0];
|
2207 |
+
|
2208 |
if ( !arguments.length ) {
|
2209 |
if ( elem ) {
|
2210 |
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
|
2211 |
+
|
2212 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
|
2213 |
return ret;
|
2214 |
}
|
2215 |
+
|
2216 |
ret = elem.value;
|
2217 |
+
|
2218 |
return typeof ret === "string" ?
|
2219 |
// handle most common string cases
|
2220 |
ret.replace(rreturn, "") :
|
2221 |
// handle cases where value is null/undef or number
|
2222 |
ret == null ? "" : ret;
|
2223 |
}
|
2224 |
+
|
2225 |
return;
|
2226 |
}
|
2227 |
+
|
2228 |
isFunction = jQuery.isFunction( value );
|
2229 |
+
|
2230 |
return this.each(function( i ) {
|
2231 |
var val,
|
2232 |
self = jQuery(this);
|
2233 |
+
|
2234 |
if ( this.nodeType !== 1 ) {
|
2235 |
return;
|
2236 |
}
|
2237 |
+
|
2238 |
if ( isFunction ) {
|
2239 |
val = value.call( this, i, self.val() );
|
2240 |
} else {
|
2241 |
val = value;
|
2242 |
}
|
2243 |
+
|
2244 |
// Treat null/undefined as ""; convert numbers to string
|
2245 |
if ( val == null ) {
|
2246 |
val = "";
|
2251 |
return value == null ? "" : value + "";
|
2252 |
});
|
2253 |
}
|
2254 |
+
|
2255 |
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
|
2256 |
+
|
2257 |
// If set returns undefined, fall back to normal setting
|
2258 |
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
|
2259 |
this.value = val;
|
2261 |
});
|
2262 |
}
|
2263 |
});
|
2264 |
+
|
2265 |
jQuery.extend({
|
2266 |
valHooks: {
|
2267 |
option: {
|
2283 |
i = index < 0 ?
|
2284 |
max :
|
2285 |
one ? index : 0;
|
2286 |
+
|
2287 |
// Loop through all the selected options
|
2288 |
for ( ; i < max; i++ ) {
|
2289 |
option = options[ i ];
|
2290 |
+
|
2291 |
// oldIE doesn't update selected after form reset (#2551)
|
2292 |
if ( ( option.selected || i === index ) &&
|
2293 |
// Don't return options that are disabled or in a disabled optgroup
|
2294 |
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
|
2295 |
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
|
2296 |
+
|
2297 |
// Get the specific value for the option
|
2298 |
value = jQuery( option ).val();
|
2299 |
+
|
2300 |
// We don't need an array for one selects
|
2301 |
if ( one ) {
|
2302 |
return value;
|
2303 |
}
|
2304 |
+
|
2305 |
// Multi-Selects return an array
|
2306 |
values.push( value );
|
2307 |
}
|
2308 |
}
|
2309 |
+
|
2310 |
return values;
|
2311 |
},
|
2312 |
+
|
2313 |
set: function( elem, value ) {
|
2314 |
var values = jQuery.makeArray( value );
|
2315 |
+
|
2316 |
jQuery(elem).find("option").each(function() {
|
2317 |
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
|
2318 |
});
|
2319 |
+
|
2320 |
if ( !values.length ) {
|
2321 |
elem.selectedIndex = -1;
|
2322 |
}
|
2324 |
}
|
2325 |
}
|
2326 |
},
|
2327 |
+
|
2328 |
attr: function( elem, name, value ) {
|
2329 |
var hooks, notxml, ret,
|
2330 |
nType = elem.nodeType;
|
2331 |
+
|
2332 |
// don't get/set attributes on text, comment and attribute nodes
|
2333 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
2334 |
return;
|
2335 |
}
|
2336 |
+
|
2337 |
// Fallback to prop when attributes are not supported
|
2338 |
if ( typeof elem.getAttribute === core_strundefined ) {
|
2339 |
return jQuery.prop( elem, name, value );
|
2340 |
}
|
2341 |
+
|
2342 |
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
2343 |
+
|
2344 |
// All attributes are lowercase
|
2345 |
// Grab necessary hook if one is defined
|
2346 |
if ( notxml ) {
|
2347 |
name = name.toLowerCase();
|
2348 |
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
|
2349 |
}
|
2350 |
+
|
2351 |
if ( value !== undefined ) {
|
2352 |
+
|
2353 |
if ( value === null ) {
|
2354 |
jQuery.removeAttr( elem, name );
|
2355 |
+
|
2356 |
} else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
2357 |
return ret;
|
2358 |
+
|
2359 |
} else {
|
2360 |
elem.setAttribute( name, value + "" );
|
2361 |
return value;
|
2362 |
}
|
2363 |
+
|
2364 |
} else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
2365 |
return ret;
|
2366 |
+
|
2367 |
} else {
|
2368 |
+
|
2369 |
// In IE9+, Flash objects don't have .getAttribute (#12945)
|
2370 |
// Support: IE9+
|
2371 |
if ( typeof elem.getAttribute !== core_strundefined ) {
|
2372 |
ret = elem.getAttribute( name );
|
2373 |
}
|
2374 |
+
|
2375 |
// Non-existent attributes return null, we normalize to undefined
|
2376 |
return ret == null ?
|
2377 |
undefined :
|
2378 |
ret;
|
2379 |
}
|
2380 |
},
|
2381 |
+
|
2382 |
removeAttr: function( elem, value ) {
|
2383 |
var name, propName,
|
2384 |
i = 0,
|
2385 |
attrNames = value && value.match( core_rnotwhite );
|
2386 |
+
|
2387 |
if ( attrNames && elem.nodeType === 1 ) {
|
2388 |
while ( (name = attrNames[i++]) ) {
|
2389 |
propName = jQuery.propFix[ name ] || name;
|
2390 |
+
|
2391 |
// Boolean attributes get special treatment (#10870)
|
2392 |
if ( rboolean.test( name ) ) {
|
2393 |
// Set corresponding property to false for boolean attributes
|
2398 |
} else {
|
2399 |
elem[ propName ] = false;
|
2400 |
}
|
2401 |
+
|
2402 |
// See #9699 for explanation of this approach (setting first, then removal)
|
2403 |
} else {
|
2404 |
jQuery.attr( elem, name, "" );
|
2405 |
}
|
2406 |
+
|
2407 |
elem.removeAttribute( getSetAttribute ? name : propName );
|
2408 |
}
|
2409 |
}
|
2410 |
},
|
2411 |
+
|
2412 |
attrHooks: {
|
2413 |
type: {
|
2414 |
set: function( elem, value ) {
|
2425 |
}
|
2426 |
}
|
2427 |
},
|
2428 |
+
|
2429 |
propFix: {
|
2430 |
tabindex: "tabIndex",
|
2431 |
readonly: "readOnly",
|
2440 |
frameborder: "frameBorder",
|
2441 |
contenteditable: "contentEditable"
|
2442 |
},
|
2443 |
+
|
2444 |
prop: function( elem, name, value ) {
|
2445 |
var ret, hooks, notxml,
|
2446 |
nType = elem.nodeType;
|
2447 |
+
|
2448 |
// don't get/set properties on text, comment and attribute nodes
|
2449 |
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
|
2450 |
return;
|
2451 |
}
|
2452 |
+
|
2453 |
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
|
2454 |
+
|
2455 |
if ( notxml ) {
|
2456 |
// Fix name and attach hooks
|
2457 |
name = jQuery.propFix[ name ] || name;
|
2458 |
hooks = jQuery.propHooks[ name ];
|
2459 |
}
|
2460 |
+
|
2461 |
if ( value !== undefined ) {
|
2462 |
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
|
2463 |
return ret;
|
2464 |
+
|
2465 |
} else {
|
2466 |
return ( elem[ name ] = value );
|
2467 |
}
|
2468 |
+
|
2469 |
} else {
|
2470 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
|
2471 |
return ret;
|
2472 |
+
|
2473 |
} else {
|
2474 |
return elem[ name ];
|
2475 |
}
|
2476 |
}
|
2477 |
},
|
2478 |
+
|
2479 |
propHooks: {
|
2480 |
tabIndex: {
|
2481 |
get: function( elem ) {
|
2482 |
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
|
2483 |
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
2484 |
var attributeNode = elem.getAttributeNode("tabindex");
|
2485 |
+
|
2486 |
return attributeNode && attributeNode.specified ?
|
2487 |
parseInt( attributeNode.value, 10 ) :
|
2488 |
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
|
2492 |
}
|
2493 |
}
|
2494 |
});
|
2495 |
+
|
2496 |
// Hook for boolean attributes
|
2497 |
boolHook = {
|
2498 |
get: function( elem, name ) {
|
2499 |
var
|
2500 |
// Use .prop to determine if this attribute is understood as boolean
|
2501 |
prop = jQuery.prop( elem, name ),
|
2502 |
+
|
2503 |
// Fetch it accordingly
|
2504 |
attr = typeof prop === "boolean" && elem.getAttribute( name ),
|
2505 |
detail = typeof prop === "boolean" ?
|
2506 |
+
|
2507 |
getSetInput && getSetAttribute ?
|
2508 |
attr != null :
|
2509 |
// oldIE fabricates an empty string for missing boolean attributes
|
2511 |
ruseDefault.test( name ) ?
|
2512 |
elem[ jQuery.camelCase( "default-" + name ) ] :
|
2513 |
!!attr :
|
2514 |
+
|
2515 |
// fetch an attribute node for properties not recognized as boolean
|
2516 |
elem.getAttributeNode( name );
|
2517 |
+
|
2518 |
return detail && detail.value !== false ?
|
2519 |
name.toLowerCase() :
|
2520 |
undefined;
|
2526 |
} else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
|
2527 |
// IE<8 needs the *property* name
|
2528 |
elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
|
2529 |
+
|
2530 |
// Use defaultChecked and defaultSelected for oldIE
|
2531 |
} else {
|
2532 |
elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
|
2533 |
}
|
2534 |
+
|
2535 |
return name;
|
2536 |
}
|
2537 |
};
|
2538 |
+
|
2539 |
// fix oldIE value attroperty
|
2540 |
if ( !getSetInput || !getSetAttribute ) {
|
2541 |
jQuery.attrHooks.value = {
|
2542 |
get: function( elem, name ) {
|
2543 |
var ret = elem.getAttributeNode( name );
|
2544 |
return jQuery.nodeName( elem, "input" ) ?
|
2545 |
+
|
2546 |
// Ignore the value *property* by using defaultValue
|
2547 |
elem.defaultValue :
|
2548 |
+
|
2549 |
ret && ret.specified ? ret.value : undefined;
|
2550 |
},
|
2551 |
set: function( elem, value, name ) {
|
2559 |
}
|
2560 |
};
|
2561 |
}
|
2562 |
+
|
2563 |
// IE6/7 do not support getting/setting some attributes with get/setAttribute
|
2564 |
if ( !getSetAttribute ) {
|
2565 |
+
|
2566 |
// Use this for any attribute in IE6/7
|
2567 |
// This fixes almost every IE6/7 issue
|
2568 |
nodeHook = jQuery.valHooks.button = {
|
2580 |
(ret = elem.ownerDocument.createAttribute( name ))
|
2581 |
);
|
2582 |
}
|
2583 |
+
|
2584 |
ret.value = value += "";
|
2585 |
+
|
2586 |
// Break association with cloned elements by also using setAttribute (#9646)
|
2587 |
return name === "value" || value === elem.getAttribute( name ) ?
|
2588 |
value :
|
2589 |
undefined;
|
2590 |
}
|
2591 |
};
|
2592 |
+
|
2593 |
// Set contenteditable to false on removals(#10429)
|
2594 |
// Setting to empty string throws an error as an invalid value
|
2595 |
jQuery.attrHooks.contenteditable = {
|
2598 |
nodeHook.set( elem, value === "" ? false : value, name );
|
2599 |
}
|
2600 |
};
|
2601 |
+
|
2602 |
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
|
2603 |
// This is for removals
|
2604 |
jQuery.each([ "width", "height" ], function( i, name ) {
|
2612 |
});
|
2613 |
});
|
2614 |
}
|
2615 |
+
|
2616 |
+
|
2617 |
// Some attributes require a special call on IE
|
2618 |
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
|
2619 |
if ( !jQuery.support.hrefNormalized ) {
|
2625 |
}
|
2626 |
});
|
2627 |
});
|
2628 |
+
|
2629 |
// href/src property should get the full normalized URL (#10299/#12915)
|
2630 |
jQuery.each([ "href", "src" ], function( i, name ) {
|
2631 |
jQuery.propHooks[ name ] = {
|
2635 |
};
|
2636 |
});
|
2637 |
}
|
2638 |
+
|
2639 |
if ( !jQuery.support.style ) {
|
2640 |
jQuery.attrHooks.style = {
|
2641 |
get: function( elem ) {
|
2649 |
}
|
2650 |
};
|
2651 |
}
|
2652 |
+
|
2653 |
// Safari mis-reports the default selected property of an option
|
2654 |
// Accessing the parent's selectedIndex property fixes it
|
2655 |
if ( !jQuery.support.optSelected ) {
|
2656 |
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
|
2657 |
get: function( elem ) {
|
2658 |
var parent = elem.parentNode;
|
2659 |
+
|
2660 |
if ( parent ) {
|
2661 |
parent.selectedIndex;
|
2662 |
+
|
2663 |
// Make sure that it also works with optgroups, see #5701
|
2664 |
if ( parent.parentNode ) {
|
2665 |
parent.parentNode.selectedIndex;
|
2669 |
}
|
2670 |
});
|
2671 |
}
|
2672 |
+
|
2673 |
// IE6/7 call enctype encoding
|
2674 |
if ( !jQuery.support.enctype ) {
|
2675 |
jQuery.propFix.enctype = "encoding";
|
2676 |
}
|
2677 |
+
|
2678 |
// Radios and checkboxes getter/setter
|
2679 |
if ( !jQuery.support.checkOn ) {
|
2680 |
jQuery.each([ "radio", "checkbox" ], function() {
|
2700 |
rmouseEvent = /^(?:mouse|contextmenu)|click/,
|
2701 |
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
|
2702 |
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
|
2703 |
+
|
2704 |
function returnTrue() {
|
2705 |
return true;
|
2706 |
}
|
2707 |
+
|
2708 |
function returnFalse() {
|
2709 |
return false;
|
2710 |
}
|
2711 |
+
|
2712 |
/*
|
2713 |
* Helper functions for managing events -- not part of the public interface.
|
2714 |
* Props to Dean Edwards' addEvent library for many of the ideas.
|
2715 |
*/
|
2716 |
jQuery.event = {
|
2717 |
+
|
2718 |
global: {},
|
2719 |
+
|
2720 |
add: function( elem, types, handler, data, selector ) {
|
2721 |
var tmp, events, t, handleObjIn,
|
2722 |
special, eventHandle, handleObj,
|
2723 |
handlers, type, namespaces, origType,
|
2724 |
elemData = jQuery._data( elem );
|
2725 |
+
|
2726 |
// Don't attach events to noData or text/comment nodes (but allow plain objects)
|
2727 |
if ( !elemData ) {
|
2728 |
return;
|
2729 |
}
|
2730 |
+
|
2731 |
// Caller can pass in an object of custom data in lieu of the handler
|
2732 |
if ( handler.handler ) {
|
2733 |
handleObjIn = handler;
|
2734 |
handler = handleObjIn.handler;
|
2735 |
selector = handleObjIn.selector;
|
2736 |
}
|
2737 |
+
|
2738 |
// Make sure that the handler has a unique ID, used to find/remove it later
|
2739 |
if ( !handler.guid ) {
|
2740 |
handler.guid = jQuery.guid++;
|
2741 |
}
|
2742 |
+
|
2743 |
// Init the element's event structure and main handler, if this is the first
|
2744 |
if ( !(events = elemData.events) ) {
|
2745 |
events = elemData.events = {};
|
2755 |
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
|
2756 |
eventHandle.elem = elem;
|
2757 |
}
|
2758 |
+
|
2759 |
// Handle multiple events separated by a space
|
2760 |
// jQuery(...).bind("mouseover mouseout", fn);
|
2761 |
types = ( types || "" ).match( core_rnotwhite ) || [""];
|
2764 |
tmp = rtypenamespace.exec( types[t] ) || [];
|
2765 |
type = origType = tmp[1];
|
2766 |
namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
2767 |
+
|
2768 |
// If event changes its type, use the special event handlers for the changed type
|
2769 |
special = jQuery.event.special[ type ] || {};
|
2770 |
+
|
2771 |
// If selector defined, determine special event api type, otherwise given type
|
2772 |
type = ( selector ? special.delegateType : special.bindType ) || type;
|
2773 |
+
|
2774 |
// Update special based on newly reset type
|
2775 |
special = jQuery.event.special[ type ] || {};
|
2776 |
+
|
2777 |
// handleObj is passed to all event handlers
|
2778 |
handleObj = jQuery.extend({
|
2779 |
type: type,
|
2785 |
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
|
2786 |
namespace: namespaces.join(".")
|
2787 |
}, handleObjIn );
|
2788 |
+
|
2789 |
// Init the event handler queue if we're the first
|
2790 |
if ( !(handlers = events[ type ]) ) {
|
2791 |
handlers = events[ type ] = [];
|
2792 |
handlers.delegateCount = 0;
|
2793 |
+
|
2794 |
// Only use addEventListener/attachEvent if the special events handler returns false
|
2795 |
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
|
2796 |
// Bind the global event handler to the element
|
2797 |
if ( elem.addEventListener ) {
|
2798 |
elem.addEventListener( type, eventHandle, false );
|
2799 |
+
|
2800 |
} else if ( elem.attachEvent ) {
|
2801 |
elem.attachEvent( "on" + type, eventHandle );
|
2802 |
}
|
2803 |
}
|
2804 |
}
|
2805 |
+
|
2806 |
if ( special.add ) {
|
2807 |
special.add.call( elem, handleObj );
|
2808 |
+
|
2809 |
if ( !handleObj.handler.guid ) {
|
2810 |
handleObj.handler.guid = handler.guid;
|
2811 |
}
|
2812 |
}
|
2813 |
+
|
2814 |
// Add to the element's handler list, delegates in front
|
2815 |
if ( selector ) {
|
2816 |
handlers.splice( handlers.delegateCount++, 0, handleObj );
|
2817 |
} else {
|
2818 |
handlers.push( handleObj );
|
2819 |
}
|
2820 |
+
|
2821 |
// Keep track of which events have ever been used, for event optimization
|
2822 |
jQuery.event.global[ type ] = true;
|
2823 |
}
|
2824 |
+
|
2825 |
// Nullify elem to prevent memory leaks in IE
|
2826 |
elem = null;
|
2827 |
},
|
2828 |
+
|
2829 |
// Detach an event or set of events from an element
|
2830 |
remove: function( elem, types, handler, selector, mappedTypes ) {
|
2831 |
var j, handleObj, tmp,
|
2833 |
special, handlers, type,
|
2834 |
namespaces, origType,
|
2835 |
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
|
2836 |
+
|
2837 |
if ( !elemData || !(events = elemData.events) ) {
|
2838 |
return;
|
2839 |
}
|
2840 |
+
|
2841 |
// Once for each type.namespace in types; type may be omitted
|
2842 |
types = ( types || "" ).match( core_rnotwhite ) || [""];
|
2843 |
t = types.length;
|
2845 |
tmp = rtypenamespace.exec( types[t] ) || [];
|
2846 |
type = origType = tmp[1];
|
2847 |
namespaces = ( tmp[2] || "" ).split( "." ).sort();
|
2848 |
+
|
2849 |
// Unbind all events (on this namespace, if provided) for the element
|
2850 |
if ( !type ) {
|
2851 |
for ( type in events ) {
|
2853 |
}
|
2854 |
continue;
|
2855 |
}
|
2856 |
+
|
2857 |
special = jQuery.event.special[ type ] || {};
|
2858 |
type = ( selector ? special.delegateType : special.bindType ) || type;
|
2859 |
handlers = events[ type ] || [];
|
2860 |
tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
|
2861 |
+
|
2862 |
// Remove matching events
|
2863 |
origCount = j = handlers.length;
|
2864 |
while ( j-- ) {
|
2865 |
handleObj = handlers[ j ];
|
2866 |
+
|
2867 |
if ( ( mappedTypes || origType === handleObj.origType ) &&
|
2868 |
( !handler || handler.guid === handleObj.guid ) &&
|
2869 |
( !tmp || tmp.test( handleObj.namespace ) ) &&
|
2870 |
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
|
2871 |
handlers.splice( j, 1 );
|
2872 |
+
|
2873 |
if ( handleObj.selector ) {
|
2874 |
handlers.delegateCount--;
|
2875 |
}
|
2878 |
}
|
2879 |
}
|
2880 |
}
|
2881 |
+
|
2882 |
// Remove generic event handler if we removed something and no more handlers exist
|
2883 |
// (avoids potential for endless recursion during removal of special event handlers)
|
2884 |
if ( origCount && !handlers.length ) {
|
2885 |
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
|
2886 |
jQuery.removeEvent( elem, type, elemData.handle );
|
2887 |
}
|
2888 |
+
|
2889 |
+
|
2890 |
+
|
2891 |
delete events[ type ];
|
2892 |
}
|
2893 |
}
|
2894 |
+
|
2895 |
// Remove the expando if it's no longer used
|
2896 |
if ( jQuery.isEmptyObject( events ) ) {
|
2897 |
delete elemData.handle;
|
2898 |
+
|
2899 |
// removeData also checks for emptiness and clears the expando if empty
|
2900 |
// so use it instead of delete
|
2901 |
jQuery._removeData( elem, "events" );
|
2902 |
}
|
2903 |
},
|
2904 |
+
|
2905 |
trigger: function( event, data, elem, onlyHandlers ) {
|
2906 |
var handle, ontype, cur,
|
2907 |
bubbleType, special, tmp, i,
|
2908 |
eventPath = [ elem || document ],
|
2909 |
type = core_hasOwn.call( event, "type" ) ? event.type : event,
|
2910 |
namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
|
2911 |
+
|
2912 |
cur = tmp = elem = elem || document;
|
2913 |
+
|
2914 |
// Don't do events on text and comment nodes
|
2915 |
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
|
2916 |
return;
|
2917 |
}
|
2918 |
+
|
2919 |
// focus/blur morphs to focusin/out; ensure we're not firing them right now
|
2920 |
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
|
2921 |
return;
|
2922 |
}
|
2923 |
+
|
2924 |
if ( type.indexOf(".") >= 0 ) {
|
2925 |
// Namespaced trigger; create a regexp to match event type in handle()
|
2926 |
namespaces = type.split(".");
|
2928 |
namespaces.sort();
|
2929 |
}
|
2930 |
ontype = type.indexOf(":") < 0 && "on" + type;
|
2931 |
+
|
2932 |
// Caller can pass in a jQuery.Event object, Object, or just an event type string
|
2933 |
event = event[ jQuery.expando ] ?
|
2934 |
event :
|
2935 |
new jQuery.Event( type, typeof event === "object" && event );
|
2936 |
+
|
2937 |
event.isTrigger = true;
|
2938 |
event.namespace = namespaces.join(".");
|
2939 |
event.namespace_re = event.namespace ?
|
2940 |
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
|
2941 |
null;
|
2942 |
+
|
2943 |
// Clean up the event in case it is being reused
|
2944 |
event.result = undefined;
|
2945 |
if ( !event.target ) {
|
2946 |
event.target = elem;
|
2947 |
}
|
2948 |
+
|
2949 |
// Clone any incoming data and prepend the event, creating the handler arg list
|
2950 |
data = data == null ?
|
2951 |
[ event ] :
|
2952 |
jQuery.makeArray( data, [ event ] );
|
2953 |
+
|
2954 |
// Allow special events to draw outside the lines
|
2955 |
special = jQuery.event.special[ type ] || {};
|
2956 |
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
|
2957 |
return;
|
2958 |
}
|
2959 |
+
|
2960 |
// Determine event propagation path in advance, per W3C events spec (#9951)
|
2961 |
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
|
2962 |
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
|
2963 |
+
|
2964 |
bubbleType = special.delegateType || type;
|
2965 |
if ( !rfocusMorph.test( bubbleType + type ) ) {
|
2966 |
cur = cur.parentNode;
|
2969 |
eventPath.push( cur );
|
2970 |
tmp = cur;
|
2971 |
}
|
2972 |
+
|
2973 |
// Only add window if we got to document (e.g., not plain obj or detached DOM)
|
2974 |
if ( tmp === (elem.ownerDocument || document) ) {
|
2975 |
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
|
2976 |
}
|
2977 |
}
|
2978 |
+
|
2979 |
// Fire handlers on the event path
|
2980 |
i = 0;
|
2981 |
while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
|
2982 |
+
|
2983 |
event.type = i > 1 ?
|
2984 |
bubbleType :
|
2985 |
special.bindType || type;
|
2986 |
+
|
2987 |
// jQuery handler
|
2988 |
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
|
2989 |
if ( handle ) {
|
2990 |
handle.apply( cur, data );
|
2991 |
}
|
2992 |
+
|
2993 |
// Native handler
|
2994 |
handle = ontype && cur[ ontype ];
|
2995 |
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
|
2997 |
}
|
2998 |
}
|
2999 |
event.type = type;
|
3000 |
+
|
3001 |
// If nobody prevented the default action, do it now
|
3002 |
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
|
3003 |
+
|
3004 |
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
|
3005 |
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
|
3006 |
+
|
3007 |
// Call a native DOM method on the target with the same name name as the event.
|
3008 |
// Can't use an .isFunction() check here because IE6/7 fails that test.
|
3009 |
// Don't do default actions on window, that's where global variables be (#6170)
|
3010 |
if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
|
3011 |
+
|
3012 |
// Don't re-trigger an onFOO event when we call its FOO() method
|
3013 |
tmp = elem[ ontype ];
|
3014 |
+
|
3015 |
if ( tmp ) {
|
3016 |
elem[ ontype ] = null;
|
3017 |
}
|
3018 |
+
|
3019 |
// Prevent re-triggering of the same event, since we already bubbled it above
|
3020 |
jQuery.event.triggered = type;
|
3021 |
try {
|
3025 |
// only reproducible on winXP IE8 native, not IE9 in IE8 mode
|
3026 |
}
|
3027 |
jQuery.event.triggered = undefined;
|
3028 |
+
|
3029 |
if ( tmp ) {
|
3030 |
elem[ ontype ] = tmp;
|
3031 |
}
|
3032 |
}
|
3033 |
}
|
3034 |
}
|
3035 |
+
|
3036 |
return event.result;
|
3037 |
},
|
3038 |
+
|
3039 |
dispatch: function( event ) {
|
3040 |
+
|
3041 |
// Make a writable jQuery.Event from the native event object
|
3042 |
event = jQuery.event.fix( event );
|
3043 |
+
|
3044 |
var i, ret, handleObj, matched, j,
|
3045 |
handlerQueue = [],
|
3046 |
args = core_slice.call( arguments ),
|
3047 |
handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
|
3048 |
special = jQuery.event.special[ event.type ] || {};
|
3049 |
+
|
3050 |
// Use the fix-ed jQuery.Event rather than the (read-only) native event
|
3051 |
args[0] = event;
|
3052 |
event.delegateTarget = this;
|
3053 |
+
|
3054 |
// Call the preDispatch hook for the mapped type, and let it bail if desired
|
3055 |
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
|
3056 |
return;
|
3057 |
}
|
3058 |
+
|
3059 |
// Determine handlers
|
3060 |
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
|
3061 |
+
|
3062 |
// Run delegates first; they may want to stop propagation beneath us
|
3063 |
i = 0;
|
3064 |
while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
|
3065 |
event.currentTarget = matched.elem;
|
3066 |
+
|
3067 |
j = 0;
|
3068 |
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
|
3069 |
+
|
3070 |
// Triggered event must either 1) have no namespace, or
|
3071 |
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
|
3072 |
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
|
3073 |
+
|
3074 |
event.handleObj = handleObj;
|
3075 |
event.data = handleObj.data;
|
3076 |
+
|
3077 |
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
|
3078 |
.apply( matched.elem, args );
|
3079 |
+
|
3080 |
if ( ret !== undefined ) {
|
3081 |
if ( (event.result = ret) === false ) {
|
3082 |
event.preventDefault();
|
3086 |
}
|
3087 |
}
|
3088 |
}
|
3089 |
+
|
3090 |
// Call the postDispatch hook for the mapped type
|
3091 |
if ( special.postDispatch ) {
|
3092 |
special.postDispatch.call( this, event );
|
3093 |
}
|
3094 |
+
|
3095 |
return event.result;
|
3096 |
},
|
3097 |
+
|
3098 |
handlers: function( event, handlers ) {
|
3099 |
var sel, handleObj, matches, i,
|
3100 |
handlerQueue = [],
|
3101 |
delegateCount = handlers.delegateCount,
|
3102 |
cur = event.target;
|
3103 |
+
|
3104 |
// Find delegate handlers
|
3105 |
// Black-hole SVG <use> instance trees (#13180)
|
3106 |
// Avoid non-left-click bubbling in Firefox (#3861)
|
3107 |
if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
|
3108 |
+
|
3109 |
for ( ; cur != this; cur = cur.parentNode || this ) {
|
3110 |
+
|
3111 |
// Don't check non-elements (#13208)
|
3112 |
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
|
3113 |
if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
|
3114 |
matches = [];
|
3115 |
for ( i = 0; i < delegateCount; i++ ) {
|
3116 |
handleObj = handlers[ i ];
|
3117 |
+
|
3118 |
// Don't conflict with Object.prototype properties (#13203)
|
3119 |
sel = handleObj.selector + " ";
|
3120 |
+
|
3121 |
if ( matches[ sel ] === undefined ) {
|
3122 |
matches[ sel ] = handleObj.needsContext ?
|
3123 |
jQuery( sel, this ).index( cur ) >= 0 :
|
3133 |
}
|
3134 |
}
|
3135 |
}
|
3136 |
+
|
3137 |
// Add the remaining (directly-bound) handlers
|
3138 |
if ( delegateCount < handlers.length ) {
|
3139 |
handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
|
3140 |
}
|
3141 |
+
|
3142 |
return handlerQueue;
|
3143 |
},
|
3144 |
+
|
3145 |
fix: function( event ) {
|
3146 |
if ( event[ jQuery.expando ] ) {
|
3147 |
return event;
|
3148 |
}
|
3149 |
+
|
3150 |
// Create a writable copy of the event object and normalize some properties
|
3151 |
var i, prop, copy,
|
3152 |
type = event.type,
|
3153 |
originalEvent = event,
|
3154 |
fixHook = this.fixHooks[ type ];
|
3155 |
+
|
3156 |
if ( !fixHook ) {
|
3157 |
this.fixHooks[ type ] = fixHook =
|
3158 |
rmouseEvent.test( type ) ? this.mouseHooks :
|
3160 |
{};
|
3161 |
}
|
3162 |
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
|
3163 |
+
|
3164 |
event = new jQuery.Event( originalEvent );
|
3165 |
+
|
3166 |
i = copy.length;
|
3167 |
while ( i-- ) {
|
3168 |
prop = copy[ i ];
|
3169 |
event[ prop ] = originalEvent[ prop ];
|
3170 |
}
|
3171 |
+
|
3172 |
// Support: IE<9
|
3173 |
// Fix target property (#1925)
|
3174 |
if ( !event.target ) {
|
3175 |
event.target = originalEvent.srcElement || document;
|
3176 |
}
|
3177 |
+
|
3178 |
// Support: Chrome 23+, Safari?
|
3179 |
// Target should not be a text node (#504, #13143)
|
3180 |
if ( event.target.nodeType === 3 ) {
|
3181 |
event.target = event.target.parentNode;
|
3182 |
}
|
3183 |
+
|
3184 |
// Support: IE<9
|
3185 |
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
|
3186 |
event.metaKey = !!event.metaKey;
|
3187 |
+
|
3188 |
return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
|
3189 |
},
|
3190 |
+
|
3191 |
// Includes some event props shared by KeyEvent and MouseEvent
|
3192 |
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
|
3193 |
+
|
3194 |
fixHooks: {},
|
3195 |
+
|
3196 |
keyHooks: {
|
3197 |
props: "char charCode key keyCode".split(" "),
|
3198 |
filter: function( event, original ) {
|
3199 |
+
|
3200 |
// Add which for key events
|
3201 |
if ( event.which == null ) {
|
3202 |
event.which = original.charCode != null ? original.charCode : original.keyCode;
|
3203 |
}
|
3204 |
+
|
3205 |
return event;
|
3206 |
}
|
3207 |
},
|
3208 |
+
|
3209 |
mouseHooks: {
|
3210 |
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
|
3211 |
filter: function( event, original ) {
|
3212 |
var body, eventDoc, doc,
|
3213 |
button = original.button,
|
3214 |
fromElement = original.fromElement;
|
3215 |
+
|
3216 |
// Calculate pageX/Y if missing and clientX/Y available
|
3217 |
if ( event.pageX == null && original.clientX != null ) {
|
3218 |
eventDoc = event.target.ownerDocument || document;
|
3219 |
doc = eventDoc.documentElement;
|
3220 |
body = eventDoc.body;
|
3221 |
+
|
3222 |
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
|
3223 |
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
|
3224 |
}
|
3225 |
+
|
3226 |
// Add relatedTarget, if necessary
|
3227 |
if ( !event.relatedTarget && fromElement ) {
|
3228 |
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
|
3229 |
}
|
3230 |
+
|
3231 |
// Add which for click: 1 === left; 2 === middle; 3 === right
|
3232 |
// Note: button is not normalized, so don't use it
|
3233 |
if ( !event.which && button !== undefined ) {
|
3234 |
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
|
3235 |
}
|
3236 |
+
|
3237 |
return event;
|
3238 |
}
|
3239 |
},
|
3240 |
+
|
3241 |
special: {
|
3242 |
load: {
|
3243 |
// Prevent triggered image.load events from bubbling to window.load
|
3277 |
},
|
3278 |
delegateType: "focusout"
|
3279 |
},
|
3280 |
+
|
3281 |
beforeunload: {
|
3282 |
postDispatch: function( event ) {
|
3283 |
+
|
3284 |
// Even when returnValue equals to undefined Firefox will still show alert
|
3285 |
if ( event.result !== undefined ) {
|
3286 |
event.originalEvent.returnValue = event.result;
|
3288 |
}
|
3289 |
}
|
3290 |
},
|
3291 |
+
|
3292 |
simulate: function( type, elem, event, bubble ) {
|
3293 |
// Piggyback on a donor event to simulate a different one.
|
3294 |
// Fake originalEvent to avoid donor's stopPropagation, but if the
|
3311 |
}
|
3312 |
}
|
3313 |
};
|
3314 |
+
|
3315 |
jQuery.removeEvent = document.removeEventListener ?
|
3316 |
function( elem, type, handle ) {
|
3317 |
if ( elem.removeEventListener ) {
|
3320 |
} :
|
3321 |
function( elem, type, handle ) {
|
3322 |
var name = "on" + type;
|
3323 |
+
|
3324 |
if ( elem.detachEvent ) {
|
3325 |
+
|
3326 |
// #8545, #7054, preventing memory leaks for custom events in IE6-8
|
3327 |
// detachEvent needed property on element, by name of that event, to properly expose it to GC
|
3328 |
if ( typeof elem[ name ] === core_strundefined ) {
|
3329 |
elem[ name ] = null;
|
3330 |
}
|
3331 |
+
|
3332 |
elem.detachEvent( name, handle );
|
3333 |
}
|
3334 |
};
|
3335 |
+
|
3336 |
jQuery.Event = function( src, props ) {
|
3337 |
// Allow instantiation without the 'new' keyword
|
3338 |
if ( !(this instanceof jQuery.Event) ) {
|
3339 |
return new jQuery.Event( src, props );
|
3340 |
}
|
3341 |
+
|
3342 |
// Event object
|
3343 |
if ( src && src.type ) {
|
3344 |
this.originalEvent = src;
|
3345 |
this.type = src.type;
|
3346 |
+
|
3347 |
// Events bubbling up the document may have been marked as prevented
|
3348 |
// by a handler lower down the tree; reflect the correct value.
|
3349 |
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
|
3350 |
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
|
3351 |
+
|
3352 |
// Event type
|
3353 |
} else {
|
3354 |
this.type = src;
|
3355 |
}
|
3356 |
+
|
3357 |
// Put explicitly provided properties onto the event object
|
3358 |
if ( props ) {
|
3359 |
jQuery.extend( this, props );
|
3360 |
}
|
3361 |
+
|
3362 |
// Create a timestamp if incoming event doesn't have one
|
3363 |
this.timeStamp = src && src.timeStamp || jQuery.now();
|
3364 |
+
|
3365 |
// Mark it as fixed
|
3366 |
this[ jQuery.expando ] = true;
|
3367 |
};
|
3368 |
+
|
3369 |
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
|
3370 |
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
|
3371 |
jQuery.Event.prototype = {
|
3372 |
isDefaultPrevented: returnFalse,
|
3373 |
isPropagationStopped: returnFalse,
|
3374 |
isImmediatePropagationStopped: returnFalse,
|
3375 |
+
|
3376 |
preventDefault: function() {
|
3377 |
var e = this.originalEvent;
|
3378 |
+
|
3379 |
this.isDefaultPrevented = returnTrue;
|
3380 |
if ( !e ) {
|
3381 |
return;
|
3382 |
}
|
3383 |
+
|
3384 |
// If preventDefault exists, run it on the original event
|
3385 |
if ( e.preventDefault ) {
|
3386 |
e.preventDefault();
|
3387 |
+
|
3388 |
// Support: IE
|
3389 |
// Otherwise set the returnValue property of the original event to false
|
3390 |
} else {
|
3393 |
},
|
3394 |
stopPropagation: function() {
|
3395 |
var e = this.originalEvent;
|
3396 |
+
|
3397 |
this.isPropagationStopped = returnTrue;
|
3398 |
if ( !e ) {
|
3399 |
return;
|
3402 |
if ( e.stopPropagation ) {
|
3403 |
e.stopPropagation();
|
3404 |
}
|
3405 |
+
|
3406 |
// Support: IE
|
3407 |
// Set the cancelBubble property of the original event to true
|
3408 |
e.cancelBubble = true;
|
3412 |
this.stopPropagation();
|
3413 |
}
|
3414 |
};
|
3415 |
+
|
3416 |
// Create mouseenter/leave events using mouseover/out and event-time checks
|
3417 |
jQuery.each({
|
3418 |
mouseenter: "mouseover",
|
3421 |
jQuery.event.special[ orig ] = {
|
3422 |
delegateType: fix,
|
3423 |
bindType: fix,
|
3424 |
+
|
3425 |
handle: function( event ) {
|
3426 |
var ret,
|
3427 |
target = this,
|
3428 |
related = event.relatedTarget,
|
3429 |
handleObj = event.handleObj;
|
3430 |
+
|
3431 |
// For mousenter/leave call the handler if related is outside the target.
|
3432 |
// NB: No relatedTarget if the mouse left/entered the browser window
|
3433 |
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
|
3439 |
}
|
3440 |
};
|
3441 |
});
|
3442 |
+
|
3443 |
// IE submit delegation
|
3444 |
if ( !jQuery.support.submitBubbles ) {
|
3445 |
+
|
3446 |
jQuery.event.special.submit = {
|
3447 |
setup: function() {
|
3448 |
// Only need this for delegated form submit events
|
3449 |
if ( jQuery.nodeName( this, "form" ) ) {
|
3450 |
return false;
|
3451 |
}
|
3452 |
+
|
3453 |
// Lazy-add a submit handler when a descendant form may potentially be submitted
|
3454 |
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
|
3455 |
// Node name check avoids a VML-related crash in IE (#9807)
|
3464 |
});
|
3465 |
// return undefined since we don't need an event listener
|
3466 |
},
|
3467 |
+
|
3468 |
postDispatch: function( event ) {
|
3469 |
// If form was submitted by the user, bubble the event up the tree
|
3470 |
if ( event._submit_bubble ) {
|
3474 |
}
|
3475 |
}
|
3476 |
},
|
3477 |
+
|
3478 |
teardown: function() {
|
3479 |
// Only need this for delegated form submit events
|
3480 |
if ( jQuery.nodeName( this, "form" ) ) {
|
3481 |
return false;
|
3482 |
}
|
3483 |
+
|
3484 |
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
|
3485 |
jQuery.event.remove( this, "._submit" );
|
3486 |
}
|
3487 |
};
|
3488 |
}
|
3489 |
+
|
3490 |
// IE change delegation and checkbox/radio fix
|
3491 |
if ( !jQuery.support.changeBubbles ) {
|
3492 |
+
|
3493 |
jQuery.event.special.change = {
|
3494 |
+
|
3495 |
setup: function() {
|
3496 |
+
|
3497 |
if ( rformElems.test( this.nodeName ) ) {
|
3498 |
// IE doesn't fire change on a check/radio until blur; trigger it on click
|
3499 |
// after a propertychange. Eat the blur-change in special.change.handle.
|
3517 |
// Delegated event; lazy-add a change handler on descendant inputs
|
3518 |
jQuery.event.add( this, "beforeactivate._change", function( e ) {
|
3519 |
var elem = e.target;
|
3520 |
+
|
3521 |
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
|
3522 |
jQuery.event.add( elem, "change._change", function( event ) {
|
3523 |
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
|
3528 |
}
|
3529 |
});
|
3530 |
},
|
3531 |
+
|
3532 |
handle: function( event ) {
|
3533 |
var elem = event.target;
|
3534 |
+
|
3535 |
// Swallow native change events from checkbox/radio, we already triggered them above
|
3536 |
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
|
3537 |
return event.handleObj.handler.apply( this, arguments );
|
3538 |
}
|
3539 |
},
|
3540 |
+
|
3541 |
teardown: function() {
|
3542 |
jQuery.event.remove( this, "._change" );
|
3543 |
+
|
3544 |
return !rformElems.test( this.nodeName );
|
3545 |
}
|
3546 |
};
|
3547 |
}
|
3548 |
+
|
3549 |
// Create "bubbling" focus and blur events
|
3550 |
if ( !jQuery.support.focusinBubbles ) {
|
3551 |
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
|
3552 |
+
|
3553 |
// Attach a single capturing handler while someone wants focusin/focusout
|
3554 |
var attaches = 0,
|
3555 |
handler = function( event ) {
|
3556 |
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
|
3557 |
};
|
3558 |
+
|
3559 |
jQuery.event.special[ fix ] = {
|
3560 |
setup: function() {
|
3561 |
if ( attaches++ === 0 ) {
|
3570 |
};
|
3571 |
});
|
3572 |
}
|
3573 |
+
|
3574 |
jQuery.fn.extend({
|
3575 |
+
|
3576 |
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
|
3577 |
var type, origFn;
|
3578 |
+
|
3579 |
// Types can be a map of types/handlers
|
3580 |
if ( typeof types === "object" ) {
|
3581 |
// ( types-Object, selector, data )
|
3589 |
}
|
3590 |
return this;
|
3591 |
}
|
3592 |
+
|
3593 |
if ( data == null && fn == null ) {
|
3594 |
// ( types, fn )
|
3595 |
fn = selector;
|
3611 |
} else if ( !fn ) {
|
3612 |
return this;
|
3613 |
}
|
3614 |
+
|
3615 |
if ( one === 1 ) {
|
3616 |
origFn = fn;
|
3617 |
fn = function( event ) {
|
3660 |
jQuery.event.remove( this, types, fn, selector );
|
3661 |
});
|
3662 |
},
|
3663 |
+
|
3664 |
bind: function( types, data, fn ) {
|
3665 |
return this.on( types, null, data, fn );
|
3666 |
},
|
3667 |
unbind: function( types, fn ) {
|
3668 |
return this.off( types, null, fn );
|
3669 |
},
|
3670 |
+
|
3671 |
delegate: function( selector, types, data, fn ) {
|
3672 |
return this.on( types, selector, data, fn );
|
3673 |
},
|
3675 |
// ( namespace ) or ( selector, types [, fn] )
|
3676 |
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
|
3677 |
},
|
3678 |
+
|
3679 |
trigger: function( type, data ) {
|
3680 |
return this.each(function() {
|
3681 |
jQuery.event.trigger( type, data, this );
|
3695 |
* http://sizzlejs.com/
|
3696 |
*/
|
3697 |
(function( window, undefined ) {
|
3698 |
+
|
3699 |
var i,
|
3700 |
cachedruns,
|
3701 |
Expr,
|
3704 |
compile,
|
3705 |
hasDuplicate,
|
3706 |
outermostContext,
|
3707 |
+
|
3708 |
// Local document vars
|
3709 |
setDocument,
|
3710 |
document,
|
3715 |
matches,
|
3716 |
contains,
|
3717 |
sortOrder,
|
3718 |
+
|
3719 |
// Instance-specific data
|
3720 |
expando = "sizzle" + -(new Date()),
|
3721 |
preferredDoc = window.document,
|
3725 |
classCache = createCache(),
|
3726 |
tokenCache = createCache(),
|
3727 |
compilerCache = createCache(),
|
3728 |
+
|
3729 |
// General-purpose constants
|
3730 |
strundefined = typeof undefined,
|
3731 |
MAX_NEGATIVE = 1 << 31,
|
3732 |
+
|
3733 |
// Array methods
|
3734 |
arr = [],
|
3735 |
pop = arr.pop,
|
3746 |
}
|
3747 |
return -1;
|
3748 |
},
|
3749 |
+
|
3750 |
+
|
3751 |
// Regular expressions
|
3752 |
+
|
3753 |
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
|
3754 |
whitespace = "[\\x20\\t\\r\\n\\f]",
|
3755 |
// http://www.w3.org/TR/css3-syntax/#characters
|
3756 |
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
|
3757 |
+
|
3758 |
// Loosely modeled on CSS identifier characters
|
3759 |
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
|
3760 |
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
|
3761 |
identifier = characterEncoding.replace( "w", "w#" ),
|
3762 |
+
|
3763 |
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
|
3764 |
operators = "([*^$|!~]?=)",
|
3765 |
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
|
3766 |
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
|
3767 |
+
|
3768 |
// Prefer arguments quoted,
|
3769 |
// then not containing pseudos/brackets,
|
3770 |
// then attribute selectors/non-parenthetical expressions,
|
3772 |
// These preferences are here to reduce the number of selectors
|
3773 |
// needing tokenize in the PSEUDO preFilter
|
3774 |
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
|
3775 |
+
|
3776 |
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
|
3777 |
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
|
3778 |
+
|
3779 |
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
|
3780 |
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
|
3781 |
rpseudo = new RegExp( pseudos ),
|
3782 |
ridentifier = new RegExp( "^" + identifier + "$" ),
|
3783 |
+
|
3784 |
matchExpr = {
|
3785 |
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
|
3786 |
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
|
3796 |
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
|
3797 |
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
|
3798 |
},
|
3799 |
+
|
3800 |
rsibling = /[\x20\t\r\n\f]*[+~]/,
|
3801 |
+
|
3802 |
rnative = /^[^{]+\{\s*\[native code/,
|
3803 |
+
|
3804 |
// Easily-parseable/retrievable ID or TAG or CLASS selectors
|
3805 |
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
|
3806 |
+
|
3807 |
rinputs = /^(?:input|select|textarea|button)$/i,
|
3808 |
rheader = /^h\d$/i,
|
3809 |
+
|
3810 |
rescape = /'|\\/g,
|
3811 |
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
|
3812 |
+
|
3813 |
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
|
3814 |
runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
|
3815 |
funescape = function( _, escaped ) {
|
3823 |
// Supplemental Plane codepoint (surrogate pair)
|
3824 |
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
|
3825 |
};
|
3826 |
+
|
3827 |
// Use a stripped-down slice if we can't use a native one
|
3828 |
try {
|
3829 |
slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
|
3837 |
return results;
|
3838 |
};
|
3839 |
}
|
3840 |
+
|
3841 |
/**
|
3842 |
* For feature detection
|
3843 |
* @param {Function} fn The function to test for native support
|
3845 |
function isNative( fn ) {
|
3846 |
return rnative.test( fn + "" );
|
3847 |
}
|
3848 |
+
|
3849 |
/**
|
3850 |
* Create key-value caches of limited size
|
3851 |
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
|
3855 |
function createCache() {
|
3856 |
var cache,
|
3857 |
keys = [];
|
3858 |
+
|
3859 |
return (cache = function( key, value ) {
|
3860 |
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
|
3861 |
if ( keys.push( key += " " ) > Expr.cacheLength ) {
|
3865 |
return (cache[ key ] = value);
|
3866 |
});
|
3867 |
}
|
3868 |
+
|
3869 |
/**
|
3870 |
* Mark a function for special use by Sizzle
|
3871 |
* @param {Function} fn The function to mark
|
3874 |
fn[ expando ] = true;
|
3875 |
return fn;
|
3876 |
}
|
3877 |
+
|
3878 |
/**
|
3879 |
* Support testing using an element
|
3880 |
* @param {Function} fn Passed the created div and expects a boolean result
|
3881 |
*/
|
3882 |
function assert( fn ) {
|
3883 |
var div = document.createElement("div");
|
3884 |
+
|
3885 |
try {
|
3886 |
return fn( div );
|
3887 |
} catch (e) {
|
3891 |
div = null;
|
3892 |
}
|
3893 |
}
|
3894 |
+
|
3895 |
function Sizzle( selector, context, results, seed ) {
|
3896 |
var match, elem, m, nodeType,
|
3897 |
// QSA vars
|
3898 |
i, groups, old, nid, newContext, newSelector;
|
3899 |
+
|
3900 |
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
|
3901 |
setDocument( context );
|
3902 |
}
|
3903 |
+
|
3904 |
context = context || document;
|
3905 |
results = results || [];
|
3906 |
+
|
3907 |
if ( !selector || typeof selector !== "string" ) {
|
3908 |
return results;
|
3909 |
}
|
3910 |
+
|
3911 |
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
|
3912 |
return [];
|
3913 |
}
|
3914 |
+
|
3915 |
if ( !documentIsXML && !seed ) {
|
3916 |
+
|
3917 |
// Shortcuts
|
3918 |
if ( (match = rquickExpr.exec( selector )) ) {
|
3919 |
// Speed-up: Sizzle("#ID")
|
3940 |
return results;
|
3941 |
}
|
3942 |
}
|
3943 |
+
|
3944 |
// Speed-up: Sizzle("TAG")
|
3945 |
} else if ( match[2] ) {
|
3946 |
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
|
3947 |
return results;
|
3948 |
+
|
3949 |
// Speed-up: Sizzle(".CLASS")
|
3950 |
} else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
|
3951 |
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
|
3952 |
return results;
|
3953 |
}
|
3954 |
}
|
3955 |
+
|
3956 |
// QSA path
|
3957 |
if ( support.qsa && !rbuggyQSA.test(selector) ) {
|
3958 |
old = true;
|
3959 |
nid = expando;
|
3960 |
newContext = context;
|
3961 |
newSelector = nodeType === 9 && selector;
|
3962 |
+
|
3963 |
// qSA works strangely on Element-rooted queries
|
3964 |
// We can work around this by specifying an extra ID on the root
|
3965 |
// and working up from there (Thanks to Andrew Dupont for the technique)
|
3966 |
// IE 8 doesn't work on object elements
|
3967 |
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
|
3968 |
groups = tokenize( selector );
|
3969 |
+
|
3970 |
if ( (old = context.getAttribute("id")) ) {
|
3971 |
nid = old.replace( rescape, "\\$&" );
|
3972 |
} else {
|
3973 |
context.setAttribute( "id", nid );
|
3974 |
}
|
3975 |
nid = "[id='" + nid + "'] ";
|
3976 |
+
|
3977 |
i = groups.length;
|
3978 |
while ( i-- ) {
|
3979 |
groups[i] = nid + toSelector( groups[i] );
|
3981 |
newContext = rsibling.test( selector ) && context.parentNode || context;
|
3982 |
newSelector = groups.join(",");
|
3983 |
}
|
3984 |
+
|
3985 |
if ( newSelector ) {
|
3986 |
try {
|
3987 |
push.apply( results, slice.call( newContext.querySelectorAll(
|
3997 |
}
|
3998 |
}
|
3999 |
}
|
4000 |
+
|
4001 |
// All others
|
4002 |
return select( selector.replace( rtrim, "$1" ), context, results, seed );
|
4003 |
}
|
4004 |
+
|
4005 |
/**
|
4006 |
* Detect xml
|
4007 |
* @param {Element|Object} elem An element or a document
|
4012 |
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
|
4013 |
return documentElement ? documentElement.nodeName !== "HTML" : false;
|
4014 |
};
|
4015 |
+
|
4016 |
/**
|
4017 |
* Sets document-related variables once based on the current document
|
4018 |
* @param {Element|Object} [doc] An element or document object to use to set the document
|
4020 |
*/
|
4021 |
setDocument = Sizzle.setDocument = function( node ) {
|
4022 |
var doc = node ? node.ownerDocument || node : preferredDoc;
|
4023 |
+
|
4024 |
// If no document and documentElement is available, return
|
4025 |
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
|
4026 |
return document;
|
4027 |
}
|
4028 |
+
|
4029 |
// Set our document
|
4030 |
document = doc;
|
4031 |
docElem = doc.documentElement;
|
4032 |
+
|
4033 |
// Support tests
|
4034 |
documentIsXML = isXML( doc );
|
4035 |
+
|
4036 |
// Check if getElementsByTagName("*") returns only elements
|
4037 |
support.tagNameNoComments = assert(function( div ) {
|
4038 |
div.appendChild( doc.createComment("") );
|
4039 |
return !div.getElementsByTagName("*").length;
|
4040 |
});
|
4041 |
+
|
4042 |
// Check if attributes should be retrieved by attribute nodes
|
4043 |
support.attributes = assert(function( div ) {
|
4044 |
div.innerHTML = "<select></select>";
|
4046 |
// IE8 returns a string for some attributes even when not present
|
4047 |
return type !== "boolean" && type !== "string";
|
4048 |
});
|
4049 |
+
|
4050 |
// Check if getElementsByClassName can be trusted
|
4051 |
support.getByClassName = assert(function( div ) {
|
4052 |
// Opera can't find a second classname (in 9.6)
|
4054 |
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
|
4055 |
return false;
|
4056 |
}
|
4057 |
+
|
4058 |
// Safari 3.2 caches class attributes and doesn't catch changes
|
4059 |
div.lastChild.className = "e";
|
4060 |
return div.getElementsByClassName("e").length === 2;
|
4061 |
});
|
4062 |
+
|
4063 |
// Check if getElementById returns elements by name
|
4064 |
// Check if getElementsByName privileges form controls or returns elements by ID
|
4065 |
support.getByName = assert(function( div ) {
|
4067 |
div.id = expando + 0;
|
4068 |
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
|
4069 |
docElem.insertBefore( div, docElem.firstChild );
|
4070 |
+
|
4071 |
// Test
|
4072 |
var pass = doc.getElementsByName &&
|
4073 |
// buggy browsers will return fewer than the correct 2
|
4075 |
// buggy browsers will return more than the correct 0
|
4076 |
doc.getElementsByName( expando + 0 ).length;
|
4077 |
support.getIdNotName = !doc.getElementById( expando );
|
4078 |
+
|
4079 |
// Cleanup
|
4080 |
docElem.removeChild( div );
|
4081 |
+
|
4082 |
return pass;
|
4083 |
});
|
4084 |
+
|
4085 |
// IE6/7 return modified attributes
|
4086 |
Expr.attrHandle = assert(function( div ) {
|
4087 |
div.innerHTML = "<a href='#'></a>";
|
4097 |
return elem.getAttribute("type");
|
4098 |
}
|
4099 |
};
|
4100 |
+
|
4101 |
// ID find and filter
|
4102 |
if ( support.getIdNotName ) {
|
4103 |
Expr.find["ID"] = function( id, context ) {
|
4118 |
Expr.find["ID"] = function( id, context ) {
|
4119 |
if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
|
4120 |
var m = context.getElementById( id );
|
4121 |
+
|
4122 |
return m ?
|
4123 |
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
|
4124 |
[m] :
|
4134 |
};
|
4135 |
};
|
4136 |
}
|
4137 |
+
|
4138 |
// Tag
|
4139 |
Expr.find["TAG"] = support.tagNameNoComments ?
|
4140 |
function( tag, context ) {
|
4147 |
tmp = [],
|
4148 |
i = 0,
|
4149 |
results = context.getElementsByTagName( tag );
|
4150 |
+
|
4151 |
// Filter out possible comments
|
4152 |
if ( tag === "*" ) {
|
4153 |
while ( (elem = results[i++]) ) {
|
4155 |
tmp.push( elem );
|
4156 |
}
|
4157 |
}
|
4158 |
+
|
4159 |
return tmp;
|
4160 |
}
|
4161 |
return results;
|
4162 |
};
|
4163 |
+
|
4164 |
// Name
|
4165 |
Expr.find["NAME"] = support.getByName && function( tag, context ) {
|
4166 |
if ( typeof context.getElementsByName !== strundefined ) {
|
4167 |
return context.getElementsByName( name );
|
4168 |
}
|
4169 |
};
|
4170 |
+
|
4171 |
// Class
|
4172 |
Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
|
4173 |
if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
|
4174 |
return context.getElementsByClassName( className );
|
4175 |
}
|
4176 |
};
|
4177 |
+
|
4178 |
// QSA and matchesSelector support
|
4179 |
+
|
4180 |
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
|
4181 |
rbuggyMatches = [];
|
4182 |
+
|
4183 |
// qSa(:focus) reports false when true (Chrome 21),
|
4184 |
// no need to also add to buggyMatches since matches checks buggyQSA
|
4185 |
// A support test would require too much code (would include document ready)
|
4186 |
rbuggyQSA = [ ":focus" ];
|
4187 |
+
|
4188 |
if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
|
4189 |
// Build QSA regex
|
4190 |
// Regex strategy adopted from Diego Perini
|
4195 |
// since its presence should be enough
|
4196 |
// http://bugs.jquery.com/ticket/12359
|
4197 |
div.innerHTML = "<select><option selected=''></option></select>";
|
4198 |
+
|
4199 |
// IE8 - Some boolean attributes are not treated correctly
|
4200 |
if ( !div.querySelectorAll("[selected]").length ) {
|
4201 |
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
|
4202 |
}
|
4203 |
+
|
4204 |
// Webkit/Opera - :checked should return selected option elements
|
4205 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
4206 |
// IE8 throws error here and will not see later tests
|
4208 |
rbuggyQSA.push(":checked");
|
4209 |
}
|
4210 |
});
|
4211 |
+
|
4212 |
assert(function( div ) {
|
4213 |
+
|
4214 |
// Opera 10-12/IE8 - ^= $= *= and empty values
|
4215 |
// Should not select anything
|
4216 |
div.innerHTML = "<input type='hidden' i=''/>";
|
4217 |
if ( div.querySelectorAll("[i^='']").length ) {
|
4218 |
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
|
4219 |
}
|
4220 |
+
|
4221 |
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
|
4222 |
// IE8 throws error here and will not see later tests
|
4223 |
if ( !div.querySelectorAll(":enabled").length ) {
|
4224 |
rbuggyQSA.push( ":enabled", ":disabled" );
|
4225 |
}
|
4226 |
+
|
4227 |
// Opera 10-11 does not throw on post-comma invalid pseudos
|
4228 |
div.querySelectorAll("*,:x");
|
4229 |
rbuggyQSA.push(",.*:");
|
4230 |
});
|
4231 |
}
|
4232 |
+
|
4233 |
if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
|
4234 |
docElem.mozMatchesSelector ||
|
4235 |
docElem.webkitMatchesSelector ||
|
4236 |
docElem.oMatchesSelector ||
|
4237 |
docElem.msMatchesSelector) )) ) {
|
4238 |
+
|
4239 |
assert(function( div ) {
|
4240 |
// Check to see if it's possible to do matchesSelector
|
4241 |
// on a disconnected node (IE 9)
|
4242 |
support.disconnectedMatch = matches.call( div, "div" );
|
4243 |
+
|
4244 |
// This should fail with an exception
|
4245 |
// Gecko does not error, returns false instead
|
4246 |
matches.call( div, "[s!='']:x" );
|
4247 |
rbuggyMatches.push( "!=", pseudos );
|
4248 |
});
|
4249 |
}
|
4250 |
+
|
4251 |
rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
|
4252 |
rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
|
4253 |
+
|
4254 |
// Element contains another
|
4255 |
// Purposefully does not implement inclusive descendent
|
4256 |
// As in, an element does not contain itself
|
4274 |
}
|
4275 |
return false;
|
4276 |
};
|
4277 |
+
|
4278 |
// Document order sorting
|
4279 |
sortOrder = docElem.compareDocumentPosition ?
|
4280 |
function( a, b ) {
|
4281 |
var compare;
|
4282 |
+
|
4283 |
if ( a === b ) {
|
4284 |
hasDuplicate = true;
|
4285 |
return 0;
|
4286 |
}
|
4287 |
+
|
4288 |
if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
|
4289 |
if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
|
4290 |
if ( a === doc || contains( preferredDoc, a ) ) {
|
4297 |
}
|
4298 |
return compare & 4 ? -1 : 1;
|
4299 |
}
|
4300 |
+
|
4301 |
return a.compareDocumentPosition ? -1 : 1;
|
4302 |
} :
|
4303 |
function( a, b ) {
|
4307 |
bup = b.parentNode,
|
4308 |
ap = [ a ],
|
4309 |
bp = [ b ];
|
4310 |
+
|
4311 |
// Exit early if the nodes are identical
|
4312 |
if ( a === b ) {
|
4313 |
hasDuplicate = true;
|
4314 |
return 0;
|
4315 |
+
|
4316 |
// Parentless nodes are either documents or disconnected
|
4317 |
} else if ( !aup || !bup ) {
|
4318 |
return a === doc ? -1 :
|
4320 |
aup ? -1 :
|
4321 |
bup ? 1 :
|
4322 |
0;
|
4323 |
+
|
4324 |
// If the nodes are siblings, we can do a quick check
|
4325 |
} else if ( aup === bup ) {
|
4326 |
return siblingCheck( a, b );
|
4327 |
}
|
4328 |
+
|
4329 |
// Otherwise we need full lists of their ancestors for comparison
|
4330 |
cur = a;
|
4331 |
while ( (cur = cur.parentNode) ) {
|
4335 |
while ( (cur = cur.parentNode) ) {
|
4336 |
bp.unshift( cur );
|
4337 |
}
|
4338 |
+
|
4339 |
// Walk down the tree looking for a discrepancy
|
4340 |
while ( ap[i] === bp[i] ) {
|
4341 |
i++;
|
4342 |
}
|
4343 |
+
|
4344 |
return i ?
|
4345 |
// Do a sibling check if the nodes have a common ancestor
|
4346 |
siblingCheck( ap[i], bp[i] ) :
|
4347 |
+
|
4348 |
// Otherwise nodes in our document sort first
|
4349 |
ap[i] === preferredDoc ? -1 :
|
4350 |
bp[i] === preferredDoc ? 1 :
|
4351 |
0;
|
4352 |
};
|
4353 |
+
|
4354 |
// Always assume the presence of duplicates if sort doesn't
|
4355 |
// pass them to our comparison function (as in Google Chrome).
|
4356 |
hasDuplicate = false;
|
4357 |
[0, 0].sort( sortOrder );
|
4358 |
support.detectDuplicates = hasDuplicate;
|
4359 |
+
|
4360 |
return document;
|
4361 |
};
|
4362 |
+
|
4363 |
Sizzle.matches = function( expr, elements ) {
|
4364 |
return Sizzle( expr, null, null, elements );
|
4365 |
};
|
4366 |
+
|
4367 |
Sizzle.matchesSelector = function( elem, expr ) {
|
4368 |
// Set document vars if needed
|
4369 |
if ( ( elem.ownerDocument || elem ) !== document ) {
|
4370 |
setDocument( elem );
|
4371 |
}
|
4372 |
+
|
4373 |
// Make sure that attribute selectors are quoted
|
4374 |
expr = expr.replace( rattributeQuotes, "='$1']" );
|
4375 |
+
|
4376 |
// rbuggyQSA always contains :focus, so no need for an existence check
|
4377 |
if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
|
4378 |
try {
|
4379 |
var ret = matches.call( elem, expr );
|
4380 |
+
|
4381 |
// IE 9's matchesSelector returns false on disconnected nodes
|
4382 |
if ( ret || support.disconnectedMatch ||
|
4383 |
// As well, disconnected nodes are said to be in a document
|
4387 |
}
|
4388 |
} catch(e) {}
|
4389 |
}
|
4390 |
+
|
4391 |
return Sizzle( expr, document, null, [elem] ).length > 0;
|
4392 |
};
|
4393 |
+
|
4394 |
Sizzle.contains = function( context, elem ) {
|
4395 |
// Set document vars if needed
|
4396 |
if ( ( context.ownerDocument || context ) !== document ) {
|
4398 |
}
|
4399 |
return contains( context, elem );
|
4400 |
};
|
4401 |
+
|
4402 |
Sizzle.attr = function( elem, name ) {
|
4403 |
var val;
|
4404 |
+
|
4405 |
// Set document vars if needed
|
4406 |
if ( ( elem.ownerDocument || elem ) !== document ) {
|
4407 |
setDocument( elem );
|
4408 |
}
|
4409 |
+
|
4410 |
if ( !documentIsXML ) {
|
4411 |
name = name.toLowerCase();
|
4412 |
}
|
4420 |
name :
|
4421 |
val && val.specified ? val.value : null;
|
4422 |
};
|
4423 |
+
|
4424 |
Sizzle.error = function( msg ) {
|
4425 |
throw new Error( "Syntax error, unrecognized expression: " + msg );
|
4426 |
};
|
4427 |
+
|
4428 |
// Document sorting and removing duplicates
|
4429 |
Sizzle.uniqueSort = function( results ) {
|
4430 |
var elem,
|
4431 |
duplicates = [],
|
4432 |
i = 1,
|
4433 |
j = 0;
|
4434 |
+
|
4435 |
// Unless we *know* we can detect duplicates, assume their presence
|
4436 |
hasDuplicate = !support.detectDuplicates;
|
4437 |
results.sort( sortOrder );
|
4438 |
+
|
4439 |
if ( hasDuplicate ) {
|
4440 |
for ( ; (elem = results[i]); i++ ) {
|
4441 |
if ( elem === results[ i - 1 ] ) {
|
4446 |
results.splice( duplicates[ j ], 1 );
|
4447 |
}
|
4448 |
}
|
4449 |
+
|
4450 |
return results;
|
4451 |
};
|
4452 |
+
|
4453 |
function siblingCheck( a, b ) {
|
4454 |
var cur = b && a,
|
4455 |
diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
|
4456 |
+
|
4457 |
// Use IE sourceIndex if available on both nodes
|
4458 |
if ( diff ) {
|
4459 |
return diff;
|
4460 |
}
|
4461 |
+
|
4462 |
// Check if b follows a
|
4463 |
if ( cur ) {
|
4464 |
while ( (cur = cur.nextSibling) ) {
|
4467 |
}
|
4468 |
}
|
4469 |
}
|
4470 |
+
|
4471 |
return a ? 1 : -1;
|
4472 |
}
|
4473 |
+
|
4474 |
// Returns a function to use in pseudos for input types
|
4475 |
function createInputPseudo( type ) {
|
4476 |
return function( elem ) {
|
4478 |
return name === "input" && elem.type === type;
|
4479 |
};
|
4480 |
}
|
4481 |
+
|
4482 |
// Returns a function to use in pseudos for buttons
|
4483 |
function createButtonPseudo( type ) {
|
4484 |
return function( elem ) {
|
4486 |
return (name === "input" || name === "button") && elem.type === type;
|
4487 |
};
|
4488 |
}
|
4489 |
+
|
4490 |
// Returns a function to use in pseudos for positionals
|
4491 |
function createPositionalPseudo( fn ) {
|
4492 |
return markFunction(function( argument ) {
|
4495 |
var j,
|
4496 |
matchIndexes = fn( [], seed.length, argument ),
|
4497 |
i = matchIndexes.length;
|
4498 |
+
|
4499 |
// Match elements found at the specified indexes
|
4500 |
while ( i-- ) {
|
4501 |
if ( seed[ (j = matchIndexes[i]) ] ) {
|
4505 |
});
|
4506 |
});
|
4507 |
}
|
4508 |
+
|
4509 |
/**
|
4510 |
* Utility function for retrieving the text value of an array of DOM nodes
|
4511 |
* @param {Array|Element} elem
|
4515 |
ret = "",
|
4516 |
i = 0,
|
4517 |
nodeType = elem.nodeType;
|
4518 |
+
|
4519 |
if ( !nodeType ) {
|
4520 |
// If no nodeType, this is expected to be an array
|
4521 |
for ( ; (node = elem[i]); i++ ) {
|
4537 |
return elem.nodeValue;
|
4538 |
}
|
4539 |
// Do not include comment or processing instruction nodes
|
4540 |
+
|
4541 |
return ret;
|
4542 |
};
|
4543 |
+
|
4544 |
Expr = Sizzle.selectors = {
|
4545 |
+
|
4546 |
// Can be adjusted by the user
|
4547 |
cacheLength: 50,
|
4548 |
+
|
4549 |
createPseudo: markFunction,
|
4550 |
+
|
4551 |
match: matchExpr,
|
4552 |
+
|
4553 |
find: {},
|
4554 |
+
|
4555 |
relative: {
|
4556 |
">": { dir: "parentNode", first: true },
|
4557 |
" ": { dir: "parentNode" },
|
4558 |
"+": { dir: "previousSibling", first: true },
|
4559 |
"~": { dir: "previousSibling" }
|
4560 |
},
|
4561 |
+
|
4562 |
preFilter: {
|
4563 |
"ATTR": function( match ) {
|
4564 |
match[1] = match[1].replace( runescape, funescape );
|
4565 |
+
|
4566 |
// Move the given value to match[3] whether quoted or unquoted
|
4567 |
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
|
4568 |
+
|
4569 |
if ( match[2] === "~=" ) {
|
4570 |
match[3] = " " + match[3] + " ";
|
4571 |
}
|
4572 |
+
|
4573 |
return match.slice( 0, 4 );
|
4574 |
},
|
4575 |
+
|
4576 |
"CHILD": function( match ) {
|
4577 |
/* matches from matchExpr["CHILD"]
|
4578 |
1 type (only|nth|...)
|
4585 |
8 y of y-component
|
4586 |
*/
|
4587 |
match[1] = match[1].toLowerCase();
|
4588 |
+
|
4589 |
if ( match[1].slice( 0, 3 ) === "nth" ) {
|
4590 |
// nth-* requires argument
|
4591 |
if ( !match[3] ) {
|
4592 |
Sizzle.error( match[0] );
|
4593 |
}
|
4594 |
+
|
4595 |
// numeric x and y parameters for Expr.filter.CHILD
|
4596 |
// remember that false/true cast respectively to 0/1
|
4597 |
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
|
4598 |
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
|
4599 |
+
|
4600 |
// other types prohibit arguments
|
4601 |
} else if ( match[3] ) {
|
4602 |
Sizzle.error( match[0] );
|
4603 |
}
|
4604 |
+
|
4605 |
return match;
|
4606 |
},
|
4607 |
+
|
4608 |
"PSEUDO": function( match ) {
|
4609 |
var excess,
|
4610 |
unquoted = !match[5] && match[2];
|
4611 |
+
|
4612 |
if ( matchExpr["CHILD"].test( match[0] ) ) {
|
4613 |
return null;
|
4614 |
}
|
4615 |
+
|
4616 |
// Accept quoted arguments as-is
|
4617 |
if ( match[4] ) {
|
4618 |
match[2] = match[4];
|
4619 |
+
|
4620 |
// Strip excess characters from unquoted arguments
|
4621 |
} else if ( unquoted && rpseudo.test( unquoted ) &&
|
4622 |
// Get excess from tokenize (recursively)
|
4623 |
(excess = tokenize( unquoted, true )) &&
|
4624 |
// advance to the next closing parenthesis
|
4625 |
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
|
4626 |
+
|
4627 |
// excess is a negative index
|
4628 |
match[0] = match[0].slice( 0, excess );
|
4629 |
match[2] = unquoted.slice( 0, excess );
|
4630 |
}
|
4631 |
+
|
4632 |
// Return only captures needed by the pseudo filter method (type and argument)
|
4633 |
return match.slice( 0, 3 );
|
4634 |
}
|
4635 |
},
|
4636 |
+
|
4637 |
filter: {
|
4638 |
+
|
4639 |
"TAG": function( nodeName ) {
|
4640 |
if ( nodeName === "*" ) {
|
4641 |
return function() { return true; };
|
4642 |
}
|
4643 |
+
|
4644 |
nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
|
4645 |
return function( elem ) {
|
4646 |
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
|
4647 |
};
|
4648 |
},
|
4649 |
+
|
4650 |
"CLASS": function( className ) {
|
4651 |
var pattern = classCache[ className + " " ];
|
4652 |
+
|
4653 |
return pattern ||
|
4654 |
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
|
4655 |
classCache( className, function( elem ) {
|
4656 |
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
|
4657 |
});
|
4658 |
},
|
4659 |
+
|
4660 |
"ATTR": function( name, operator, check ) {
|
4661 |
return function( elem ) {
|
4662 |
var result = Sizzle.attr( elem, name );
|
4663 |
+
|
4664 |
if ( result == null ) {
|
4665 |
return operator === "!=";
|
4666 |
}
|
4667 |
if ( !operator ) {
|
4668 |
return true;
|
4669 |
}
|
4670 |
+
|
4671 |
result += "";
|
4672 |
+
|
4673 |
return operator === "=" ? result === check :
|
4674 |
operator === "!=" ? result !== check :
|
4675 |
operator === "^=" ? check && result.indexOf( check ) === 0 :
|
4680 |
false;
|
4681 |
};
|
4682 |
},
|
4683 |
+
|
4684 |
"CHILD": function( type, what, argument, first, last ) {
|
4685 |
var simple = type.slice( 0, 3 ) !== "nth",
|
4686 |
forward = type.slice( -4 ) !== "last",
|
4687 |
ofType = what === "of-type";
|
4688 |
+
|
4689 |
return first === 1 && last === 0 ?
|
4690 |
+
|
4691 |
// Shortcut for :nth-*(n)
|
4692 |
function( elem ) {
|
4693 |
return !!elem.parentNode;
|
4694 |
} :
|
4695 |
+
|
4696 |
function( elem, context, xml ) {
|
4697 |
var cache, outerCache, node, diff, nodeIndex, start,
|
4698 |
dir = simple !== forward ? "nextSibling" : "previousSibling",
|
4699 |
parent = elem.parentNode,
|
4700 |
name = ofType && elem.nodeName.toLowerCase(),
|
4701 |
useCache = !xml && !ofType;
|
4702 |
+
|
4703 |
if ( parent ) {
|
4704 |
+
|
4705 |
// :(first|last|only)-(child|of-type)
|
4706 |
if ( simple ) {
|
4707 |
while ( dir ) {
|
4716 |
}
|
4717 |
return true;
|
4718 |
}
|
4719 |
+
|
4720 |
start = [ forward ? parent.firstChild : parent.lastChild ];
|
4721 |
+
|
4722 |
// non-xml :nth-child(...) stores cache data on `parent`
|
4723 |
if ( forward && useCache ) {
|
4724 |
// Seek `elem` from a previously-cached index
|
4727 |
nodeIndex = cache[0] === dirruns && cache[1];
|
4728 |
diff = cache[0] === dirruns && cache[2];
|
4729 |
node = nodeIndex && parent.childNodes[ nodeIndex ];
|
4730 |
+
|
4731 |
while ( (node = ++nodeIndex && node && node[ dir ] ||
|
4732 |
+
|
4733 |
// Fallback to seeking `elem` from the start
|
4734 |
(diff = nodeIndex = 0) || start.pop()) ) {
|
4735 |
+
|
4736 |
// When found, cache indexes on `parent` and break
|
4737 |
if ( node.nodeType === 1 && ++diff && node === elem ) {
|
4738 |
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
|
4739 |
break;
|
4740 |
}
|
4741 |
}
|
4742 |
+
|
4743 |
// Use previously-cached element index if available
|
4744 |
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
|
4745 |
diff = cache[1];
|
4746 |
+
|
4747 |
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
|
4748 |
} else {
|
4749 |
// Use the same loop as above to seek `elem` from the start
|
4750 |
while ( (node = ++nodeIndex && node && node[ dir ] ||
|
4751 |
(diff = nodeIndex = 0) || start.pop()) ) {
|
4752 |
+
|
4753 |
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
|
4754 |
// Cache the index of each encountered element
|
4755 |
if ( useCache ) {
|
4756 |
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
|
4757 |
}
|
4758 |
+
|
4759 |
if ( node === elem ) {
|
4760 |
break;
|
4761 |
}
|
4762 |
}
|
4763 |
}
|
4764 |
}
|
4765 |
+
|
4766 |
// Incorporate the offset, then check against cycle size
|
4767 |
diff -= last;
|
4768 |
return diff === first || ( diff % first === 0 && diff / first >= 0 );
|
4769 |
}
|
4770 |
};
|
4771 |
},
|
4772 |
+
|
4773 |
"PSEUDO": function( pseudo, argument ) {
|
4774 |
// pseudo-class names are case-insensitive
|
4775 |
// http://www.w3.org/TR/selectors/#pseudo-classes
|
4778 |
var args,
|
4779 |
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
|
4780 |
Sizzle.error( "unsupported pseudo: " + pseudo );
|
4781 |
+
|
4782 |
// The user may use createPseudo to indicate that
|
4783 |
// arguments are needed to create the filter function
|
4784 |
// just as Sizzle does
|
4785 |
if ( fn[ expando ] ) {
|
4786 |
return fn( argument );
|
4787 |
}
|
4788 |
+
|
4789 |
// But maintain support for old signatures
|
4790 |
if ( fn.length > 1 ) {
|
4791 |
args = [ pseudo, pseudo, "", argument ];
|
4803 |
return fn( elem, 0, args );
|
4804 |
};
|
4805 |
}
|
4806 |
+
|
4807 |
+
|
4808 |
return fn;
|
4809 |
}
|
4810 |
},
|
4811 |
+
|
4812 |
pseudos: {
|
4813 |
// Potentially complex pseudos
|
4814 |
"not": markFunction(function( selector ) {
|
4818 |
var input = [],
|
4819 |
results = [],
|
4820 |
matcher = compile( selector.replace( rtrim, "$1" ) );
|
4821 |
+
|
4822 |
return matcher[ expando ] ?
|
4823 |
markFunction(function( seed, matches, context, xml ) {
|
4824 |
var elem,
|
4825 |
unmatched = matcher( seed, null, xml, [] ),
|
4826 |
i = seed.length;
|
4827 |
+
|
4828 |
// Match elements unmatched by `matcher`
|
4829 |
while ( i-- ) {
|
4830 |
if ( (elem = unmatched[i]) ) {
|
4838 |
return !results.pop();
|
4839 |
};
|
4840 |
}),
|
4841 |
+
|
4842 |
"has": markFunction(function( selector ) {
|
4843 |
return function( elem ) {
|
4844 |
return Sizzle( selector, elem ).length > 0;
|
4845 |
};
|
4846 |
}),
|
4847 |
+
|
4848 |
"contains": markFunction(function( text ) {
|
4849 |
return function( elem ) {
|
4850 |
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
|
4851 |
};
|
4852 |
}),
|
4853 |
+
|
4854 |
// "Whether an element is represented by a :lang() selector
|
4855 |
// is based solely on the element's language value
|
4856 |
// being equal to the identifier C,
|
4870 |
if ( (elemLang = documentIsXML ?
|
4871 |
elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
|
4872 |
elem.lang) ) {
|
4873 |
+
|
4874 |
elemLang = elemLang.toLowerCase();
|
4875 |
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
|
4876 |
}
|
4878 |
return false;
|
4879 |
};
|
4880 |
}),
|
4881 |
+
|
4882 |
// Miscellaneous
|
4883 |
"target": function( elem ) {
|
4884 |
var hash = window.location && window.location.hash;
|
4885 |
return hash && hash.slice( 1 ) === elem.id;
|
4886 |
},
|
4887 |
+
|
4888 |
"root": function( elem ) {
|
4889 |
return elem === docElem;
|
4890 |
},
|
4891 |
+
|
4892 |
"focus": function( elem ) {
|
4893 |
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
|
4894 |
},
|
4895 |
+
|
4896 |
// Boolean properties
|
4897 |
"enabled": function( elem ) {
|
4898 |
return elem.disabled === false;
|
4899 |
},
|
4900 |
+
|
4901 |
"disabled": function( elem ) {
|
4902 |
return elem.disabled === true;
|
4903 |
},
|
4904 |
+
|
4905 |
"checked": function( elem ) {
|
4906 |
// In CSS3, :checked should return both checked and selected elements
|
4907 |
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
|
4908 |
var nodeName = elem.nodeName.toLowerCase();
|
4909 |
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
|
4910 |
},
|
4911 |
+
|
4912 |
"selected": function( elem ) {
|
4913 |
// Accessing this property makes selected-by-default
|
4914 |
// options in Safari work properly
|
4915 |
if ( elem.parentNode ) {
|
4916 |
elem.parentNode.selectedIndex;
|
4917 |
}
|
4918 |
+
|
4919 |
return elem.selected === true;
|
4920 |
},
|
4921 |
+
|
4922 |
// Contents
|
4923 |
"empty": function( elem ) {
|
4924 |
// http://www.w3.org/TR/selectors/#empty-pseudo
|
4933 |
}
|
4934 |
return true;
|
4935 |
},
|
4936 |
+
|
4937 |
"parent": function( elem ) {
|
4938 |
return !Expr.pseudos["empty"]( elem );
|
4939 |
},
|
4940 |
+
|
4941 |
// Element/input types
|
4942 |
"header": function( elem ) {
|
4943 |
return rheader.test( elem.nodeName );
|
4944 |
},
|
4945 |
+
|
4946 |
"input": function( elem ) {
|
4947 |
return rinputs.test( elem.nodeName );
|
4948 |
},
|
4949 |
+
|
4950 |
"button": function( elem ) {
|
4951 |
var name = elem.nodeName.toLowerCase();
|
4952 |
return name === "input" && elem.type === "button" || name === "button";
|
4953 |
},
|
4954 |
+
|
4955 |
"text": function( elem ) {
|
4956 |
var attr;
|
4957 |
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
|
4960 |
elem.type === "text" &&
|
4961 |
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
|
4962 |
},
|
4963 |
+
|
4964 |
// Position-in-collection
|
4965 |
"first": createPositionalPseudo(function() {
|
4966 |
return [ 0 ];
|
4967 |
}),
|
4968 |
+
|
4969 |
"last": createPositionalPseudo(function( matchIndexes, length ) {
|
4970 |
return [ length - 1 ];
|
4971 |
}),
|
4972 |
+
|
4973 |
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
4974 |
return [ argument < 0 ? argument + length : argument ];
|
4975 |
}),
|
4976 |
+
|
4977 |
"even": createPositionalPseudo(function( matchIndexes, length ) {
|
4978 |
var i = 0;
|
4979 |
for ( ; i < length; i += 2 ) {
|
4981 |
}
|
4982 |
return matchIndexes;
|
4983 |
}),
|
4984 |
+
|
4985 |
"odd": createPositionalPseudo(function( matchIndexes, length ) {
|
4986 |
var i = 1;
|
4987 |
for ( ; i < length; i += 2 ) {
|
4989 |
}
|
4990 |
return matchIndexes;
|
4991 |
}),
|
4992 |
+
|
4993 |
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
4994 |
var i = argument < 0 ? argument + length : argument;
|
4995 |
for ( ; --i >= 0; ) {
|
4997 |
}
|
4998 |
return matchIndexes;
|
4999 |
}),
|
5000 |
+
|
5001 |
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
|
5002 |
var i = argument < 0 ? argument + length : argument;
|
5003 |
for ( ; ++i < length; ) {
|
5007 |
})
|
5008 |
}
|
5009 |
};
|
5010 |
+
|
5011 |
// Add button/input type pseudos
|
5012 |
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
|
5013 |
Expr.pseudos[ i ] = createInputPseudo( i );
|
5015 |
for ( i in { submit: true, reset: true } ) {
|
5016 |
Expr.pseudos[ i ] = createButtonPseudo( i );
|
5017 |
}
|
5018 |
+
|
5019 |
function tokenize( selector, parseOnly ) {
|
5020 |
var matched, match, tokens, type,
|
5021 |
soFar, groups, preFilters,
|
5022 |
cached = tokenCache[ selector + " " ];
|
5023 |
+
|
5024 |
if ( cached ) {
|
5025 |
return parseOnly ? 0 : cached.slice( 0 );
|
5026 |
}
|
5027 |
+
|
5028 |
soFar = selector;
|
5029 |
groups = [];
|
5030 |
preFilters = Expr.preFilter;
|
5031 |
+
|
5032 |
while ( soFar ) {
|
5033 |
+
|
5034 |
// Comma and first run
|
5035 |
if ( !matched || (match = rcomma.exec( soFar )) ) {
|
5036 |
if ( match ) {
|
5039 |
}
|
5040 |
groups.push( tokens = [] );
|
5041 |
}
|
5042 |
+
|
5043 |
matched = false;
|
5044 |
+
|
5045 |
// Combinators
|
5046 |
if ( (match = rcombinators.exec( soFar )) ) {
|
5047 |
matched = match.shift();
|
5052 |
} );
|
5053 |
soFar = soFar.slice( matched.length );
|
5054 |
}
|
5055 |
+
|
5056 |
// Filters
|
5057 |
for ( type in Expr.filter ) {
|
5058 |
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
|
5066 |
soFar = soFar.slice( matched.length );
|
5067 |
}
|
5068 |
}
|
5069 |
+
|
5070 |
if ( !matched ) {
|
5071 |
break;
|
5072 |
}
|
5073 |
}
|
5074 |
+
|
5075 |
// Return the length of the invalid excess
|
5076 |
// if we're just parsing
|
5077 |
// Otherwise, throw an error or return tokens
|
5082 |
// Cache the tokens
|
5083 |
tokenCache( selector, groups ).slice( 0 );
|
5084 |
}
|
5085 |
+
|
5086 |
function toSelector( tokens ) {
|
5087 |
var i = 0,
|
5088 |
len = tokens.length,
|
5092 |
}
|
5093 |
return selector;
|
5094 |
}
|
5095 |
+
|
5096 |
function addCombinator( matcher, combinator, base ) {
|
5097 |
var dir = combinator.dir,
|
5098 |
checkNonElements = base && dir === "parentNode",
|
5099 |
doneName = done++;
|
5100 |
+
|
5101 |
return combinator.first ?
|
5102 |
// Check against closest ancestor/preceding element
|
5103 |
function( elem, context, xml ) {
|
5107 |
}
|
5108 |
}
|
5109 |
} :
|
5110 |
+
|
5111 |
// Check against all ancestor/preceding elements
|
5112 |
function( elem, context, xml ) {
|
5113 |
var data, cache, outerCache,
|
5114 |
dirkey = dirruns + " " + doneName;
|
5115 |
+
|
5116 |
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
|
5117 |
if ( xml ) {
|
5118 |
while ( (elem = elem[ dir ]) ) {
|
5142 |
}
|
5143 |
};
|
5144 |
}
|
5145 |
+
|
5146 |
function elementMatcher( matchers ) {
|
5147 |
return matchers.length > 1 ?
|
5148 |
function( elem, context, xml ) {
|
5156 |
} :
|
5157 |
matchers[0];
|
5158 |
}
|
5159 |
+
|
5160 |
function condense( unmatched, map, filter, context, xml ) {
|
5161 |
var elem,
|
5162 |
newUnmatched = [],
|
5163 |
i = 0,
|
5164 |
len = unmatched.length,
|
5165 |
mapped = map != null;
|
5166 |
+
|
5167 |
for ( ; i < len; i++ ) {
|
5168 |
if ( (elem = unmatched[i]) ) {
|
5169 |
if ( !filter || filter( elem, context, xml ) ) {
|
5174 |
}
|
5175 |
}
|
5176 |
}
|
5177 |
+
|
5178 |
return newUnmatched;
|
5179 |
}
|
5180 |
+
|
5181 |
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
|
5182 |
if ( postFilter && !postFilter[ expando ] ) {
|
5183 |
postFilter = setMatcher( postFilter );
|
5190 |
preMap = [],
|
5191 |
postMap = [],
|
5192 |
preexisting = results.length,
|
5193 |
+
|
5194 |
// Get initial elements from seed or context
|
5195 |
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
|
5196 |
+
|
5197 |
// Prefilter to get matcher input, preserving a map for seed-results synchronization
|
5198 |
matcherIn = preFilter && ( seed || !selector ) ?
|
5199 |
condense( elems, preMap, preFilter, context, xml ) :
|
5200 |
elems,
|
5201 |
+
|
5202 |
matcherOut = matcher ?
|
5203 |
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
|
5204 |
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
|
5205 |
+
|
5206 |
// ...intermediate processing is necessary
|
5207 |
[] :
|
5208 |
+
|
5209 |
// ...otherwise use results directly
|
5210 |
results :
|
5211 |
matcherIn;
|
5212 |
+
|
5213 |
// Find primary matches
|
5214 |
if ( matcher ) {
|
5215 |
matcher( matcherIn, matcherOut, context, xml );
|
5216 |
}
|
5217 |
+
|
5218 |
// Apply postFilter
|
5219 |
if ( postFilter ) {
|
5220 |
temp = condense( matcherOut, postMap );
|
5221 |
postFilter( temp, [], context, xml );
|
5222 |
+
|
5223 |
// Un-match failing elements by moving them back to matcherIn
|
5224 |
i = temp.length;
|
5225 |
while ( i-- ) {
|
5228 |
}
|
5229 |
}
|
5230 |
}
|
5231 |
+
|
5232 |
if ( seed ) {
|
5233 |
if ( postFinder || preFilter ) {
|
5234 |
if ( postFinder ) {
|
5243 |
}
|
5244 |
postFinder( null, (matcherOut = []), temp, xml );
|
5245 |
}
|
5246 |
+
|
5247 |
// Move matched elements from seed to results to keep them synchronized
|
5248 |
i = matcherOut.length;
|
5249 |
while ( i-- ) {
|
5250 |
if ( (elem = matcherOut[i]) &&
|
5251 |
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
|
5252 |
+
|
5253 |
seed[temp] = !(results[temp] = elem);
|
5254 |
}
|
5255 |
}
|
5256 |
}
|
5257 |
+
|
5258 |
// Add elements to results, through postFinder if defined
|
5259 |
} else {
|
5260 |
matcherOut = condense(
|
5270 |
}
|
5271 |
});
|
5272 |
}
|
5273 |
+
|
5274 |
function matcherFromTokens( tokens ) {
|
5275 |
var checkContext, matcher, j,
|
5276 |
len = tokens.length,
|
5277 |
leadingRelative = Expr.relative[ tokens[0].type ],
|
5278 |
implicitRelative = leadingRelative || Expr.relative[" "],
|
5279 |
i = leadingRelative ? 1 : 0,
|
5280 |
+
|
5281 |
// The foundational matcher ensures that elements are reachable from top-level context(s)
|
5282 |
matchContext = addCombinator( function( elem ) {
|
5283 |
return elem === checkContext;
|
5291 |
matchContext( elem, context, xml ) :
|
5292 |
matchAnyContext( elem, context, xml ) );
|
5293 |
} ];
|
5294 |
+
|
5295 |
for ( ; i < len; i++ ) {
|
5296 |
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
|
5297 |
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
|
5298 |
} else {
|
5299 |
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
|
5300 |
+
|
5301 |
// Return special upon seeing a positional matcher
|
5302 |
if ( matcher[ expando ] ) {
|
5303 |
// Find the next relative operator (if any) for proper handling
|
5319 |
matchers.push( matcher );
|
5320 |
}
|
5321 |
}
|
5322 |
+
|
5323 |
return elementMatcher( matchers );
|
5324 |
}
|
5325 |
+
|
5326 |
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
|
5327 |
// A counter to specify which element is currently being matched
|
5328 |
var matcherCachedRuns = 0,
|
5340 |
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
|
5341 |
// Use integer dirruns iff this is the outermost matcher
|
5342 |
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
|
5343 |
+
|
5344 |
if ( outermost ) {
|
5345 |
outermostContext = context !== document && context;
|
5346 |
cachedruns = matcherCachedRuns;
|
5347 |
}
|
5348 |
+
|
5349 |
// Add elements passing elementMatchers directly to results
|
5350 |
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
|
5351 |
for ( ; (elem = elems[i]) != null; i++ ) {
|
5362 |
cachedruns = ++matcherCachedRuns;
|
5363 |
}
|
5364 |
}
|
5365 |
+
|
5366 |
// Track unmatched elements for set filters
|
5367 |
if ( bySet ) {
|
5368 |
// They will have gone through all possible matchers
|
5369 |
if ( (elem = !matcher && elem) ) {
|
5370 |
matchedCount--;
|
5371 |
}
|
5372 |
+
|
5373 |
// Lengthen the array for every element, matched or not
|
5374 |
if ( seed ) {
|
5375 |
unmatched.push( elem );
|
5376 |
}
|
5377 |
}
|
5378 |
}
|
5379 |
+
|
5380 |
// Apply set filters to unmatched elements
|
5381 |
matchedCount += i;
|
5382 |
if ( bySet && i !== matchedCount ) {
|
5384 |
while ( (matcher = setMatchers[j++]) ) {
|
5385 |
matcher( unmatched, setMatched, context, xml );
|
5386 |
}
|
5387 |
+
|
5388 |
if ( seed ) {
|
5389 |
// Reintegrate element matches to eliminate the need for sorting
|
5390 |
if ( matchedCount > 0 ) {
|
5394 |
}
|
5395 |
}
|
5396 |
}
|
5397 |
+
|
5398 |
// Discard index placeholder values to get only actual matches
|
5399 |
setMatched = condense( setMatched );
|
5400 |
}
|
5401 |
+
|
5402 |
// Add matches to results
|
5403 |
push.apply( results, setMatched );
|
5404 |
+
|
5405 |
// Seedless set matches succeeding multiple successful matchers stipulate sorting
|
5406 |
if ( outermost && !seed && setMatched.length > 0 &&
|
5407 |
( matchedCount + setMatchers.length ) > 1 ) {
|
5408 |
+
|
5409 |
Sizzle.uniqueSort( results );
|
5410 |
}
|
5411 |
}
|
5412 |
+
|
5413 |
// Override manipulation of globals by nested matchers
|
5414 |
if ( outermost ) {
|
5415 |
dirruns = dirrunsUnique;
|
5416 |
outermostContext = contextBackup;
|
5417 |
}
|
5418 |
+
|
5419 |
return unmatched;
|
5420 |
};
|
5421 |
+
|
5422 |
return bySet ?
|
5423 |
markFunction( superMatcher ) :
|
5424 |
superMatcher;
|
5425 |
}
|
5426 |
+
|
5427 |
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
|
5428 |
var i,
|
5429 |
setMatchers = [],
|
5430 |
elementMatchers = [],
|
5431 |
cached = compilerCache[ selector + " " ];
|
5432 |
+
|
5433 |
if ( !cached ) {
|
5434 |
// Generate a function of recursive functions that can be used to check each element
|
5435 |
if ( !group ) {
|
5444 |
elementMatchers.push( cached );
|
5445 |
}
|
5446 |
}
|
5447 |
+
|
5448 |
// Cache the compiled function
|
5449 |
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
|
5450 |
}
|
5451 |
return cached;
|
5452 |
};
|
5453 |
+
|
5454 |
function multipleContexts( selector, contexts, results ) {
|
5455 |
var i = 0,
|
5456 |
len = contexts.length;
|
5459 |
}
|
5460 |
return results;
|
5461 |
}
|
5462 |
+
|
5463 |
function select( selector, context, results, seed ) {
|
5464 |
var i, tokens, token, type, find,
|
5465 |
match = tokenize( selector );
|
5466 |
+
|
5467 |
if ( !seed ) {
|
5468 |
// Try to minimize operations if there is only one group
|
5469 |
if ( match.length === 1 ) {
|
5470 |
+
|
5471 |
// Take a shortcut and set the context if the root selector is an ID
|
5472 |
tokens = match[0] = match[0].slice( 0 );
|
5473 |
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
|
5474 |
context.nodeType === 9 && !documentIsXML &&
|
5475 |
Expr.relative[ tokens[1].type ] ) {
|
5476 |
+
|
5477 |
context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
|
5478 |
if ( !context ) {
|
5479 |
return results;
|
5480 |
}
|
5481 |
+
|
5482 |
selector = selector.slice( tokens.shift().value.length );
|
5483 |
}
|
5484 |
+
|
5485 |
// Fetch a seed set for right-to-left matching
|
5486 |
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
|
5487 |
while ( i-- ) {
|
5488 |
token = tokens[i];
|
5489 |
+
|
5490 |
// Abort if we hit a combinator
|
5491 |
if ( Expr.relative[ (type = token.type) ] ) {
|
5492 |
break;
|
5497 |
token.matches[0].replace( runescape, funescape ),
|
5498 |
rsibling.test( tokens[0].type ) && context.parentNode || context
|
5499 |
)) ) {
|
5500 |
+
|
5501 |
// If seed is empty or no tokens remain, we can return early
|
5502 |
tokens.splice( i, 1 );
|
5503 |
selector = seed.length && toSelector( tokens );
|
5505 |
push.apply( results, slice.call( seed, 0 ) );
|
5506 |
return results;
|
5507 |
}
|
5508 |
+
|
5509 |
break;
|
5510 |
}
|
5511 |
}
|
5512 |
}
|
5513 |
}
|
5514 |
}
|
5515 |
+
|
5516 |
// Compile and execute a filtering function
|
5517 |
// Provide `match` to avoid retokenization if we modified the selector above
|
5518 |
compile( selector, match )(
|
5524 |
);
|
5525 |
return results;
|
5526 |
}
|
5527 |
+
|
5528 |
// Deprecated
|
5529 |
Expr.pseudos["nth"] = Expr.pseudos["eq"];
|
5530 |
+
|
5531 |
// Easy API for creating new setFilters
|
5532 |
function setFilters() {}
|
5533 |
Expr.filters = setFilters.prototype = Expr.pseudos;
|
5534 |
Expr.setFilters = new setFilters();
|
5535 |
+
|
5536 |
// Initialize with the default document
|
5537 |
setDocument();
|
5538 |
+
|
5539 |
// Override sizzle attribute retrieval
|
5540 |
Sizzle.attr = jQuery.attr;
|
5541 |
jQuery.find = Sizzle;
|
5545 |
jQuery.text = Sizzle.getText;
|
5546 |
jQuery.isXMLDoc = Sizzle.isXML;
|
5547 |
jQuery.contains = Sizzle.contains;
|
5548 |
+
|
5549 |
+
|
5550 |
})( window );
|
5551 |
var runtil = /Until$/,
|
5552 |
rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
5559 |
next: true,
|
5560 |
prev: true
|
5561 |
};
|
5562 |
+
|
5563 |
jQuery.fn.extend({
|
5564 |
find: function( selector ) {
|
5565 |
var i, ret, self,
|
5566 |
len = this.length;
|
5567 |
+
|
5568 |
if ( typeof selector !== "string" ) {
|
5569 |
self = this;
|
5570 |
return this.pushStack( jQuery( selector ).filter(function() {
|
5575 |
}
|
5576 |
}) );
|
5577 |
}
|
5578 |
+
|
5579 |
ret = [];
|
5580 |
for ( i = 0; i < len; i++ ) {
|
5581 |
jQuery.find( selector, this[ i ], ret );
|
5582 |
}
|
5583 |
+
|
5584 |
// Needed because $( selector, context ) becomes $( context ).find( selector )
|
5585 |
ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
|
5586 |
ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
|
5587 |
return ret;
|
5588 |
},
|
5589 |
+
|
5590 |
has: function( target ) {
|
5591 |
var i,
|
5592 |
targets = jQuery( target, this ),
|
5593 |
len = targets.length;
|
5594 |
+
|
5595 |
return this.filter(function() {
|
5596 |
for ( i = 0; i < len; i++ ) {
|
5597 |
if ( jQuery.contains( this, targets[i] ) ) {
|
5600 |
}
|
5601 |
});
|
5602 |
},
|
5603 |
+
|
5604 |
not: function( selector ) {
|
5605 |
return this.pushStack( winnow(this, selector, false) );
|
5606 |
},
|
5607 |
+
|
5608 |
filter: function( selector ) {
|
5609 |
return this.pushStack( winnow(this, selector, true) );
|
5610 |
},
|
5611 |
+
|
5612 |
is: function( selector ) {
|
5613 |
return !!selector && (
|
5614 |
typeof selector === "string" ?
|
5619 |
jQuery.filter( selector, this ).length > 0 :
|
5620 |
this.filter( selector ).length > 0 );
|
5621 |
},
|
5622 |
+
|
5623 |
closest: function( selectors, context ) {
|
5624 |
var cur,
|
5625 |
i = 0,
|
5628 |
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
|
5629 |
jQuery( selectors, context || this.context ) :
|
5630 |
0;
|
5631 |
+
|
5632 |
for ( ; i < l; i++ ) {
|
5633 |
cur = this[i];
|
5634 |
+
|
5635 |
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
|
5636 |
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
|
5637 |
ret.push( cur );
|
5640 |
cur = cur.parentNode;
|
5641 |
}
|
5642 |
}
|
5643 |
+
|
5644 |
return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
|
5645 |
},
|
5646 |
+
|
5647 |
// Determine the position of an element within
|
5648 |
// the matched set of elements
|
5649 |
index: function( elem ) {
|
5650 |
+
|
5651 |
// No argument, return index in parent
|
5652 |
if ( !elem ) {
|
5653 |
return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
|
5654 |
}
|
5655 |
+
|
5656 |
// index in selector
|
5657 |
if ( typeof elem === "string" ) {
|
5658 |
return jQuery.inArray( this[0], jQuery( elem ) );
|
5659 |
}
|
5660 |
+
|
5661 |
// Locate the position of the desired element
|
5662 |
return jQuery.inArray(
|
5663 |
// If it receives a jQuery object, the first element is used
|
5664 |
elem.jquery ? elem[0] : elem, this );
|
5665 |
},
|
5666 |
+
|
5667 |
add: function( selector, context ) {
|
5668 |
var set = typeof selector === "string" ?
|
5669 |
jQuery( selector, context ) :
|
5670 |
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
|
5671 |
all = jQuery.merge( this.get(), set );
|
5672 |
+
|
5673 |
return this.pushStack( jQuery.unique(all) );
|
5674 |
},
|
5675 |
+
|
5676 |
addBack: function( selector ) {
|
5677 |
return this.add( selector == null ?
|
5678 |
this.prevObject : this.prevObject.filter(selector)
|
5679 |
);
|
5680 |
}
|
5681 |
});
|
5682 |
+
|
5683 |
jQuery.fn.andSelf = jQuery.fn.addBack;
|
5684 |
+
|
5685 |
function sibling( cur, dir ) {
|
5686 |
do {
|
5687 |
cur = cur[ dir ];
|
5688 |
} while ( cur && cur.nodeType !== 1 );
|
5689 |
+
|
5690 |
return cur;
|
5691 |
}
|
5692 |
+
|
5693 |
jQuery.each({
|
5694 |
parent: function( elem ) {
|
5695 |
var parent = elem.parentNode;
|
5733 |
}, function( name, fn ) {
|
5734 |
jQuery.fn[ name ] = function( until, selector ) {
|
5735 |
var ret = jQuery.map( this, fn, until );
|
5736 |
+
|
5737 |
if ( !runtil.test( name ) ) {
|
5738 |
selector = until;
|
5739 |
}
|
5740 |
+
|
5741 |
if ( selector && typeof selector === "string" ) {
|
5742 |
ret = jQuery.filter( selector, ret );
|
5743 |
}
|
5744 |
+
|
5745 |
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
|
5746 |
+
|
5747 |
if ( this.length > 1 && rparentsprev.test( name ) ) {
|
5748 |
ret = ret.reverse();
|
5749 |
}
|
5750 |
+
|
5751 |
return this.pushStack( ret );
|
5752 |
};
|
5753 |
});
|
5754 |
+
|
5755 |
jQuery.extend({
|
5756 |
filter: function( expr, elems, not ) {
|
5757 |
if ( not ) {
|
5758 |
expr = ":not(" + expr + ")";
|
5759 |
}
|
5760 |
+
|
5761 |
return elems.length === 1 ?
|
5762 |
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
|
5763 |
jQuery.find.matches(expr, elems);
|
5764 |
},
|
5765 |
+
|
5766 |
dir: function( elem, dir, until ) {
|
5767 |
var matched = [],
|
5768 |
cur = elem[ dir ];
|
5769 |
+
|
5770 |
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
|
5771 |
if ( cur.nodeType === 1 ) {
|
5772 |
matched.push( cur );
|
5775 |
}
|
5776 |
return matched;
|
5777 |
},
|
5778 |
+
|
5779 |
sibling: function( n, elem ) {
|
5780 |
var r = [];
|
5781 |
+
|
5782 |
for ( ; n; n = n.nextSibling ) {
|
5783 |
if ( n.nodeType === 1 && n !== elem ) {
|
5784 |
r.push( n );
|
5785 |
}
|
5786 |
}
|
5787 |
+
|
5788 |
return r;
|
5789 |
}
|
5790 |
});
|
5791 |
+
|
5792 |
// Implement the identical functionality for filter and not
|
5793 |
function winnow( elements, qualifier, keep ) {
|
5794 |
+
|
5795 |
// Can't pass null or undefined to indexOf in Firefox 4
|
5796 |
// Set to 0 to skip string check
|
5797 |
qualifier = qualifier || 0;
|
5798 |
+
|
5799 |
if ( jQuery.isFunction( qualifier ) ) {
|
5800 |
return jQuery.grep(elements, function( elem, i ) {
|
5801 |
var retVal = !!qualifier.call( elem, i, elem );
|
5802 |
return retVal === keep;
|
5803 |
});
|
5804 |
+
|
5805 |
} else if ( qualifier.nodeType ) {
|
5806 |
return jQuery.grep(elements, function( elem ) {
|
5807 |
return ( elem === qualifier ) === keep;
|
5808 |
});
|
5809 |
+
|
5810 |
} else if ( typeof qualifier === "string" ) {
|
5811 |
var filtered = jQuery.grep(elements, function( elem ) {
|
5812 |
return elem.nodeType === 1;
|
5813 |
});
|
5814 |
+
|
5815 |
if ( isSimple.test( qualifier ) ) {
|
5816 |
return jQuery.filter(qualifier, filtered, !keep);
|
5817 |
} else {
|
5818 |
qualifier = jQuery.filter( qualifier, filtered );
|
5819 |
}
|
5820 |
}
|
5821 |
+
|
5822 |
return jQuery.grep(elements, function( elem ) {
|
5823 |
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
|
5824 |
});
|
5826 |
function createSafeFragment( document ) {
|
5827 |
var list = nodeNames.split( "|" ),
|
5828 |
safeFrag = document.createDocumentFragment();
|
5829 |
+
|
5830 |
if ( safeFrag.createElement ) {
|
5831 |
while ( list.length ) {
|
5832 |
safeFrag.createElement(
|
5836 |
}
|
5837 |
return safeFrag;
|
5838 |
}
|
5839 |
+
|
5840 |
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
|
5841 |
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
|
5842 |
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
|
5853 |
rscriptType = /^$|\/(?:java|ecma)script/i,
|
5854 |
rscriptTypeMasked = /^true\/(.*)/,
|
5855 |
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
|
5856 |
+
|
5857 |
// We have to close these tags to support XHTML (#13200)
|
5858 |
wrapMap = {
|
5859 |
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
5864 |
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
|
5865 |
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
|
5866 |
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
|
5867 |
+
|
5868 |
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
|
5869 |
// unless wrapped in a div with non-breaking characters in front of it.
|
5870 |
_default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
|
5871 |
},
|
5872 |
safeFragment = createSafeFragment( document ),
|
5873 |
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
|
5874 |
+
|
5875 |
wrapMap.optgroup = wrapMap.option;
|
5876 |
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
5877 |
wrapMap.th = wrapMap.td;
|
5878 |
+
|
5879 |
jQuery.fn.extend({
|
5880 |
text: function( value ) {
|
5881 |
return jQuery.access( this, function( value ) {
|
5884 |
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
|
5885 |
}, null, value, arguments.length );
|
5886 |
},
|
5887 |
+
|
5888 |
wrapAll: function( html ) {
|
5889 |
if ( jQuery.isFunction( html ) ) {
|
5890 |
return this.each(function(i) {
|
5891 |
jQuery(this).wrapAll( html.call(this, i) );
|
5892 |
});
|
5893 |
}
|
5894 |
+
|
5895 |
if ( this[0] ) {
|
5896 |
// The elements to wrap the target around
|
5897 |
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
|
5898 |
+
|
5899 |
if ( this[0].parentNode ) {
|
5900 |
wrap.insertBefore( this[0] );
|
5901 |
}
|
5902 |
+
|
5903 |
wrap.map(function() {
|
5904 |
var elem = this;
|
5905 |
+
|
5906 |
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
|
5907 |
elem = elem.firstChild;
|
5908 |
}
|
5909 |
+
|
5910 |
return elem;
|
5911 |
}).append( this );
|
5912 |
}
|
5913 |
+
|
5914 |
return this;
|
5915 |
},
|
5916 |
+
|
5917 |
wrapInner: function( html ) {
|
5918 |
if ( jQuery.isFunction( html ) ) {
|
5919 |
return this.each(function(i) {
|
5920 |
jQuery(this).wrapInner( html.call(this, i) );
|
5921 |
});
|
5922 |
}
|
5923 |
+
|
5924 |
return this.each(function() {
|
5925 |
var self = jQuery( this ),
|
5926 |
contents = self.contents();
|
5927 |
+
|
5928 |
if ( contents.length ) {
|
5929 |
contents.wrapAll( html );
|
5930 |
+
|
5931 |
} else {
|
5932 |
self.append( html );
|
5933 |
}
|
5934 |
});
|
5935 |
},
|
5936 |
+
|
5937 |
wrap: function( html ) {
|
5938 |
var isFunction = jQuery.isFunction( html );
|
5939 |
+
|
5940 |
return this.each(function(i) {
|
5941 |
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
|
5942 |
});
|
5943 |
},
|
5944 |
+
|
5945 |
unwrap: function() {
|
5946 |
return this.parent().each(function() {
|
5947 |
if ( !jQuery.nodeName( this, "body" ) ) {
|
5949 |
}
|
5950 |
}).end();
|
5951 |
},
|
5952 |
+
|
5953 |
append: function() {
|
5954 |
return this.domManip(arguments, true, function( elem ) {
|
5955 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
5957 |
}
|
5958 |
});
|
5959 |
},
|
5960 |
+
|
5961 |
prepend: function() {
|
5962 |
return this.domManip(arguments, true, function( elem ) {
|
5963 |
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
|
5965 |
}
|
5966 |
});
|
5967 |
},
|
5968 |
+
|
5969 |
before: function() {
|
5970 |
return this.domManip( arguments, false, function( elem ) {
|
5971 |
if ( this.parentNode ) {
|
5972 |
this.parentNode.insertBefore( elem, this );
|
5973 |
+
|
5974 |
}
|
5975 |
});
|
5976 |
},
|
5977 |
+
|
5978 |
after: function() {
|
5979 |
return this.domManip( arguments, false, function( elem ) {
|
5980 |
if ( this.parentNode ) {
|
5982 |
}
|
5983 |
});
|
5984 |
},
|
5985 |
+
|
5986 |
// keepData is for internal use only--do not document
|
5987 |
remove: function( selector, keepData ) {
|
5988 |
var elem,
|
5989 |
i = 0;
|
5990 |
+
|
5991 |
for ( ; (elem = this[i]) != null; i++ ) {
|
5992 |
if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
|
5993 |
if ( !keepData && elem.nodeType === 1 ) {
|
5994 |
jQuery.cleanData( getAll( elem ) );
|
5995 |
}
|
5996 |
+
|
5997 |
if ( elem.parentNode ) {
|
5998 |
if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
|
5999 |
setGlobalEval( getAll( elem, "script" ) );
|
6002 |
}
|
6003 |
}
|
6004 |
}
|
6005 |
+
|
6006 |
return this;
|
6007 |
},
|
6008 |
+
|
6009 |
empty: function() {
|
6010 |
var elem,
|
6011 |
i = 0;
|
6012 |
+
|
6013 |
for ( ; (elem = this[i]) != null; i++ ) {
|
6014 |
// Remove element nodes and prevent memory leaks
|
6015 |
if ( elem.nodeType === 1 ) {
|
6016 |
jQuery.cleanData( getAll( elem, false ) );
|
6017 |
}
|
6018 |
+
|
6019 |
// Remove any remaining nodes
|
6020 |
while ( elem.firstChild ) {
|
6021 |
elem.removeChild( elem.firstChild );
|
6022 |
}
|
6023 |
+
|
6024 |
// If this is a select, ensure that it displays empty (#12336)
|
6025 |
// Support: IE<9
|
6026 |
if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
|
6027 |
elem.options.length = 0;
|
6028 |
}
|
6029 |
}
|
6030 |
+
|
6031 |
return this;
|
6032 |
},
|
6033 |
+
|
6034 |
clone: function( dataAndEvents, deepDataAndEvents ) {
|
6035 |
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
|
6036 |
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
|
6037 |
+
|
6038 |
return this.map( function () {
|
6039 |
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
|
6040 |
});
|
6041 |
},
|
6042 |
+
|
6043 |
html: function( value ) {
|
6044 |
return jQuery.access( this, function( value ) {
|
6045 |
var elem = this[0] || {},
|
6046 |
i = 0,
|
6047 |
l = this.length;
|
6048 |
+
|
6049 |
if ( value === undefined ) {
|
6050 |
return elem.nodeType === 1 ?
|
6051 |
elem.innerHTML.replace( rinlinejQuery, "" ) :
|
6052 |
undefined;
|
6053 |
}
|
6054 |
+
|
6055 |
// See if we can take a shortcut and just use innerHTML
|
6056 |
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
|
6057 |
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
|
6058 |
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
|
6059 |
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
|
6060 |
+
|
6061 |
value = value.replace( rxhtmlTag, "<$1></$2>" );
|
6062 |
+
|
6063 |
try {
|
6064 |
for (; i < l; i++ ) {
|
6065 |
// Remove element nodes and prevent memory leaks
|
6069 |
elem.innerHTML = value;
|
6070 |
}
|
6071 |
}
|
6072 |
+
|
6073 |
elem = 0;
|
6074 |
+
|
6075 |
// If using innerHTML throws an exception, use the fallback method
|
6076 |
} catch(e) {}
|
6077 |
}
|
6078 |
+
|
6079 |
if ( elem ) {
|
6080 |
this.empty().append( value );
|
6081 |
}
|
6082 |
}, null, value, arguments.length );
|
6083 |
},
|
6084 |
+
|
6085 |
replaceWith: function( value ) {
|
6086 |
var isFunc = jQuery.isFunction( value );
|
6087 |
+
|
6088 |
// Make sure that the elements are removed from the DOM before they are inserted
|
6089 |
// this can help fix replacing a parent with child elements
|
6090 |
if ( !isFunc && typeof value !== "string" ) {
|
6091 |
value = jQuery( value ).not( this ).detach();
|
6092 |
}
|
6093 |
+
|
6094 |
return this.domManip( [ value ], true, function( elem ) {
|
6095 |
var next = this.nextSibling,
|
6096 |
parent = this.parentNode;
|
6097 |
+
|
6098 |
if ( parent ) {
|
6099 |
jQuery( this ).remove();
|
6100 |
parent.insertBefore( elem, next );
|
6101 |
}
|
6102 |
});
|
6103 |
},
|
6104 |
+
|
6105 |
detach: function( selector ) {
|
6106 |
return this.remove( selector, true );
|
6107 |
},
|
6108 |
+
|
6109 |
domManip: function( args, table, callback ) {
|
6110 |
+
|
6111 |
// Flatten any nested arrays
|
6112 |
args = core_concat.apply( [], args );
|
6113 |
+
|
6114 |
var first, node, hasScripts,
|
6115 |
scripts, doc, fragment,
|
6116 |
i = 0,
|
6119 |
iNoClone = l - 1,
|
6120 |
value = args[0],
|
6121 |
isFunction = jQuery.isFunction( value );
|
6122 |
+
|
6123 |
// We can't cloneNode fragments that contain checked, in WebKit
|
6124 |
if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
|
6125 |
return this.each(function( index ) {
|
6130 |
self.domManip( args, table, callback );
|
6131 |
});
|
6132 |
}
|
6133 |
+
|
6134 |
if ( l ) {
|
6135 |
fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
|
6136 |
first = fragment.firstChild;
|
6137 |
+
|
6138 |
if ( fragment.childNodes.length === 1 ) {
|
6139 |
fragment = first;
|
6140 |
}
|
6141 |
+
|
6142 |
if ( first ) {
|
6143 |
table = table && jQuery.nodeName( first, "tr" );
|
6144 |
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
|
6145 |
hasScripts = scripts.length;
|
6146 |
+
|
6147 |
// Use the original fragment for the last item instead of the first because it can end up
|
6148 |
// being emptied incorrectly in certain situations (#8070).
|
6149 |
for ( ; i < l; i++ ) {
|
6150 |
node = fragment;
|
6151 |
+
|
6152 |
if ( i !== iNoClone ) {
|
6153 |
node = jQuery.clone( node, true, true );
|
6154 |
+
|
6155 |
// Keep references to cloned scripts for later restoration
|
6156 |
if ( hasScripts ) {
|
6157 |
jQuery.merge( scripts, getAll( node, "script" ) );
|
6158 |
}
|
6159 |
}
|
6160 |
+
|
6161 |
callback.call(
|
6162 |
table && jQuery.nodeName( this[i], "table" ) ?
|
6163 |
findOrAppend( this[i], "tbody" ) :
|
6166 |
i
|
6167 |
);
|
6168 |
}
|
6169 |
+
|
6170 |
if ( hasScripts ) {
|
6171 |
doc = scripts[ scripts.length - 1 ].ownerDocument;
|
6172 |
+
|
6173 |
// Reenable scripts
|
6174 |
jQuery.map( scripts, restoreScript );
|
6175 |
+
|
6176 |
// Evaluate executable scripts on first document insertion
|
6177 |
for ( i = 0; i < hasScripts; i++ ) {
|
6178 |
node = scripts[ i ];
|
6179 |
if ( rscriptType.test( node.type || "" ) &&
|
6180 |
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
|
6181 |
+
|
6182 |
if ( node.src ) {
|
6183 |
// Hope ajax is available...
|
6184 |
jQuery.ajax({
|
6195 |
}
|
6196 |
}
|
6197 |
}
|
6198 |
+
|
6199 |
// Fix #11809: Avoid leaking memory
|
6200 |
fragment = first = null;
|
6201 |
}
|
6202 |
}
|
6203 |
+
|
6204 |
return this;
|
6205 |
}
|
6206 |
});
|
6207 |
+
|
6208 |
function findOrAppend( elem, tag ) {
|
6209 |
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
|
6210 |
}
|
6211 |
+
|
6212 |
// Replace/restore the type attribute of script elements for safe DOM manipulation
|
6213 |
function disableScript( elem ) {
|
6214 |
var attr = elem.getAttributeNode("type");
|
6224 |
}
|
6225 |
return elem;
|
6226 |
}
|
6227 |
+
|
6228 |
// Mark scripts as having already been evaluated
|
6229 |
function setGlobalEval( elems, refElements ) {
|
6230 |
var elem,
|
6233 |
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
|
6234 |
}
|
6235 |
}
|
6236 |
+
|
6237 |
function cloneCopyEvent( src, dest ) {
|
6238 |
+
|
6239 |
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
|
6240 |
return;
|
6241 |
}
|
6242 |
+
|
6243 |
var type, i, l,
|
6244 |
oldData = jQuery._data( src ),
|
6245 |
curData = jQuery._data( dest, oldData ),
|
6246 |
events = oldData.events;
|
6247 |
+
|
6248 |
if ( events ) {
|
6249 |
delete curData.handle;
|
6250 |
curData.events = {};
|
6251 |
+
|
6252 |
for ( type in events ) {
|
6253 |
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
|
6254 |
jQuery.event.add( dest, type, events[ type ][ i ] );
|
6255 |
}
|
6256 |
}
|
6257 |
}
|
6258 |
+
|
6259 |
// make the cloned public data object a copy from the original
|
6260 |
if ( curData.data ) {
|
6261 |
curData.data = jQuery.extend( {}, curData.data );
|
6262 |
}
|
6263 |
}
|
6264 |
+
|
6265 |
function fixCloneNodeIssues( src, dest ) {
|
6266 |
var nodeName, e, data;
|
6267 |
+
|
6268 |
// We do not need to do anything for non-Elements
|
6269 |
if ( dest.nodeType !== 1 ) {
|
6270 |
return;
|
6271 |
}
|
6272 |
+
|
6273 |
nodeName = dest.nodeName.toLowerCase();
|
6274 |
+
|
6275 |
// IE6-8 copies events bound via attachEvent when using cloneNode.
|
6276 |
if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
|
6277 |
data = jQuery._data( dest );
|
6278 |
+
|
6279 |
for ( e in data.events ) {
|
6280 |
jQuery.removeEvent( dest, e, data.handle );
|
6281 |
}
|
6282 |
+
|
6283 |
// Event data gets referenced instead of copied if the expando gets copied too
|
6284 |
dest.removeAttribute( jQuery.expando );
|
6285 |
}
|
6286 |
+
|
6287 |
// IE blanks contents when cloning scripts, and tries to evaluate newly-set text
|
6288 |
if ( nodeName === "script" && dest.text !== src.text ) {
|
6289 |
disableScript( dest ).text = src.text;
|
6290 |
restoreScript( dest );
|
6291 |
+
|
6292 |
// IE6-10 improperly clones children of object elements using classid.
|
6293 |
// IE10 throws NoModificationAllowedError if parent is null, #12132.
|
6294 |
} else if ( nodeName === "object" ) {
|
6295 |
if ( dest.parentNode ) {
|
6296 |
dest.outerHTML = src.outerHTML;
|
6297 |
}
|
6298 |
+
|
6299 |
// This path appears unavoidable for IE9. When cloning an object
|
6300 |
// element in IE9, the outerHTML strategy above is not sufficient.
|
6301 |
// If the src has innerHTML and the destination does not,
|
6303 |
if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
|
6304 |
dest.innerHTML = src.innerHTML;
|
6305 |
}
|
6306 |
+
|
6307 |
} else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
|
6308 |
// IE6-8 fails to persist the checked state of a cloned checkbox
|
6309 |
// or radio button. Worse, IE6-7 fail to give the cloned element
|
6310 |
// a checked appearance if the defaultChecked value isn't also set
|
6311 |
+
|
6312 |
dest.defaultChecked = dest.checked = src.checked;
|
6313 |
+
|
6314 |
// IE6-7 get confused and end up setting the value of a cloned
|
6315 |
// checkbox/radio button to an empty string instead of "on"
|
6316 |
if ( dest.value !== src.value ) {
|
6317 |
dest.value = src.value;
|
6318 |
}
|
6319 |
+
|
6320 |
// IE6-8 fails to return the selected option to the default selected
|
6321 |
// state when cloning options
|
6322 |
} else if ( nodeName === "option" ) {
|
6323 |
dest.defaultSelected = dest.selected = src.defaultSelected;
|
6324 |
+
|
6325 |
// IE6-8 fails to set the defaultValue to the correct value when
|
6326 |
// cloning other types of input fields
|
6327 |
} else if ( nodeName === "input" || nodeName === "textarea" ) {
|
6328 |
dest.defaultValue = src.defaultValue;
|
6329 |
}
|
6330 |
}
|
6331 |
+
|
6332 |
jQuery.each({
|
6333 |
appendTo: "append",
|
6334 |
prependTo: "prepend",
|
6342 |
ret = [],
|
6343 |
insert = jQuery( selector ),
|
6344 |
last = insert.length - 1;
|
6345 |
+
|
6346 |
for ( ; i <= last; i++ ) {
|
6347 |
elems = i === last ? this : this.clone(true);
|
6348 |
jQuery( insert[i] )[ original ]( elems );
|
6349 |
+
|
6350 |
// Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
|
6351 |
core_push.apply( ret, elems.get() );
|
6352 |
}
|
6353 |
+
|
6354 |
return this.pushStack( ret );
|
6355 |
};
|
6356 |
});
|
6357 |
+
|
6358 |
function getAll( context, tag ) {
|
6359 |
var elems, elem,
|
6360 |
i = 0,
|
6361 |
found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
|
6362 |
typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
|
6363 |
undefined;
|
6364 |
+
|
6365 |
if ( !found ) {
|
6366 |
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
|
6367 |
if ( !tag || jQuery.nodeName( elem, tag ) ) {
|
6371 |
}
|
6372 |
}
|
6373 |
}
|
6374 |
+
|
6375 |
return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
|
6376 |
jQuery.merge( [ context ], found ) :
|
6377 |
found;
|
6378 |
}
|
6379 |
+
|
6380 |
// Used in buildFragment, fixes the defaultChecked property
|
6381 |
function fixDefaultChecked( elem ) {
|
6382 |
if ( manipulation_rcheckableType.test( elem.type ) ) {
|
6383 |
elem.defaultChecked = elem.checked;
|
6384 |
}
|
6385 |
}
|
6386 |
+
|
6387 |
jQuery.extend({
|
6388 |
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
|
6389 |
var destElements, node, clone, i, srcElements,
|
6390 |
inPage = jQuery.contains( elem.ownerDocument, elem );
|
6391 |
+
|
6392 |
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
|
6393 |
clone = elem.cloneNode( true );
|
6394 |
+
|
6395 |
// IE<=8 does not properly clone detached, unknown element nodes
|
6396 |
} else {
|
6397 |
fragmentDiv.innerHTML = elem.outerHTML;
|
6398 |
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
|
6399 |
}
|
6400 |
+
|
6401 |
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
|
6402 |
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
|
6403 |
+
|
6404 |
// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
|
6405 |
destElements = getAll( clone );
|
6406 |
srcElements = getAll( elem );
|
6407 |
+
|
6408 |
// Fix all IE cloning issues
|
6409 |
for ( i = 0; (node = srcElements[i]) != null; ++i ) {
|
6410 |
// Ensure that the destination node is not null; Fixes #9587
|
6413 |
}
|
6414 |
}
|
6415 |
}
|
6416 |
+
|
6417 |
// Copy the events from the original to the clone
|
6418 |
if ( dataAndEvents ) {
|
6419 |
if ( deepDataAndEvents ) {
|
6420 |
srcElements = srcElements || getAll( elem );
|
6421 |
destElements = destElements || getAll( clone );
|
6422 |
+
|
6423 |
for ( i = 0; (node = srcElements[i]) != null; i++ ) {
|
6424 |
cloneCopyEvent( node, destElements[i] );
|
6425 |
}
|
6427 |
cloneCopyEvent( elem, clone );
|
6428 |
}
|
6429 |
}
|
6430 |
+
|
6431 |
// Preserve script evaluation history
|
6432 |
destElements = getAll( clone, "script" );
|
6433 |
if ( destElements.length > 0 ) {
|
6434 |
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
|
6435 |
}
|
6436 |
+
|
6437 |
destElements = srcElements = node = null;
|
6438 |
+
|
6439 |
// Return the cloned set
|
6440 |
return clone;
|
6441 |
},
|
6442 |
+
|
6443 |
buildFragment: function( elems, context, scripts, selection ) {
|
6444 |
var j, elem, contains,
|
6445 |
tmp, tag, tbody, wrap,
|
6446 |
l = elems.length,
|
6447 |
+
|
6448 |
// Ensure a safe fragment
|
6449 |
safe = createSafeFragment( context ),
|
6450 |
+
|
6451 |
nodes = [],
|
6452 |
i = 0;
|
6453 |
+
|
6454 |
for ( ; i < l; i++ ) {
|
6455 |
elem = elems[ i ];
|
6456 |
+
|
6457 |
if ( elem || elem === 0 ) {
|
6458 |
+
|
6459 |
// Add nodes directly
|
6460 |
if ( jQuery.type( elem ) === "object" ) {
|
6461 |
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
|
6462 |
+
|
6463 |
// Convert non-html into a text node
|
6464 |
} else if ( !rhtml.test( elem ) ) {
|
6465 |
nodes.push( context.createTextNode( elem ) );
|
6466 |
+
|
6467 |
// Convert html into DOM nodes
|
6468 |
} else {
|
6469 |
tmp = tmp || safe.appendChild( context.createElement("div") );
|
6470 |
+
|
6471 |
// Deserialize a standard representation
|
6472 |
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
|
6473 |
wrap = wrapMap[ tag ] || wrapMap._default;
|
6474 |
+
|
6475 |
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
|
6476 |
+
|
6477 |
// Descend through wrappers to the right content
|
6478 |
j = wrap[0];
|
6479 |
while ( j-- ) {
|
6480 |
tmp = tmp.lastChild;
|
6481 |
}
|
6482 |
+
|
6483 |
// Manually add leading whitespace removed by IE
|
6484 |
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
|
6485 |
nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
|
6486 |
}
|
6487 |
+
|
6488 |
// Remove IE's autoinserted <tbody> from table fragments
|
6489 |
if ( !jQuery.support.tbody ) {
|
6490 |
+
|
6491 |
// String was a <table>, *may* have spurious <tbody>
|
6492 |
elem = tag === "table" && !rtbody.test( elem ) ?
|
6493 |
tmp.firstChild :
|
6494 |
+
|
6495 |
// String was a bare <thead> or <tfoot>
|
6496 |
wrap[1] === "<table>" && !rtbody.test( elem ) ?
|
6497 |
tmp :
|
6498 |
0;
|
6499 |
+
|
6500 |
j = elem && elem.childNodes.length;
|
6501 |
while ( j-- ) {
|
6502 |
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
|
6504 |
}
|
6505 |
}
|
6506 |
}
|
6507 |
+
|
6508 |
jQuery.merge( nodes, tmp.childNodes );
|
6509 |
+
|
6510 |
// Fix #12392 for WebKit and IE > 9
|
6511 |
tmp.textContent = "";
|
6512 |
+
|
6513 |
// Fix #12392 for oldIE
|
6514 |
while ( tmp.firstChild ) {
|
6515 |
tmp.removeChild( tmp.firstChild );
|
6516 |
}
|
6517 |
+
|
6518 |
// Remember the top-level container for proper cleanup
|
6519 |
tmp = safe.lastChild;
|
6520 |
}
|
6521 |
}
|
6522 |
}
|
6523 |
+
|
6524 |
// Fix #11356: Clear elements from fragment
|
6525 |
if ( tmp ) {
|
6526 |
safe.removeChild( tmp );
|
6527 |
}
|
6528 |
+
|
6529 |
// Reset defaultChecked for any radios and checkboxes
|
6530 |
// about to be appended to the DOM in IE 6/7 (#8060)
|
6531 |
if ( !jQuery.support.appendChecked ) {
|
6532 |
jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
|
6533 |
}
|
6534 |
+
|
6535 |
i = 0;
|
6536 |
while ( (elem = nodes[ i++ ]) ) {
|
6537 |
+
|
6538 |
// #4087 - If origin and destination elements are the same, and this is
|
6539 |
// that element, do not do anything
|
6540 |
if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
|
6541 |
continue;
|
6542 |
}
|
6543 |
+
|
6544 |
contains = jQuery.contains( elem.ownerDocument, elem );
|
6545 |
+
|
6546 |
// Append to fragment
|
6547 |
tmp = getAll( safe.appendChild( elem ), "script" );
|
6548 |
+
|
6549 |
// Preserve script evaluation history
|
6550 |
if ( contains ) {
|
6551 |
setGlobalEval( tmp );
|
6552 |
}
|
6553 |
+
|
6554 |
// Capture executables
|
6555 |
if ( scripts ) {
|
6556 |
j = 0;
|
6561 |
}
|
6562 |
}
|
6563 |
}
|
6564 |
+
|
6565 |
tmp = null;
|
6566 |
+
|
6567 |
return safe;
|
6568 |
},
|
6569 |
+
|
6570 |
cleanData: function( elems, /* internal */ acceptData ) {
|
6571 |
var elem, type, id, data,
|
6572 |
i = 0,
|
6574 |
cache = jQuery.cache,
|
6575 |
deleteExpando = jQuery.support.deleteExpando,
|
6576 |
special = jQuery.event.special;
|
6577 |
+
|
6578 |
for ( ; (elem = elems[i]) != null; i++ ) {
|
6579 |
+
|
6580 |
if ( acceptData || jQuery.acceptData( elem ) ) {
|
6581 |
+
|
6582 |
id = elem[ internalKey ];
|
6583 |
data = id && cache[ id ];
|
6584 |
+
|
6585 |
if ( data ) {
|
6586 |
if ( data.events ) {
|
6587 |
for ( type in data.events ) {
|
6588 |
if ( special[ type ] ) {
|
6589 |
jQuery.event.remove( elem, type );
|
6590 |
+
|
6591 |
// This is a shortcut to avoid jQuery.event.remove's overhead
|
6592 |
} else {
|
6593 |
jQuery.removeEvent( elem, type, data.handle );
|
6594 |
}
|
6595 |
}
|
6596 |
}
|
6597 |
+
|
6598 |
// Remove cache only if it was not already removed by jQuery.event.remove
|
6599 |
if ( cache[ id ] ) {
|
6600 |
+
|
6601 |
delete cache[ id ];
|
6602 |
+
|
6603 |
// IE does not allow us to delete expando properties from nodes,
|
6604 |
// nor does it have a removeAttribute function on Document nodes;
|
6605 |
// we must handle all of these cases
|
6606 |
if ( deleteExpando ) {
|
6607 |
delete elem[ internalKey ];
|
6608 |
+
|
6609 |
} else if ( typeof elem.removeAttribute !== core_strundefined ) {
|
6610 |
elem.removeAttribute( internalKey );
|
6611 |
+
|
6612 |
} else {
|
6613 |
elem[ internalKey ] = null;
|
6614 |
}
|
6615 |
+
|
6616 |
core_deletedIds.push( id );
|
6617 |
}
|
6618 |
}
|
6632 |
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
|
6633 |
rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
|
6634 |
elemdisplay = { BODY: "block" },
|
6635 |
+
|
6636 |
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
6637 |
cssNormalTransform = {
|
6638 |
letterSpacing: 0,
|
6639 |
fontWeight: 400
|
6640 |
},
|
6641 |
+
|
6642 |
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
|
6643 |
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
|
6644 |
+
|
6645 |
// return a css property mapped to a potentially vendor prefixed property
|
6646 |
function vendorPropName( style, name ) {
|
6647 |
+
|
6648 |
// shortcut for names that are not vendor prefixed
|
6649 |
if ( name in style ) {
|
6650 |
return name;
|
6651 |
}
|
6652 |
+
|
6653 |
// check for vendor prefixed names
|
6654 |
var capName = name.charAt(0).toUpperCase() + name.slice(1),
|
6655 |
origName = name,
|
6656 |
i = cssPrefixes.length;
|
6657 |
+
|
6658 |
while ( i-- ) {
|
6659 |
name = cssPrefixes[ i ] + capName;
|
6660 |
if ( name in style ) {
|
6661 |
return name;
|
6662 |
}
|
6663 |
}
|
6664 |
+
|
6665 |
return origName;
|
6666 |
}
|
6667 |
+
|
6668 |
function isHidden( elem, el ) {
|
6669 |
// isHidden might be called from jQuery#filter function;
|
6670 |
// in that case, element will be second argument
|
6671 |
elem = el || elem;
|
6672 |
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
|
6673 |
}
|
6674 |
+
|
6675 |
function showHide( elements, show ) {
|
6676 |
var display, elem, hidden,
|
6677 |
values = [],
|
6678 |
index = 0,
|
6679 |
length = elements.length;
|
6680 |
+
|
6681 |
for ( ; index < length; index++ ) {
|
6682 |
elem = elements[ index ];
|
6683 |
if ( !elem.style ) {
|
6684 |
continue;
|
6685 |
}
|
6686 |
+
|
6687 |
values[ index ] = jQuery._data( elem, "olddisplay" );
|
6688 |
display = elem.style.display;
|
6689 |
if ( show ) {
|
6692 |
if ( !values[ index ] && display === "none" ) {
|
6693 |
elem.style.display = "";
|
6694 |
}
|
6695 |
+
|
6696 |
// Set elements which have been overridden with display: none
|
6697 |
// in a stylesheet to whatever the default browser style is
|
6698 |
// for such an element
|
6700 |
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
|
6701 |
}
|
6702 |
} else {
|
6703 |
+
|
6704 |
if ( !values[ index ] ) {
|
6705 |
hidden = isHidden( elem );
|
6706 |
+
|
6707 |
if ( display && display !== "none" || !hidden ) {
|
6708 |
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
|
6709 |
}
|
6710 |
}
|
6711 |
}
|
6712 |
}
|
6713 |
+
|
6714 |
// Set the display of most of the elements in a second loop
|
6715 |
// to avoid the constant reflow
|
6716 |
for ( index = 0; index < length; index++ ) {
|
6722 |
elem.style.display = show ? values[ index ] || "" : "none";
|
6723 |
}
|
6724 |
}
|
6725 |
+
|
6726 |
return elements;
|
6727 |
}
|
6728 |
+
|
6729 |
jQuery.fn.extend({
|
6730 |
css: function( name, value ) {
|
6731 |
return jQuery.access( this, function( elem, name, value ) {
|
6732 |
var len, styles,
|
6733 |
map = {},
|
6734 |
i = 0;
|
6735 |
+
|
6736 |
if ( jQuery.isArray( name ) ) {
|
6737 |
styles = getStyles( elem );
|
6738 |
len = name.length;
|
6739 |
+
|
6740 |
for ( ; i < len; i++ ) {
|
6741 |
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
|
6742 |
}
|
6743 |
+
|
6744 |
return map;
|
6745 |
}
|
6746 |
+
|
6747 |
return value !== undefined ?
|
6748 |
jQuery.style( elem, name, value ) :
|
6749 |
jQuery.css( elem, name );
|
6757 |
},
|
6758 |
toggle: function( state ) {
|
6759 |
var bool = typeof state === "boolean";
|
6760 |
+
|
6761 |
return this.each(function() {
|
6762 |
if ( bool ? state : isHidden( this ) ) {
|
6763 |
jQuery( this ).show();
|
6767 |
});
|
6768 |
}
|
6769 |
});
|
6770 |
+
|
6771 |
jQuery.extend({
|
6772 |
// Add in style property hooks for overriding the default
|
6773 |
// behavior of getting and setting a style property
|
6782 |
}
|
6783 |
}
|
6784 |
},
|
6785 |
+
|
6786 |
// Exclude the following css properties to add px
|
6787 |
cssNumber: {
|
6788 |
"columnCount": true,
|
6795 |
"zIndex": true,
|
6796 |
"zoom": true
|
6797 |
},
|
6798 |
+
|
6799 |
// Add in properties whose names you wish to fix before
|
6800 |
// setting or getting the value
|
6801 |
cssProps: {
|
6802 |
// normalize float css property
|
6803 |
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
|
6804 |
},
|
6805 |
+
|
6806 |
// Get and set the style property on a DOM Node
|
6807 |
style: function( elem, name, value, extra ) {
|
6808 |
// Don't set styles on text and comment nodes
|
6809 |
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
6810 |
return;
|
6811 |
}
|
6812 |
+
|
6813 |
// Make sure that we're working with the right name
|
6814 |
var ret, type, hooks,
|
6815 |
origName = jQuery.camelCase( name ),
|
6816 |
style = elem.style;
|
6817 |
+
|
6818 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
|
6819 |
+
|
6820 |
// gets hook for the prefixed version
|
6821 |
// followed by the unprefixed version
|
6822 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
6823 |
+
|
6824 |
// Check if we're setting a value
|
6825 |
if ( value !== undefined ) {
|
6826 |
type = typeof value;
|
6827 |
+
|
6828 |
// convert relative number strings (+= or -=) to relative numbers. #7345
|
6829 |
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
|
6830 |
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
|
6831 |
// Fixes bug #9237
|
6832 |
type = "number";
|
6833 |
}
|
6834 |
+
|
6835 |
// Make sure that NaN and null values aren't set. See: #7116
|
6836 |
if ( value == null || type === "number" && isNaN( value ) ) {
|
6837 |
return;
|
6838 |
}
|
6839 |
+
|
6840 |
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
6841 |
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
|
6842 |
value += "px";
|
6843 |
}
|
6844 |
+
|
6845 |
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
|
6846 |
// but it would mean to define eight (for every problematic property) identical functions
|
6847 |
if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
|
6848 |
style[ name ] = "inherit";
|
6849 |
}
|
6850 |
+
|
6851 |
// If a hook was provided, use that value, otherwise just set the specified value
|
6852 |
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
|
6853 |
+
|
6854 |
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
6855 |
// Fixes bug #5509
|
6856 |
try {
|
6857 |
style[ name ] = value;
|
6858 |
} catch(e) {}
|
6859 |
}
|
6860 |
+
|
6861 |
} else {
|
6862 |
// If a hook was provided get the non-computed value from there
|
6863 |
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
6864 |
return ret;
|
6865 |
}
|
6866 |
+
|
6867 |
// Otherwise just get the value from the style object
|
6868 |
return style[ name ];
|
6869 |
}
|
6870 |
},
|
6871 |
+
|
6872 |
css: function( elem, name, extra, styles ) {
|
6873 |
var num, val, hooks,
|
6874 |
origName = jQuery.camelCase( name );
|
6875 |
+
|
6876 |
// Make sure that we're working with the right name
|
6877 |
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
|
6878 |
+
|
6879 |
// gets hook for the prefixed version
|
6880 |
// followed by the unprefixed version
|
6881 |
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
6882 |
+
|
6883 |
// If a hook was provided get the computed value from there
|
6884 |
if ( hooks && "get" in hooks ) {
|
6885 |
val = hooks.get( elem, true, extra );
|
6886 |
}
|
6887 |
+
|
6888 |
// Otherwise, if a way to get the computed value exists, use that
|
6889 |
if ( val === undefined ) {
|
6890 |
val = curCSS( elem, name, styles );
|
6891 |
}
|
6892 |
+
|
6893 |
//convert "normal" to computed value
|
6894 |
if ( val === "normal" && name in cssNormalTransform ) {
|
6895 |
val = cssNormalTransform[ name ];
|
6896 |
}
|
6897 |
+
|
6898 |
// Return, converting to number if forced or a qualifier was provided and val looks numeric
|
6899 |
if ( extra === "" || extra ) {
|
6900 |
num = parseFloat( val );
|
6902 |
}
|
6903 |
return val;
|
6904 |
},
|
6905 |
+
|
6906 |
// A method for quickly swapping in/out CSS properties to get correct calculations
|
6907 |
swap: function( elem, options, callback, args ) {
|
6908 |
var ret, name,
|
6909 |
old = {};
|
6910 |
+
|
6911 |
// Remember the old values, and insert the new ones
|
6912 |
for ( name in options ) {
|
6913 |
old[ name ] = elem.style[ name ];
|
6914 |
elem.style[ name ] = options[ name ];
|
6915 |
}
|
6916 |
+
|
6917 |
ret = callback.apply( elem, args || [] );
|
6918 |
+
|
6919 |
// Revert the old values
|
6920 |
for ( name in options ) {
|
6921 |
elem.style[ name ] = old[ name ];
|
6922 |
}
|
6923 |
+
|
6924 |
return ret;
|
6925 |
}
|
6926 |
});
|
6927 |
+
|
6928 |
// NOTE: we've included the "window" in window.getComputedStyle
|
6929 |
// because jsdom on node.js will break without it.
|
6930 |
if ( window.getComputedStyle ) {
|
6931 |
getStyles = function( elem ) {
|
6932 |
return window.getComputedStyle( elem, null );
|
6933 |
};
|
6934 |
+
|
6935 |
curCSS = function( elem, name, _computed ) {
|
6936 |
var width, minWidth, maxWidth,
|
6937 |
computed = _computed || getStyles( elem ),
|
6938 |
+
|
6939 |
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
|
6940 |
ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
|
6941 |
style = elem.style;
|
6942 |
+
|
6943 |
if ( computed ) {
|
6944 |
+
|
6945 |
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
|
6946 |
ret = jQuery.style( elem, name );
|
6947 |
}
|
6948 |
+
|
6949 |
// A tribute to the "awesome hack by Dean Edwards"
|
6950 |
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
|
6951 |
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
|
6952 |
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
6953 |
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
|
6954 |
+
|
6955 |
// Remember the original values
|
6956 |
width = style.width;
|
6957 |
minWidth = style.minWidth;
|
6958 |
maxWidth = style.maxWidth;
|
6959 |
+
|
6960 |
// Put in the new values to get a computed value out
|
6961 |
style.minWidth = style.maxWidth = style.width = ret;
|
6962 |
ret = computed.width;
|
6963 |
+
|
6964 |
// Revert the changed values
|
6965 |
style.width = width;
|
6966 |
style.minWidth = minWidth;
|
6967 |
style.maxWidth = maxWidth;
|
6968 |
}
|
6969 |
}
|
6970 |
+
|
6971 |
return ret;
|
6972 |
};
|
6973 |
} else if ( document.documentElement.currentStyle ) {
|
6974 |
getStyles = function( elem ) {
|
6975 |
return elem.currentStyle;
|
6976 |
};
|
6977 |
+
|
6978 |
curCSS = function( elem, name, _computed ) {
|
6979 |
var left, rs, rsLeft,
|
6980 |
computed = _computed || getStyles( elem ),
|
6981 |
ret = computed ? computed[ name ] : undefined,
|
6982 |
style = elem.style;
|
6983 |
+
|
6984 |
// Avoid setting ret to empty string here
|
6985 |
// so we don't default to auto
|
6986 |
if ( ret == null && style && style[ name ] ) {
|
6987 |
ret = style[ name ];
|
6988 |
}
|
6989 |
+
|
6990 |
// From the awesome hack by Dean Edwards
|
6991 |
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
6992 |
+
|
6993 |
// If we're not dealing with a regular pixel number
|
6994 |
// but a number that has a weird ending, we need to convert it to pixels
|
6995 |
// but not position css attributes, as those are proportional to the parent element instead
|
6996 |
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
|
6997 |
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
|
6998 |
+
|
6999 |
// Remember the original values
|
7000 |
left = style.left;
|
7001 |
rs = elem.runtimeStyle;
|
7002 |
rsLeft = rs && rs.left;
|
7003 |
+
|
7004 |
// Put in the new values to get a computed value out
|
7005 |
if ( rsLeft ) {
|
7006 |
rs.left = elem.currentStyle.left;
|
7007 |
}
|
7008 |
style.left = name === "fontSize" ? "1em" : ret;
|
7009 |
ret = style.pixelLeft + "px";
|
7010 |
+
|
7011 |
// Revert the changed values
|
7012 |
style.left = left;
|
7013 |
if ( rsLeft ) {
|
7014 |
rs.left = rsLeft;
|
7015 |
}
|
7016 |
}
|
7017 |
+
|
7018 |
return ret === "" ? "auto" : ret;
|
7019 |
};
|
7020 |
}
|
7021 |
+
|
7022 |
function setPositiveNumber( elem, value, subtract ) {
|
7023 |
var matches = rnumsplit.exec( value );
|
7024 |
return matches ?
|
7026 |
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
|
7027 |
value;
|
7028 |
}
|
7029 |
+
|
7030 |
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
|
7031 |
var i = extra === ( isBorderBox ? "border" : "content" ) ?
|
7032 |
// If we already have the right measurement, avoid augmentation
|
7033 |
4 :
|
7034 |
// Otherwise initialize for horizontal or vertical properties
|
7035 |
name === "width" ? 1 : 0,
|
7036 |
+
|
7037 |
val = 0;
|
7038 |
+
|
7039 |
for ( ; i < 4; i += 2 ) {
|
7040 |
// both box models exclude margin, so add it if we want it
|
7041 |
if ( extra === "margin" ) {
|
7042 |
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
|
7043 |
}
|
7044 |
+
|
7045 |
if ( isBorderBox ) {
|
7046 |
// border-box includes padding, so remove it if we want content
|
7047 |
if ( extra === "content" ) {
|
7048 |
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
7049 |
}
|
7050 |
+
|
7051 |
// at this point, extra isn't border nor margin, so remove border
|
7052 |
if ( extra !== "margin" ) {
|
7053 |
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
7055 |
} else {
|
7056 |
// at this point, extra isn't content, so add padding
|
7057 |
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
7058 |
+
|
7059 |
// at this point, extra isn't content nor padding, so add border
|
7060 |
if ( extra !== "padding" ) {
|
7061 |
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
7062 |
}
|
7063 |
}
|
7064 |
}
|
7065 |
+
|
7066 |
return val;
|
7067 |
}
|
7068 |
+
|
7069 |
function getWidthOrHeight( elem, name, extra ) {
|
7070 |
+
|
7071 |
// Start with offset property, which is equivalent to the border-box value
|
7072 |
var valueIsBorderBox = true,
|
7073 |
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
7074 |
styles = getStyles( elem ),
|
7075 |
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
7076 |
+
|
7077 |
// some non-html elements return undefined for offsetWidth, so check for null/undefined
|
7078 |
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
7079 |
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
|
7083 |
if ( val < 0 || val == null ) {
|
7084 |
val = elem.style[ name ];
|
7085 |
}
|
7086 |
+
|
7087 |
// Computed unit is not pixels. Stop here and return.
|
7088 |
if ( rnumnonpx.test(val) ) {
|
7089 |
return val;
|
7090 |
}
|
7091 |
+
|
7092 |
// we need the check for style in case a browser which returns unreliable values
|
7093 |
// for getComputedStyle silently falls back to the reliable elem.style
|
7094 |
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
|
7095 |
+
|
7096 |
// Normalize "", auto, and prepare for extra
|
7097 |
val = parseFloat( val ) || 0;
|
7098 |
}
|
7099 |
+
|
7100 |
// use the active box-sizing model to add/subtract irrelevant styles
|
7101 |
return ( val +
|
7102 |
augmentWidthOrHeight(
|
7108 |
)
|
7109 |
) + "px";
|
7110 |
}
|
7111 |
+
|
7112 |
// Try to determine the default display value of an element
|
7113 |
function css_defaultDisplay( nodeName ) {
|
7114 |
var doc = document,
|
7115 |
display = elemdisplay[ nodeName ];
|
7116 |
+
|
7117 |
if ( !display ) {
|
7118 |
display = actualDisplay( nodeName, doc );
|
7119 |
+
|
7120 |
// If the simple way fails, read from inside an iframe
|
7121 |
if ( display === "none" || !display ) {
|
7122 |
// Use the already-created iframe if possible
|
7124 |
jQuery("<iframe frameborder='0' width='0' height='0'/>")
|
7125 |
.css( "cssText", "display:block !important" )
|
7126 |
).appendTo( doc.documentElement );
|
7127 |
+
|
7128 |
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
7129 |
doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
|
7130 |
doc.write("<!doctype html><html><body>");
|
7131 |
doc.close();
|
7132 |
+
|
7133 |
display = actualDisplay( nodeName, doc );
|
7134 |
iframe.detach();
|
7135 |
}
|
7136 |
+
|
7137 |
// Store the correct default display
|
7138 |
elemdisplay[ nodeName ] = display;
|
7139 |
}
|
7140 |
+
|
7141 |
return display;
|
7142 |
}
|
7143 |
+
|
7144 |
// Called ONLY from within css_defaultDisplay
|
7145 |
function actualDisplay( name, doc ) {
|
7146 |
var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
|
7148 |
elem.remove();
|
7149 |
return display;
|
7150 |
}
|
7151 |
+
|
7152 |
jQuery.each([ "height", "width" ], function( i, name ) {
|
7153 |
jQuery.cssHooks[ name ] = {
|
7154 |
get: function( elem, computed, extra ) {
|
7162 |
getWidthOrHeight( elem, name, extra );
|
7163 |
}
|
7164 |
},
|
7165 |
+
|
7166 |
set: function( elem, value, extra ) {
|
7167 |
var styles = extra && getStyles( elem );
|
7168 |
return setPositiveNumber( elem, value, extra ?
|
7177 |
}
|
7178 |
};
|
7179 |
});
|
7180 |
+
|
7181 |
if ( !jQuery.support.opacity ) {
|
7182 |
jQuery.cssHooks.opacity = {
|
7183 |
get: function( elem, computed ) {
|
7186 |
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
|
7187 |
computed ? "1" : "";
|
7188 |
},
|
7189 |
+
|
7190 |
set: function( elem, value ) {
|
7191 |
var style = elem.style,
|
7192 |
currentStyle = elem.currentStyle,
|
7193 |
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
|
7194 |
filter = currentStyle && currentStyle.filter || style.filter || "";
|
7195 |
+
|
7196 |
// IE has trouble with opacity if it does not have layout
|
7197 |
// Force it by setting the zoom level
|
7198 |
style.zoom = 1;
|
7199 |
+
|
7200 |
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
|
7201 |
// if value === "", then remove inline opacity #12685
|
7202 |
if ( ( value >= 1 || value === "" ) &&
|
7203 |
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
|
7204 |
style.removeAttribute ) {
|
7205 |
+
|
7206 |
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
|
7207 |
// if "filter:" is present at all, clearType is disabled, we want to avoid this
|
7208 |
// style.removeAttribute is IE Only, but so apparently is this code path...
|
7209 |
style.removeAttribute( "filter" );
|
7210 |
+
|
7211 |
// if there is no filter style applied in a css rule or unset inline opacity, we are done
|
7212 |
if ( value === "" || currentStyle && !currentStyle.filter ) {
|
7213 |
return;
|
7214 |
}
|
7215 |
}
|
7216 |
+
|
7217 |
// otherwise, set new filter values
|
7218 |
style.filter = ralpha.test( filter ) ?
|
7219 |
filter.replace( ralpha, opacity ) :
|
7221 |
}
|
7222 |
};
|
7223 |
}
|
7224 |
+
|
7225 |
// These hooks cannot be added until DOM ready because the support test
|
7226 |
// for it is not run until after DOM ready
|
7227 |
jQuery(function() {
|
7237 |
}
|
7238 |
};
|
7239 |
}
|
7240 |
+
|
7241 |
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
7242 |
// getComputedStyle returns percent when specified for top/left/bottom/right
|
7243 |
// rather than make the css module depend on the offset module, we just check for it here
|
7256 |
};
|
7257 |
});
|
7258 |
}
|
7259 |
+
|
7260 |
});
|
7261 |
+
|
7262 |
if ( jQuery.expr && jQuery.expr.filters ) {
|
7263 |
jQuery.expr.filters.hidden = function( elem ) {
|
7264 |
// Support: Opera <= 12.12
|
7266 |
return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
|
7267 |
(!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
|
7268 |
};
|
7269 |
+
|
7270 |
jQuery.expr.filters.visible = function( elem ) {
|
7271 |
return !jQuery.expr.filters.hidden( elem );
|
7272 |
};
|
7273 |
}
|
7274 |
+
|
7275 |
// These hooks are used by animate to expand properties
|
7276 |
jQuery.each({
|
7277 |
margin: "",
|
7282 |
expand: function( value ) {
|
7283 |
var i = 0,
|
7284 |
expanded = {},
|
7285 |
+
|
7286 |
// assumes a single number if not a string
|
7287 |
parts = typeof value === "string" ? value.split(" ") : [ value ];
|
7288 |
+
|
7289 |
for ( ; i < 4; i++ ) {
|
7290 |
expanded[ prefix + cssExpand[ i ] + suffix ] =
|
7291 |
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
|
7292 |
}
|
7293 |
+
|
7294 |
return expanded;
|
7295 |
}
|
7296 |
};
|
7297 |
+
|
7298 |
if ( !rmargin.test( prefix ) ) {
|
7299 |
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
|
7300 |
}
|
7304 |
rCRLF = /\r?\n/g,
|
7305 |
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
|
7306 |
rsubmittable = /^(?:input|select|textarea|keygen)/i;
|
7307 |
+
|
7308 |
jQuery.fn.extend({
|
7309 |
serialize: function() {
|
7310 |
return jQuery.param( this.serializeArray() );
|
7324 |
})
|
7325 |
.map(function( i, elem ){
|
7326 |
var val = jQuery( this ).val();
|
7327 |
+
|
7328 |
return val == null ?
|
7329 |
null :
|
7330 |
jQuery.isArray( val ) ?
|
7335 |
}).get();
|
7336 |
}
|
7337 |
});
|
7338 |
+
|
7339 |
//Serialize an array of form elements or a set of
|
7340 |
//key/values into a query string
|
7341 |
jQuery.param = function( a, traditional ) {
|
7346 |
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
|
7347 |
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
|
7348 |
};
|
7349 |
+
|
7350 |
// Set traditional to true for jQuery <= 1.3.2 behavior.
|
7351 |
if ( traditional === undefined ) {
|
7352 |
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
|
7353 |
}
|
7354 |
+
|
7355 |
// If an array was passed in, assume that it is an array of form elements.
|
7356 |
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
|
7357 |
// Serialize the form elements
|
7358 |
jQuery.each( a, function() {
|
7359 |
add( this.name, this.value );
|
7360 |
});
|
7361 |
+
|
7362 |
} else {
|
7363 |
// If traditional, encode the "old" way (the way 1.3.2 or older
|
7364 |
// did it), otherwise encode params recursively.
|
7366 |
buildParams( prefix, a[ prefix ], traditional, add );
|
7367 |
}
|
7368 |
}
|
7369 |
+
|
7370 |
// Return the resulting serialization
|
7371 |
return s.join( "&" ).replace( r20, "+" );
|
7372 |
};
|
7373 |
+
|
7374 |
function buildParams( prefix, obj, traditional, add ) {
|
7375 |
var name;
|
7376 |
+
|
7377 |
if ( jQuery.isArray( obj ) ) {
|
7378 |
// Serialize array item.
|
7379 |
jQuery.each( obj, function( i, v ) {
|
7380 |
if ( traditional || rbracket.test( prefix ) ) {
|
7381 |
// Treat each array item as a scalar.
|
7382 |
add( prefix, v );
|
7383 |
+
|
7384 |
} else {
|
7385 |
// Item is non-scalar (array or object), encode its numeric index.
|
7386 |
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
|
7387 |
}
|
7388 |
});
|
7389 |
+
|
7390 |
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
|
7391 |
// Serialize object item.
|
7392 |
for ( name in obj ) {
|
7393 |
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
|
7394 |
}
|
7395 |
+
|
7396 |
} else {
|
7397 |
// Serialize scalar item.
|
7398 |
add( prefix, obj );
|
7401 |
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
|
7402 |
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
|
7403 |
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
|
7404 |
+
|
7405 |
// Handle event binding
|
7406 |
jQuery.fn[ name ] = function( data, fn ) {
|
7407 |
return arguments.length > 0 ?
|
7409 |
this.trigger( name );
|
7410 |
};
|
7411 |
});
|
7412 |
+
|
7413 |
jQuery.fn.hover = function( fnOver, fnOut ) {
|
7414 |
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
|
7415 |
};
|
7418 |
ajaxLocParts,
|
7419 |
ajaxLocation,
|
7420 |
ajax_nonce = jQuery.now(),
|
7421 |
+
|
7422 |
ajax_rquery = /\?/,
|
7423 |
rhash = /#.*$/,
|
7424 |
rts = /([?&])_=[^&]*/,
|
7428 |
rnoContent = /^(?:GET|HEAD)$/,
|
7429 |
rprotocol = /^\/\//,
|
7430 |
rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
|
7431 |
+
|
7432 |
// Keep a copy of the old load method
|
7433 |
_load = jQuery.fn.load,
|
7434 |
+
|
7435 |
/* Prefilters
|
7436 |
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
|
7437 |
* 2) These are called:
|
7442 |
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
|
7443 |
*/
|
7444 |
prefilters = {},
|
7445 |
+
|
7446 |
/* Transports bindings
|
7447 |
* 1) key is the dataType
|
7448 |
* 2) the catchall symbol "*" can be used
|
7449 |
* 3) selection will start with transport dataType and THEN go to "*" if needed
|
7450 |
*/
|
7451 |
transports = {},
|
7452 |
+
|
7453 |
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
|
7454 |
allTypes = "*/".concat("*");
|
7455 |
+
|
7456 |
// #8138, IE may throw an exception when accessing
|
7457 |
// a field from window.location if document.domain has been set
|
7458 |
try {
|
7464 |
ajaxLocation.href = "";
|
7465 |
ajaxLocation = ajaxLocation.href;
|
7466 |
}
|
7467 |
+
|
7468 |
// Segment location into parts
|
7469 |
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
|
7470 |
+
|
7471 |
+
|
7472 |
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
|
7473 |
function addToPrefiltersOrTransports( structure ) {
|
7474 |
+
|
7475 |
// dataTypeExpression is optional and defaults to "*"
|
7476 |
return function( dataTypeExpression, func ) {
|
7477 |
+
|
7478 |
if ( typeof dataTypeExpression !== "string" ) {
|
7479 |
func = dataTypeExpression;
|
7480 |
dataTypeExpression = "*";
|
7481 |
}
|
7482 |
+
|
7483 |
var dataType,
|
7484 |
i = 0,
|
7485 |
dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
|
7486 |
+
|
7487 |
if ( jQuery.isFunction( func ) ) {
|
7488 |
// For each dataType in the dataTypeExpression
|
7489 |
while ( (dataType = dataTypes[i++]) ) {
|
7491 |
if ( dataType[0] === "+" ) {
|
7492 |
dataType = dataType.slice( 1 ) || "*";
|
7493 |
(structure[ dataType ] = structure[ dataType ] || []).unshift( func );
|
7494 |
+
|
7495 |
// Otherwise append
|
7496 |
} else {
|
7497 |
(structure[ dataType ] = structure[ dataType ] || []).push( func );
|
7500 |
}
|
7501 |
};
|
7502 |
}
|
7503 |
+
|
7504 |
// Base inspection function for prefilters and transports
|
7505 |
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
|
7506 |
+
|
7507 |
var inspected = {},
|
7508 |
seekingTransport = ( structure === transports );
|
7509 |
+
|
7510 |
function inspect( dataType ) {
|
7511 |
var selected;
|
7512 |
inspected[ dataType ] = true;
|
7522 |
});
|
7523 |
return selected;
|
7524 |
}
|
7525 |
+
|
7526 |
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
|
7527 |
}
|
7528 |
+
|
7529 |
// A special extend for ajax options
|
7530 |
// that takes "flat" options (not to be deep extended)
|
7531 |
// Fixes #9887
|
7532 |
function ajaxExtend( target, src ) {
|
7533 |
var deep, key,
|
7534 |
flatOptions = jQuery.ajaxSettings.flatOptions || {};
|
7535 |
+
|
7536 |
for ( key in src ) {
|
7537 |
if ( src[ key ] !== undefined ) {
|
7538 |
( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
|
7541 |
if ( deep ) {
|
7542 |
jQuery.extend( true, target, deep );
|
7543 |
}
|
7544 |
+
|
7545 |
return target;
|
7546 |
}
|
7547 |
+
|
7548 |
jQuery.fn.load = function( url, params, callback ) {
|
7549 |
if ( typeof url !== "string" && _load ) {
|
7550 |
return _load.apply( this, arguments );
|
7551 |
}
|
7552 |
+
|
7553 |
var selector, response, type,
|
7554 |
self = this,
|
7555 |
off = url.indexOf(" ");
|
7556 |
+
|
7557 |
if ( off >= 0 ) {
|
7558 |
selector = url.slice( off, url.length );
|
7559 |
url = url.slice( 0, off );
|
7560 |
}
|
7561 |
+
|
7562 |
// If it's a function
|
7563 |
if ( jQuery.isFunction( params ) ) {
|
7564 |
+
|
7565 |
// We assume that it's the callback
|
7566 |
callback = params;
|
7567 |
params = undefined;
|
7568 |
+
|
7569 |
// Otherwise, build a param string
|
7570 |
} else if ( params && typeof params === "object" ) {
|
7571 |
type = "POST";
|
7572 |
}
|
7573 |
+
|
7574 |
// If we have elements to modify, make the request
|
7575 |
if ( self.length > 0 ) {
|
7576 |
jQuery.ajax({
|
7577 |
url: url,
|
7578 |
+
|
7579 |
// if "type" variable is undefined, then "GET" method will be used
|
7580 |
type: type,
|
7581 |
dataType: "html",
|
7582 |
data: params
|
7583 |
}).done(function( responseText ) {
|
7584 |
+
|
7585 |
// Save response for use in complete callback
|
7586 |
response = arguments;
|
7587 |
+
|
7588 |
self.html( selector ?
|
7589 |
+
|
7590 |
// If a selector was specified, locate the right elements in a dummy div
|
7591 |
// Exclude scripts to avoid IE 'Permission Denied' errors
|
7592 |
jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
|
7593 |
+
|
7594 |
// Otherwise use the full result
|
7595 |
responseText );
|
7596 |
+
|
7597 |
}).complete( callback && function( jqXHR, status ) {
|
7598 |
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
|
7599 |
});
|
7600 |
}
|
7601 |
+
|
7602 |
return this;
|
7603 |
};
|
7604 |
+
|
7605 |
// Attach a bunch of functions for handling common AJAX events
|
7606 |
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
|
7607 |
jQuery.fn[ type ] = function( fn ){
|
7608 |
return this.on( type, fn );
|
7609 |
};
|
7610 |
});
|
7611 |
+
|
7612 |
jQuery.each( [ "get", "post" ], function( i, method ) {
|
7613 |
jQuery[ method ] = function( url, data, callback, type ) {
|
7614 |
// shift arguments if data argument was omitted
|
7617 |
callback = data;
|
7618 |
data = undefined;
|
7619 |
}
|
7620 |
+
|
7621 |
return jQuery.ajax({
|
7622 |
url: url,
|
7623 |
type: method,
|
7627 |
});
|
7628 |
};
|
7629 |
});
|
7630 |
+
|
7631 |
jQuery.extend({
|
7632 |
+
|
7633 |
// Counter for holding the number of active queries
|
7634 |
active: 0,
|
7635 |
+
|
7636 |
// Last-Modified header cache for next request
|
7637 |
lastModified: {},
|
7638 |
etag: {},
|
7639 |
+
|
7640 |
ajaxSettings: {
|
7641 |
url: ajaxLocation,
|
7642 |
type: "GET",
|
7656 |
traditional: false,
|
7657 |
headers: {},
|
7658 |
*/
|
7659 |
+
|
7660 |
accepts: {
|
7661 |
"*": allTypes,
|
7662 |
text: "text/plain",
|
7664 |
xml: "application/xml, text/xml",
|
7665 |
json: "application/json, text/javascript"
|
7666 |
},
|
7667 |
+
|
7668 |
contents: {
|
7669 |
xml: /xml/,
|
7670 |
html: /html/,
|
7671 |
json: /json/
|
7672 |
},
|
7673 |
+
|
7674 |
responseFields: {
|
7675 |
xml: "responseXML",
|
7676 |
text: "responseText"
|
7677 |
},
|
7678 |
+
|
7679 |
// Data converters
|
7680 |
// Keys separate source (or catchall "*") and destination types with a single space
|
7681 |
converters: {
|
7682 |
+
|
7683 |
// Convert anything to text
|
7684 |
"* text": window.String,
|
7685 |
+
|
7686 |
// Text to html (true = no transformation)
|
7687 |
"text html": true,
|
7688 |
+
|
7689 |
// Evaluate text as a json expression
|
7690 |
"text json": jQuery.parseJSON,
|
7691 |
+
|
7692 |
// Parse text as xml
|
7693 |
"text xml": jQuery.parseXML
|
7694 |
},
|
7695 |
+
|
7696 |
// For options that shouldn't be deep extended:
|
7697 |
// you can add your own custom options here if
|
7698 |
// and when you create one that shouldn't be
|
7702 |
context: true
|
7703 |
}
|
7704 |
},
|
7705 |
+
|
7706 |
// Creates a full fledged settings object into target
|
7707 |
// with both ajaxSettings and settings fields.
|
7708 |
// If target is omitted, writes into ajaxSettings.
|
7709 |
ajaxSetup: function( target, settings ) {
|
7710 |
return settings ?
|
7711 |
+
|
7712 |
// Building a settings object
|
7713 |
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
|
7714 |
+
|
7715 |
// Extending ajaxSettings
|
7716 |
ajaxExtend( jQuery.ajaxSettings, target );
|
7717 |
},
|
7718 |
+
|
7719 |
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
|
7720 |
ajaxTransport: addToPrefiltersOrTransports( transports ),
|
7721 |
+
|
7722 |
// Main method
|
7723 |
ajax: function( url, options ) {
|
7724 |
+
|
7725 |
// If url is an object, simulate pre-1.5 signature
|
7726 |
if ( typeof url === "object" ) {
|
7727 |
options = url;
|
7728 |
url = undefined;
|
7729 |
}
|
7730 |
+
|
7731 |
// Force options to be an object
|
7732 |
options = options || {};
|
7733 |
+
|
7734 |
var // Cross-domain detection vars
|
7735 |
parts,
|
7736 |
// Loop variable
|
7741 |
responseHeadersString,
|
7742 |
// timeout handle
|
7743 |
timeoutTimer,
|
7744 |
+
|
7745 |
// To know if global events are to be dispatched
|
7746 |
fireGlobals,
|
7747 |
+
|
7748 |
transport,
|
7749 |
// Response headers
|
7750 |
responseHeaders,
|
7771 |
// Fake xhr
|
7772 |
jqXHR = {
|
7773 |
readyState: 0,
|
7774 |
+
|
7775 |
// Builds headers hashtable if needed
|
7776 |
getResponseHeader: function( key ) {
|
7777 |
var match;
|
7786 |
}
|
7787 |
return match == null ? null : match;
|
7788 |
},
|
7789 |
+
|
7790 |
// Raw string
|
7791 |
getAllResponseHeaders: function() {
|
7792 |
return state === 2 ? responseHeadersString : null;
|
7793 |
},
|
7794 |
+
|
7795 |
// Caches the header
|
7796 |
setRequestHeader: function( name, value ) {
|
7797 |
var lname = name.toLowerCase();
|
7801 |
}
|
7802 |
return this;
|
7803 |
},
|
7804 |
+
|
7805 |
// Overrides response content-type header
|
7806 |
overrideMimeType: function( type ) {
|
7807 |
if ( !state ) {
|
7809 |
}
|
7810 |
return this;
|
7811 |
},
|
7812 |
+
|
7813 |
// Status-dependent callbacks
|
7814 |
statusCode: function( map ) {
|
7815 |
var code;
|
7826 |
}
|
7827 |
return this;
|
7828 |
},
|
7829 |
+
|
7830 |
// Cancel the request
|
7831 |
abort: function( statusText ) {
|
7832 |
var finalText = statusText || strAbort;
|
7837 |
return this;
|
7838 |
}
|
7839 |
};
|
7840 |
+
|
7841 |
// Attach deferreds
|
7842 |
deferred.promise( jqXHR ).complete = completeDeferred.add;
|
7843 |
jqXHR.success = jqXHR.done;
|
7844 |
jqXHR.error = jqXHR.fail;
|
7845 |
+
|
7846 |
// Remove hash character (#7531: and string promotion)
|
7847 |
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
|
7848 |
// Handle falsy url in the settings object (#10093: consistency with old signature)
|
7849 |
// We also use the url parameter if available
|
7850 |
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
|
7851 |
+
|
7852 |
// Alias method option to type as per ticket #12004
|
7853 |
s.type = options.method || options.type || s.method || s.type;
|
7854 |
+
|
7855 |
// Extract dataTypes list
|
7856 |
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
|
7857 |
+
|
7858 |
// A cross-domain request is in order when we have a protocol:host:port mismatch
|
7859 |
if ( s.crossDomain == null ) {
|
7860 |
parts = rurl.exec( s.url.toLowerCase() );
|
7864 |
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
|
7865 |
);
|
7866 |
}
|
7867 |
+
|
7868 |
// Convert data if not already a string
|
7869 |
if ( s.data && s.processData && typeof s.data !== "string" ) {
|
7870 |
s.data = jQuery.param( s.data, s.traditional );
|
7871 |
}
|
7872 |
+
|
7873 |
// Apply prefilters
|
7874 |
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
|
7875 |
+
|
7876 |
// If request was aborted inside a prefilter, stop there
|
7877 |
if ( state === 2 ) {
|
7878 |
return jqXHR;
|
7879 |
}
|
7880 |
+
|
7881 |
// We can fire global events as of now if asked to
|
7882 |
fireGlobals = s.global;
|
7883 |
+
|
7884 |
// Watch for a new set of requests
|
7885 |
if ( fireGlobals && jQuery.active++ === 0 ) {
|
7886 |
jQuery.event.trigger("ajaxStart");
|
7887 |
}
|
7888 |
+
|
7889 |
// Uppercase the type
|
7890 |
s.type = s.type.toUpperCase();
|
7891 |
+
|
7892 |
// Determine if request has content
|
7893 |
s.hasContent = !rnoContent.test( s.type );
|
7894 |
+
|
7895 |
// Save the URL in case we're toying with the If-Modified-Since
|
7896 |
// and/or If-None-Match header later on
|
7897 |
cacheURL = s.url;
|
7898 |
+
|
7899 |
// More options handling for requests with no content
|
7900 |
if ( !s.hasContent ) {
|
7901 |
+
|
7902 |
// If data is available, append data to url
|
7903 |
if ( s.data ) {
|
7904 |
cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
|
7905 |
// #9682: remove data so that it's not used in an eventual retry
|
7906 |
delete s.data;
|
7907 |
}
|
7908 |
+
|
7909 |
// Add anti-cache in url if needed
|
7910 |
if ( s.cache === false ) {
|
7911 |
s.url = rts.test( cacheURL ) ?
|
7912 |
+
|
7913 |
// If there is already a '_' parameter, set its value
|
7914 |
cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
|
7915 |
+
|
7916 |
// Otherwise add one to the end
|
7917 |
cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
|
7918 |
}
|
7919 |
}
|
7920 |
+
|
7921 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
7922 |
if ( s.ifModified ) {
|
7923 |
if ( jQuery.lastModified[ cacheURL ] ) {
|
7927 |
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
|
7928 |
}
|
7929 |
}
|
7930 |
+
|
7931 |
// Set the correct header, if data is being sent
|
7932 |
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
|
7933 |
jqXHR.setRequestHeader( "Content-Type", s.contentType );
|
7934 |
}
|
7935 |
+
|
7936 |
// Set the Accepts header for the server, depending on the dataType
|
7937 |
jqXHR.setRequestHeader(
|
7938 |
"Accept",
|
7940 |
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
|
7941 |
s.accepts[ "*" ]
|
7942 |
);
|
7943 |
+
|
7944 |
// Check for headers option
|
7945 |
for ( i in s.headers ) {
|
7946 |
jqXHR.setRequestHeader( i, s.headers[ i ] );
|
7947 |
}
|
7948 |
+
|
7949 |
// Allow custom headers/mimetypes and early abort
|
7950 |
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
|
7951 |
// Abort if not done already and return
|
7952 |
return jqXHR.abort();
|
7953 |
}
|
7954 |
+
|
7955 |
// aborting is no longer a cancellation
|
7956 |
strAbort = "abort";
|
7957 |
+
|
7958 |
// Install callbacks on deferreds
|
7959 |
for ( i in { success: 1, error: 1, complete: 1 } ) {
|
7960 |
jqXHR[ i ]( s[ i ] );
|
7961 |
}
|
7962 |
+
|
7963 |
// Get transport
|
7964 |
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
|
7965 |
+
|
7966 |
// If no transport, we auto-abort
|
7967 |
if ( !transport ) {
|
7968 |
done( -1, "No Transport" );
|
7969 |
} else {
|
7970 |
jqXHR.readyState = 1;
|
7971 |
+
|
7972 |
// Send global event
|
7973 |
if ( fireGlobals ) {
|
7974 |
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
|
7979 |
jqXHR.abort("timeout");
|
7980 |
}, s.timeout );
|
7981 |
}
|
7982 |
+
|
7983 |
try {
|
7984 |
state = 1;
|
7985 |
transport.send( requestHeaders, done );
|
7993 |
}
|
7994 |
}
|
7995 |
}
|
7996 |
+
|
7997 |
// Callback for when everything is done
|
7998 |
function done( status, nativeStatusText, responses, headers ) {
|
7999 |
var isSuccess, success, error, response, modified,
|
8000 |
statusText = nativeStatusText;
|
8001 |
+
|
8002 |
// Called once
|
8003 |
if ( state === 2 ) {
|
8004 |
return;
|
8005 |
}
|
8006 |
+
|
8007 |
// State is "done" now
|
8008 |
state = 2;
|
8009 |
+
|
8010 |
// Clear timeout if it exists
|
8011 |
if ( timeoutTimer ) {
|
8012 |
clearTimeout( timeoutTimer );
|
8013 |
}
|
8014 |
+
|
8015 |
// Dereference transport for early garbage collection
|
8016 |
// (no matter how long the jqXHR object will be used)
|
8017 |
transport = undefined;
|
8018 |
+
|
8019 |
// Cache response headers
|
8020 |
responseHeadersString = headers || "";
|
8021 |
+
|
8022 |
// Set readyState
|
8023 |
jqXHR.readyState = status > 0 ? 4 : 0;
|
8024 |
+
|
8025 |
// Get response data
|
8026 |
if ( responses ) {
|
8027 |
response = ajaxHandleResponses( s, jqXHR, responses );
|
8028 |
}
|
8029 |
+
|
8030 |
// If successful, handle type chaining
|
8031 |
if ( status >= 200 && status < 300 || status === 304 ) {
|
8032 |
+
|
8033 |
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
|
8034 |
if ( s.ifModified ) {
|
8035 |
modified = jqXHR.getResponseHeader("Last-Modified");
|
8041 |
jQuery.etag[ cacheURL ] = modified;
|
8042 |
}
|
8043 |
}
|
8044 |
+
|
8045 |
// if no content
|
8046 |
if ( status === 204 ) {
|
8047 |
isSuccess = true;
|
8048 |
statusText = "nocontent";
|
8049 |
+
|
8050 |
// if not modified
|
8051 |
} else if ( status === 304 ) {
|
8052 |
isSuccess = true;
|
8053 |
statusText = "notmodified";
|
8054 |
+
|
8055 |
// If we have data, let's convert it
|
8056 |
} else {
|
8057 |
isSuccess = ajaxConvert( s, response );
|
8071 |
}
|
8072 |
}
|
8073 |
}
|
8074 |
+
|
8075 |
// Set data for the fake xhr object
|
8076 |
jqXHR.status = status;
|
8077 |
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
|
8078 |
+
|
8079 |
// Success/Error
|
8080 |
if ( isSuccess ) {
|
8081 |
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
|
8082 |
} else {
|
8083 |
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
|
8084 |
}
|
8085 |
+
|
8086 |
// Status-dependent callbacks
|
8087 |
jqXHR.statusCode( statusCode );
|
8088 |
statusCode = undefined;
|
8089 |
+
|
8090 |
if ( fireGlobals ) {
|
8091 |
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
|
8092 |
[ jqXHR, s, isSuccess ? success : error ] );
|
8093 |
}
|
8094 |
+
|
8095 |
// Complete
|
8096 |
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
|
8097 |
+
|
8098 |
if ( fireGlobals ) {
|
8099 |
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
|
8100 |
// Handle the global AJAX counter
|
8103 |
}
|
8104 |
}
|
8105 |
}
|
8106 |
+
|
8107 |
return jqXHR;
|
8108 |
},
|
8109 |
+
|
8110 |
getScript: function( url, callback ) {
|
8111 |
return jQuery.get( url, undefined, callback, "script" );
|
8112 |
},
|
8113 |
+
|
8114 |
getJSON: function( url, data, callback ) {
|
8115 |
return jQuery.get( url, data, callback, "json" );
|
8116 |
}
|
8117 |
});
|
8118 |
+
|
8119 |
/* Handles responses to an ajax request:
|
8120 |
* - sets all responseXXX fields accordingly
|
8121 |
* - finds the right dataType (mediates between content-type and expected dataType)
|
8126 |
contents = s.contents,
|
8127 |
dataTypes = s.dataTypes,
|
8128 |
responseFields = s.responseFields;
|
8129 |
+
|
8130 |
// Fill responseXXX fields
|
8131 |
for ( type in responseFields ) {
|
8132 |
if ( type in responses ) {
|
8133 |
jqXHR[ responseFields[type] ] = responses[ type ];
|
8134 |
}
|
8135 |
}
|
8136 |
+
|
8137 |
// Remove auto dataType and get content-type in the process
|
8138 |
while( dataTypes[ 0 ] === "*" ) {
|
8139 |
dataTypes.shift();
|
8141 |
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
|
8142 |
}
|
8143 |
}
|
8144 |
+
|
8145 |
// Check if we're dealing with a known content-type
|
8146 |
if ( ct ) {
|
8147 |
for ( type in contents ) {
|
8151 |
}
|
8152 |
}
|
8153 |
}
|
8154 |
+
|
8155 |
// Check to see if we have a response for the expected dataType
|
8156 |
if ( dataTypes[ 0 ] in responses ) {
|
8157 |
finalDataType = dataTypes[ 0 ];
|
8169 |
// Or just use first one
|
8170 |
finalDataType = finalDataType || firstDataType;
|
8171 |
}
|
8172 |
+
|
8173 |
// If we found a dataType
|
8174 |
// We add the dataType to the list if needed
|
8175 |
// and return the corresponding response
|
8180 |
return responses[ finalDataType ];
|
8181 |
}
|
8182 |
}
|
8183 |
+
|
8184 |
// Chain conversions given the request and the original response
|
8185 |
function ajaxConvert( s, response ) {
|
8186 |
var conv2, current, conv, tmp,
|
8189 |
// Work with a copy of dataTypes in case we need to modify it for conversion
|
8190 |
dataTypes = s.dataTypes.slice(),
|
8191 |
prev = dataTypes[ 0 ];
|
8192 |
+
|
8193 |
// Apply the dataFilter if provided
|
8194 |
if ( s.dataFilter ) {
|
8195 |
response = s.dataFilter( response, s.dataType );
|
8196 |
}
|
8197 |
+
|
8198 |
// Create converters map with lowercased keys
|
8199 |
if ( dataTypes[ 1 ] ) {
|
8200 |
for ( conv in s.converters ) {
|
8201 |
converters[ conv.toLowerCase() ] = s.converters[ conv ];
|
8202 |
}
|
8203 |
}
|
8204 |
+
|
8205 |
// Convert to each sequential dataType, tolerating list modification
|
8206 |
for ( ; (current = dataTypes[++i]); ) {
|
8207 |
+
|
8208 |
// There's only work to do if current dataType is non-auto
|
8209 |
if ( current !== "*" ) {
|
8210 |
+
|
8211 |
// Convert response if prev dataType is non-auto and differs from current
|
8212 |
if ( prev !== "*" && prev !== current ) {
|
8213 |
+
|
8214 |
// Seek a direct converter
|
8215 |
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
|
8216 |
+
|
8217 |
// If none found, seek a pair
|
8218 |
if ( !conv ) {
|
8219 |
for ( conv2 in converters ) {
|
8220 |
+
|
8221 |
// If conv2 outputs current
|
8222 |
tmp = conv2.split(" ");
|
8223 |
if ( tmp[ 1 ] === current ) {
|
8224 |
+
|
8225 |
// If prev can be converted to accepted input
|
8226 |
conv = converters[ prev + " " + tmp[ 0 ] ] ||
|
8227 |
converters[ "* " + tmp[ 0 ] ];
|
8229 |
// Condense equivalence converters
|
8230 |
if ( conv === true ) {
|
8231 |
conv = converters[ conv2 ];
|
8232 |
+
|
8233 |
// Otherwise, insert the intermediate dataType
|
8234 |
} else if ( converters[ conv2 ] !== true ) {
|
8235 |
current = tmp[ 0 ];
|
8236 |
dataTypes.splice( i--, 0, current );
|
8237 |
}
|
8238 |
+
|
8239 |
break;
|
8240 |
}
|
8241 |
}
|
8242 |
}
|
8243 |
}
|
8244 |
+
|
8245 |
// Apply converter (if not an equivalence)
|
8246 |
if ( conv !== true ) {
|
8247 |
+
|
8248 |
// Unless errors are allowed to bubble, catch and return them
|
8249 |
if ( conv && s["throws"] ) {
|
8250 |
response = conv( response );
|
8257 |
}
|
8258 |
}
|
8259 |
}
|
8260 |
+
|
8261 |
// Update prev for next iteration
|
8262 |
prev = current;
|
8263 |
}
|
8264 |
}
|
8265 |
+
|
8266 |
return { state: "success", data: response };
|
8267 |
}
|
8268 |
// Install script dataType
|
8280 |
}
|
8281 |
}
|
8282 |
});
|
8283 |
+
|
8284 |
// Handle cache's special case and global
|
8285 |
jQuery.ajaxPrefilter( "script", function( s ) {
|
8286 |
if ( s.cache === undefined ) {
|
8291 |
s.global = false;
|
8292 |
}
|
8293 |
});
|
8294 |
+
|
8295 |
// Bind script tag hack transport
|
8296 |
jQuery.ajaxTransport( "script", function(s) {
|
8297 |
+
|
8298 |
// This transport only deals with cross domain requests
|
8299 |
if ( s.crossDomain ) {
|
8300 |
+
|
8301 |
var script,
|
8302 |
head = document.head || jQuery("head")[0] || document.documentElement;
|
8303 |
+
|
8304 |
return {
|
8305 |
+
|
8306 |
send: function( _, callback ) {
|
8307 |
+
|
8308 |
script = document.createElement("script");
|
8309 |
+
|
8310 |
script.async = true;
|
8311 |
+
|
8312 |
if ( s.scriptCharset ) {
|
8313 |
script.charset = s.scriptCharset;
|
8314 |
}
|
8315 |
+
|
8316 |
script.src = s.url;
|
8317 |
+
|
8318 |
// Attach handlers for all browsers
|
8319 |
script.onload = script.onreadystatechange = function( _, isAbort ) {
|
8320 |
+
|
8321 |
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
|
8322 |
+
|
8323 |
// Handle memory leak in IE
|
8324 |
script.onload = script.onreadystatechange = null;
|
8325 |
+
|
8326 |
// Remove the script
|
8327 |
if ( script.parentNode ) {
|
8328 |
script.parentNode.removeChild( script );
|
8329 |
}
|
8330 |
+
|
8331 |
// Dereference the script
|
8332 |
script = null;
|
8333 |
+
|
8334 |
// Callback if not abort
|
8335 |
if ( !isAbort ) {
|
8336 |
callback( 200, "success" );
|
8337 |
}
|
8338 |
}
|
8339 |
};
|
8340 |
+
|
8341 |
// Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
|
8342 |
// Use native DOM manipulation to avoid our domManip AJAX trickery
|
8343 |
head.insertBefore( script, head.firstChild );
|
8344 |
},
|
8345 |
+
|
8346 |
abort: function() {
|
8347 |
if ( script ) {
|
8348 |
script.onload( undefined, true );
|
8353 |
});
|
8354 |
var oldCallbacks = [],
|
8355 |
rjsonp = /(=)\?(?=&|$)|\?\?/;
|
8356 |
+
|
8357 |
// Default jsonp settings
|
8358 |
jQuery.ajaxSetup({
|
8359 |
jsonp: "callback",
|
8363 |
return callback;
|
8364 |
}
|
8365 |
});
|
8366 |
+
|
8367 |
// Detect, normalize options and install callbacks for jsonp requests
|
8368 |
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
|
8369 |
+
|
8370 |
var callbackName, overwritten, responseContainer,
|
8371 |
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
|
8372 |
"url" :
|
8373 |
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
|
8374 |
);
|
8375 |
+
|
8376 |
// Handle iff the expected data type is "jsonp" or we have a parameter to set
|
8377 |
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
|
8378 |
+
|
8379 |
// Get callback name, remembering preexisting value associated with it
|
8380 |
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
|
8381 |
s.jsonpCallback() :
|
8382 |
s.jsonpCallback;
|
8383 |
+
|
8384 |
// Insert callback into url or form data
|
8385 |
if ( jsonProp ) {
|
8386 |
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
|
8387 |
} else if ( s.jsonp !== false ) {
|
8388 |
s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
|
8389 |
}
|
8390 |
+
|
8391 |
// Use data converter to retrieve json after script execution
|
8392 |
s.converters["script json"] = function() {
|
8393 |
if ( !responseContainer ) {
|
8395 |
}
|
8396 |
return responseContainer[ 0 ];
|
8397 |
};
|
8398 |
+
|
8399 |
// force json dataType
|
8400 |
s.dataTypes[ 0 ] = "json";
|
8401 |
+
|
8402 |
// Install callback
|
8403 |
overwritten = window[ callbackName ];
|
8404 |
window[ callbackName ] = function() {
|
8405 |
responseContainer = arguments;
|
8406 |
};
|
8407 |
+
|
8408 |
// Clean-up function (fires after converters)
|
8409 |
jqXHR.always(function() {
|
8410 |
// Restore preexisting value
|
8411 |
window[ callbackName ] = overwritten;
|
8412 |
+
|
8413 |
// Save back as free
|
8414 |
if ( s[ callbackName ] ) {
|
8415 |
// make sure that re-using the options doesn't screw things around
|
8416 |
s.jsonpCallback = originalSettings.jsonpCallback;
|
8417 |
+
|
8418 |
// save the callback name for future use
|
8419 |
oldCallbacks.push( callbackName );
|
8420 |
}
|
8421 |
+
|
8422 |
// Call if it was a function and we have a response
|
8423 |
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
|
8424 |
overwritten( responseContainer[ 0 ] );
|
8425 |
}
|
8426 |
+
|
8427 |
responseContainer = overwritten = undefined;
|
8428 |
});
|
8429 |
+
|
8430 |
// Delegate to script
|
8431 |
return "script";
|
8432 |
}
|
8441 |
xhrCallbacks[ key ]( undefined, true );
|
8442 |
}
|
8443 |
};
|
8444 |
+
|
8445 |
// Functions to create xhrs
|
8446 |
function createStandardXHR() {
|
8447 |
try {
|
8448 |
return new window.XMLHttpRequest();
|
8449 |
} catch( e ) {}
|
8450 |
}
|
8451 |
+
|
8452 |
function createActiveXHR() {
|
8453 |
try {
|
8454 |
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
8455 |
} catch( e ) {}
|
8456 |
}
|
8457 |
+
|
8458 |
// Create the request object
|
8459 |
// (This is still attached to ajaxSettings for backward compatibility)
|
8460 |
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
|
8469 |
} :
|
8470 |
// For all other browsers, use the standard XMLHttpRequest object
|
8471 |
createStandardXHR;
|
8472 |
+
|
8473 |
// Determine support properties
|
8474 |
xhrSupported = jQuery.ajaxSettings.xhr();
|
8475 |
jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
8476 |
xhrSupported = jQuery.support.ajax = !!xhrSupported;
|
8477 |
+
|
8478 |
// Create transport if the browser can provide an xhr
|
8479 |
if ( xhrSupported ) {
|
8480 |
+
|
8481 |
jQuery.ajaxTransport(function( s ) {
|
8482 |
// Cross domain only allowed if supported through XMLHttpRequest
|
8483 |
if ( !s.crossDomain || jQuery.support.cors ) {
|
8484 |
+
|
8485 |
var callback;
|
8486 |
+
|
8487 |
return {
|
8488 |
send: function( headers, complete ) {
|
8489 |
+
|
8490 |
// Get a new xhr
|
8491 |
var handle, i,
|
8492 |
xhr = s.xhr();
|
8493 |
+
|
8494 |
// Open the socket
|
8495 |
// Passing null username, generates a login popup on Opera (#2865)
|
8496 |
if ( s.username ) {
|
8498 |
} else {
|
8499 |
xhr.open( s.type, s.url, s.async );
|
8500 |
}
|
8501 |
+
|
8502 |
// Apply custom fields if provided
|
8503 |
if ( s.xhrFields ) {
|
8504 |
for ( i in s.xhrFields ) {
|
8505 |
xhr[ i ] = s.xhrFields[ i ];
|
8506 |
}
|
8507 |
}
|
8508 |
+
|
8509 |
+
|
8510 |
// Override mime type if needed
|
8511 |
if ( s.mimeType && xhr.overrideMimeType ) {
|
8512 |
xhr.overrideMimeType( s.mimeType );
|
8513 |
}
|
8514 |
+
|
8515 |
// X-Requested-With header
|
8516 |
// For cross-domain requests, seeing as conditions for a preflight are
|
8517 |
// akin to a jigsaw puzzle, we simply never set it to be sure.
|
8520 |
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
|
8521 |
headers["X-Requested-With"] = "XMLHttpRequest";
|
8522 |
}
|
8523 |
+
|
8524 |
// Need an extra try/catch for cross domain requests in Firefox 3
|
8525 |
try {
|
8526 |
for ( i in headers ) {
|
8527 |
xhr.setRequestHeader( i, headers[ i ] );
|
8528 |
}
|
8529 |
} catch( err ) {}
|
8530 |
+
|
8531 |
// Do send the request
|
8532 |
// This may raise an exception which is actually
|
8533 |
// handled in jQuery.ajax (so no try/catch here)
|
8534 |
xhr.send( ( s.hasContent && s.data ) || null );
|
8535 |
+
|
8536 |
// Listener
|
8537 |
callback = function( _, isAbort ) {
|
8538 |
var status, responseHeaders, statusText, responses;
|
8539 |
+
|
8540 |
// Firefox throws exceptions when accessing properties
|
8541 |
// of an xhr when a network error occurred
|
8542 |
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
|
8543 |
try {
|
8544 |
+
|
8545 |
// Was never called and is aborted or complete
|
8546 |
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
|
8547 |
+
|
8548 |
// Only called once
|
8549 |
callback = undefined;
|
8550 |
+
|
8551 |
// Do not keep as active anymore
|
8552 |
if ( handle ) {
|
8553 |
xhr.onreadystatechange = jQuery.noop;
|
8555 |
delete xhrCallbacks[ handle ];
|
8556 |
}
|
8557 |
}
|
8558 |
+
|
8559 |
// If it's an abort
|
8560 |
if ( isAbort ) {
|
8561 |
// Abort it manually if needed
|
8566 |
responses = {};
|
8567 |
status = xhr.status;
|
8568 |
responseHeaders = xhr.getAllResponseHeaders();
|
8569 |
+
|
8570 |
// When requesting binary data, IE6-9 will throw an exception
|
8571 |
// on any attempt to access responseText (#11426)
|
8572 |
if ( typeof xhr.responseText === "string" ) {
|
8573 |
responses.text = xhr.responseText;
|
8574 |
}
|
8575 |
+
|
8576 |
// Firefox throws an exception when accessing
|
8577 |
// statusText for faulty cross-domain requests
|
8578 |
try {
|
8581 |
// We normalize with Webkit giving an empty statusText
|
8582 |
statusText = "";
|
8583 |
}
|
8584 |
+
|
8585 |
// Filter status for non standard behaviors
|
8586 |
+
|
8587 |
// If the request is local and we have data: assume a success
|
8588 |
// (success with no data won't get notified, that's the best we
|
8589 |
// can do given current implementations)
|
8600 |
complete( -1, firefoxAccessException );
|
8601 |
}
|
8602 |
}
|
8603 |
+
|
8604 |
// Call complete if needed
|
8605 |
if ( responses ) {
|
8606 |
complete( status, statusText, responses, responseHeaders );
|
8607 |
}
|
8608 |
};
|
8609 |
+
|
8610 |
if ( !s.async ) {
|
8611 |
// if we're in sync mode we fire the callback
|
8612 |
callback();
|
8629 |
xhr.onreadystatechange = callback;
|
8630 |
}
|
8631 |
},
|
8632 |
+
|
8633 |
abort: function() {
|
8634 |
if ( callback ) {
|
8635 |
callback( undefined, true );
|
8653 |
start = +target || 0,
|
8654 |
scale = 1,
|
8655 |
maxIterations = 20;
|
8656 |
+
|
8657 |
if ( parts ) {
|
8658 |
end = +parts[2];
|
8659 |
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
|
8660 |
+
|
8661 |
// We need to compute starting value
|
8662 |
if ( unit !== "px" && start ) {
|
8663 |
// Iteratively approximate from a nonzero starting point
|
8664 |
// Prefer the current property, because this process will be trivial if it uses the same units
|
8665 |
// Fallback to end or a simple constant
|
8666 |
start = jQuery.css( tween.elem, prop, true ) || end || 1;
|
8667 |
+
|
8668 |
do {
|
8669 |
// If previous iteration zeroed out, double until we get *something*
|
8670 |
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
|
8671 |
scale = scale || ".5";
|
8672 |
+
|
8673 |
// Adjust and apply
|
8674 |
start = start / scale;
|
8675 |
jQuery.style( tween.elem, prop, start + unit );
|
8676 |
+
|
8677 |
// Update scale, tolerating zero or NaN from tween.cur()
|
8678 |
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
|
8679 |
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
|
8680 |
}
|
8681 |
+
|
8682 |
tween.unit = unit;
|
8683 |
tween.start = start;
|
8684 |
// If a +=/-= token was provided, we're doing a relative animation
|
8687 |
return tween;
|
8688 |
}]
|
8689 |
};
|
8690 |
+
|
8691 |
// Animations created synchronously will run synchronously
|
8692 |
function createFxNow() {
|
8693 |
setTimeout(function() {
|
8695 |
});
|
8696 |
return ( fxNow = jQuery.now() );
|
8697 |
}
|
8698 |
+
|
8699 |
function createTweens( animation, props ) {
|
8700 |
jQuery.each( props, function( prop, value ) {
|
8701 |
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
|
8703 |
length = collection.length;
|
8704 |
for ( ; index < length; index++ ) {
|
8705 |
if ( collection[ index ].call( animation, prop, value ) ) {
|
8706 |
+
|
8707 |
// we're done with this property
|
8708 |
return;
|
8709 |
}
|
8710 |
}
|
8711 |
});
|
8712 |
}
|
8713 |
+
|
8714 |
function Animation( elem, properties, options ) {
|
8715 |
var result,
|
8716 |
stopped,
|
8731 |
percent = 1 - temp,
|
8732 |
index = 0,
|
8733 |
length = animation.tweens.length;
|
8734 |
+
|
8735 |
for ( ; index < length ; index++ ) {
|
8736 |
animation.tweens[ index ].run( percent );
|
8737 |
}
|
8738 |
+
|
8739 |
deferred.notifyWith( elem, [ animation, percent, remaining ]);
|
8740 |
+
|
8741 |
if ( percent < 1 && length ) {
|
8742 |
return remaining;
|
8743 |
} else {
|
8772 |
for ( ; index < length ; index++ ) {
|
8773 |
animation.tweens[ index ].run( 1 );
|
8774 |
}
|
8775 |
+
|
8776 |
// resolve when we played the last frame
|
8777 |
// otherwise, reject
|
8778 |
if ( gotoEnd ) {
|
8784 |
}
|
8785 |
}),
|
8786 |
props = animation.props;
|
8787 |
+
|
8788 |
propFilter( props, animation.opts.specialEasing );
|
8789 |
+
|
8790 |
for ( ; index < length ; index++ ) {
|
8791 |
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
|
8792 |
if ( result ) {
|
8793 |
return result;
|
8794 |
}
|
8795 |
}
|
8796 |
+
|
8797 |
createTweens( animation, props );
|
8798 |
+
|
8799 |
if ( jQuery.isFunction( animation.opts.start ) ) {
|
8800 |
animation.opts.start.call( elem, animation );
|
8801 |
}
|
8802 |
+
|
8803 |
jQuery.fx.timer(
|
8804 |
jQuery.extend( tick, {
|
8805 |
elem: elem,
|
8807 |
queue: animation.opts.queue
|
8808 |
})
|
8809 |
);
|
8810 |
+
|
8811 |
// attach callbacks from options
|
8812 |
return animation.progress( animation.opts.progress )
|
8813 |
.done( animation.opts.done, animation.opts.complete )
|
8814 |
.fail( animation.opts.fail )
|
8815 |
.always( animation.opts.always );
|
8816 |
}
|
8817 |
+
|
8818 |
function propFilter( props, specialEasing ) {
|
8819 |
var value, name, index, easing, hooks;
|
8820 |
+
|
8821 |
// camelCase, specialEasing and expand cssHook pass
|
8822 |
for ( index in props ) {
|
8823 |
name = jQuery.camelCase( index );
|
8827 |
easing = value[ 1 ];
|
8828 |
value = props[ index ] = value[ 0 ];
|
8829 |
}
|
8830 |
+
|
8831 |
if ( index !== name ) {
|
8832 |
props[ name ] = value;
|
8833 |
delete props[ index ];
|
8834 |
}
|
8835 |
+
|
8836 |
hooks = jQuery.cssHooks[ name ];
|
8837 |
if ( hooks && "expand" in hooks ) {
|
8838 |
value = hooks.expand( value );
|
8839 |
delete props[ name ];
|
8840 |
+
|
8841 |
// not quite $.extend, this wont overwrite keys already present.
|
8842 |
// also - reusing 'index' from above because we have the correct "name"
|
8843 |
for ( index in value ) {
|
8851 |
}
|
8852 |
}
|
8853 |
}
|
8854 |
+
|
8855 |
jQuery.Animation = jQuery.extend( Animation, {
|
8856 |
+
|
8857 |
tweener: function( props, callback ) {
|
8858 |
if ( jQuery.isFunction( props ) ) {
|
8859 |
callback = props;
|
8861 |
} else {
|
8862 |
props = props.split(" ");
|
8863 |
}
|
8864 |
+
|
8865 |
var prop,
|
8866 |
index = 0,
|
8867 |
length = props.length;
|
8868 |
+
|
8869 |
for ( ; index < length ; index++ ) {
|
8870 |
prop = props[ index ];
|
8871 |
tweeners[ prop ] = tweeners[ prop ] || [];
|
8872 |
tweeners[ prop ].unshift( callback );
|
8873 |
}
|
8874 |
},
|
8875 |
+
|
8876 |
prefilter: function( callback, prepend ) {
|
8877 |
if ( prepend ) {
|
8878 |
animationPrefilters.unshift( callback );
|
8881 |
}
|
8882 |
}
|
8883 |
});
|
8884 |
+
|
8885 |
function defaultPrefilter( elem, props, opts ) {
|
8886 |
/*jshint validthis:true */
|
8887 |
var prop, index, length,
|
8892 |
orig = {},
|
8893 |
handled = [],
|
8894 |
hidden = elem.nodeType && isHidden( elem );
|
8895 |
+
|
8896 |
// handle queue: false promises
|
8897 |
if ( !opts.queue ) {
|
8898 |
hooks = jQuery._queueHooks( elem, "fx" );
|
8906 |
};
|
8907 |
}
|
8908 |
hooks.unqueued++;
|
8909 |
+
|
8910 |
anim.always(function() {
|
8911 |
// doing this makes sure that the complete handler will be called
|
8912 |
// before this completes
|
8918 |
});
|
8919 |
});
|
8920 |
}
|
8921 |
+
|
8922 |
// height/width overflow pass
|
8923 |
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
|
8924 |
// Make sure that nothing sneaks out
|
8926 |
// change the overflow attribute when overflowX and
|
8927 |
// overflowY are set to the same value
|
8928 |
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
|
8929 |
+
|
8930 |
// Set display property to inline-block for height/width
|
8931 |
// animations on inline elements that are having width/height animated
|
8932 |
if ( jQuery.css( elem, "display" ) === "inline" &&
|
8933 |
jQuery.css( elem, "float" ) === "none" ) {
|
8934 |
+
|
8935 |
// inline-level elements accept inline-block;
|
8936 |
// block-level elements need to be inline with layout
|
8937 |
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
|
8938 |
style.display = "inline-block";
|
8939 |
+
|
8940 |
} else {
|
8941 |
style.zoom = 1;
|
8942 |
}
|
8943 |
}
|
8944 |
}
|
8945 |
+
|
8946 |
if ( opts.overflow ) {
|
8947 |
style.overflow = "hidden";
|
8948 |
if ( !jQuery.support.shrinkWrapBlocks ) {
|
8953 |
});
|
8954 |
}
|
8955 |
}
|
8956 |
+
|
8957 |
+
|
8958 |
// show/hide pass
|
8959 |
for ( index in props ) {
|
8960 |
value = props[ index ];
|
8967 |
handled.push( index );
|
8968 |
}
|
8969 |
}
|
8970 |
+
|
8971 |
length = handled.length;
|
8972 |
if ( length ) {
|
8973 |
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
|
8974 |
if ( "hidden" in dataShow ) {
|
8975 |
hidden = dataShow.hidden;
|
8976 |
}
|
8977 |
+
|
8978 |
// store state if its toggle - enables .stop().toggle() to "reverse"
|
8979 |
if ( toggle ) {
|
8980 |
dataShow.hidden = !hidden;
|
8997 |
prop = handled[ index ];
|
8998 |
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
|
8999 |
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
|
9000 |
+
|
9001 |
if ( !( prop in dataShow ) ) {
|
9002 |
dataShow[ prop ] = tween.start;
|
9003 |
if ( hidden ) {
|
9008 |
}
|
9009 |
}
|
9010 |
}
|
9011 |
+
|
9012 |
function Tween( elem, options, prop, end, easing ) {
|
9013 |
return new Tween.prototype.init( elem, options, prop, end, easing );
|
9014 |
}
|
9015 |
jQuery.Tween = Tween;
|
9016 |
+
|
9017 |
Tween.prototype = {
|
9018 |
constructor: Tween,
|
9019 |
init: function( elem, options, prop, end, easing, unit ) {
|
9027 |
},
|
9028 |
cur: function() {
|
9029 |
var hooks = Tween.propHooks[ this.prop ];
|
9030 |
+
|
9031 |
return hooks && hooks.get ?
|
9032 |
hooks.get( this ) :
|
9033 |
Tween.propHooks._default.get( this );
|
9035 |
run: function( percent ) {
|
9036 |
var eased,
|
9037 |
hooks = Tween.propHooks[ this.prop ];
|
9038 |
+
|
9039 |
if ( this.options.duration ) {
|
9040 |
this.pos = eased = jQuery.easing[ this.easing ](
|
9041 |
percent, this.options.duration * percent, 0, 1, this.options.duration
|
9044 |
this.pos = eased = percent;
|
9045 |
}
|
9046 |
this.now = ( this.end - this.start ) * eased + this.start;
|
9047 |
+
|
9048 |
if ( this.options.step ) {
|
9049 |
this.options.step.call( this.elem, this.now, this );
|
9050 |
}
|
9051 |
+
|
9052 |
if ( hooks && hooks.set ) {
|
9053 |
hooks.set( this );
|
9054 |
} else {
|
9057 |
return this;
|
9058 |
}
|
9059 |
};
|
9060 |
+
|
9061 |
Tween.prototype.init.prototype = Tween.prototype;
|
9062 |
+
|
9063 |
Tween.propHooks = {
|
9064 |
_default: {
|
9065 |
get: function( tween ) {
|
9066 |
var result;
|
9067 |
+
|
9068 |
if ( tween.elem[ tween.prop ] != null &&
|
9069 |
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
|
9070 |
return tween.elem[ tween.prop ];
|
9071 |
}
|
9072 |
+
|
9073 |
// passing an empty string as a 3rd parameter to .css will automatically
|
9074 |
// attempt a parseFloat and fallback to a string if the parse fails
|
9075 |
// so, simple values such as "10px" are parsed to Float.
|
9091 |
}
|
9092 |
}
|
9093 |
};
|
9094 |
+
|
9095 |
// Remove in 2.0 - this supports IE8's panic based approach
|
9096 |
// to setting things on disconnected nodes
|
9097 |
+
|
9098 |
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
9099 |
set: function( tween ) {
|
9100 |
if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
9102 |
}
|
9103 |
}
|
9104 |
};
|
9105 |
+
|
9106 |
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
|
9107 |
var cssFn = jQuery.fn[ name ];
|
9108 |
jQuery.fn[ name ] = function( speed, easing, callback ) {
|
9111 |
this.animate( genFx( name, true ), speed, easing, callback );
|
9112 |
};
|
9113 |
});
|
9114 |
+
|
9115 |
jQuery.fn.extend({
|
9116 |
fadeTo: function( speed, to, easing, callback ) {
|
9117 |
+
|
9118 |
// show any hidden elements after setting opacity to 0
|
9119 |
return this.filter( isHidden ).css( "opacity", 0 ).show()
|
9120 |
+
|
9121 |
// animate to the value specified
|
9122 |
.end().animate({ opacity: to }, speed, easing, callback );
|
9123 |
},
|
9136 |
}
|
9137 |
};
|
9138 |
doAnimation.finish = doAnimation;
|
9139 |
+
|
9140 |
return empty || optall.queue === false ?
|
9141 |
this.each( doAnimation ) :
|
9142 |
this.queue( optall.queue, doAnimation );
|
9147 |
delete hooks.stop;
|
9148 |
stop( gotoEnd );
|
9149 |
};
|
9150 |
+
|
9151 |
if ( typeof type !== "string" ) {
|
9152 |
gotoEnd = clearQueue;
|
9153 |
clearQueue = type;
|
9156 |
if ( clearQueue && type !== false ) {
|
9157 |
this.queue( type || "fx", [] );
|
9158 |
}
|
9159 |
+
|
9160 |
return this.each(function() {
|
9161 |
var dequeue = true,
|
9162 |
index = type != null && type + "queueHooks",
|
9163 |
timers = jQuery.timers,
|
9164 |
data = jQuery._data( this );
|
9165 |
+
|
9166 |
if ( index ) {
|
9167 |
if ( data[ index ] && data[ index ].stop ) {
|
9168 |
stopQueue( data[ index ] );
|
9174 |
}
|
9175 |
}
|
9176 |
}
|
9177 |
+
|
9178 |
for ( index = timers.length; index--; ) {
|
9179 |
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
|
9180 |
timers[ index ].anim.stop( gotoEnd );
|
9182 |
timers.splice( index, 1 );
|
9183 |
}
|
9184 |
}
|
9185 |
+
|
9186 |
// start the next in the queue if the last step wasn't forced
|
9187 |
// timers currently will call their complete callbacks, which will dequeue
|
9188 |
// but only if they were gotoEnd
|
9202 |
hooks = data[ type + "queueHooks" ],
|
9203 |
timers = jQuery.timers,
|
9204 |
length = queue ? queue.length : 0;
|
9205 |
+
|
9206 |
// enable finishing flag on private data
|
9207 |
data.finish = true;
|
9208 |
+
|
9209 |
// empty the queue first
|
9210 |
jQuery.queue( this, type, [] );
|
9211 |
+
|
9212 |
if ( hooks && hooks.cur && hooks.cur.finish ) {
|
9213 |
hooks.cur.finish.call( this );
|
9214 |
}
|
9215 |
+
|
9216 |
// look for any active animations, and finish them
|
9217 |
for ( index = timers.length; index--; ) {
|
9218 |
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
|
9220 |
timers.splice( index, 1 );
|
9221 |
}
|
9222 |
}
|
9223 |
+
|
9224 |
// look for any animations in the old queue and finish them
|
9225 |
for ( index = 0; index < length; index++ ) {
|
9226 |
if ( queue[ index ] && queue[ index ].finish ) {
|
9227 |
queue[ index ].finish.call( this );
|
9228 |
}
|
9229 |
}
|
9230 |
+
|
9231 |
// turn off finishing flag
|
9232 |
delete data.finish;
|
9233 |
});
|
9234 |
}
|
9235 |
});
|
9236 |
+
|
9237 |
// Generate parameters to create a standard animation
|
9238 |
function genFx( type, includeWidth ) {
|
9239 |
var which,
|
9240 |
attrs = { height: type },
|
9241 |
i = 0;
|
9242 |
+
|
9243 |
// if we include width, step value is 1 to do all cssExpand values,
|
9244 |
// if we don't include width, step value is 2 to skip over Left and Right
|
9245 |
includeWidth = includeWidth? 1 : 0;
|
9247 |
which = cssExpand[ i ];
|
9248 |
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
|
9249 |
}
|
9250 |
+
|
9251 |
if ( includeWidth ) {
|
9252 |
attrs.opacity = attrs.width = type;
|
9253 |
}
|
9254 |
+
|
9255 |
return attrs;
|
9256 |
}
|
9257 |
+
|
9258 |
// Generate shortcuts for custom animations
|
9259 |
jQuery.each({
|
9260 |
slideDown: genFx("show"),
|
9268 |
return this.animate( props, speed, easing, callback );
|
9269 |
};
|
9270 |
});
|
9271 |
+
|
9272 |
jQuery.speed = function( speed, easing, fn ) {
|
9273 |
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
|
9274 |
complete: fn || !fn && easing ||
|
9276 |
duration: speed,
|
9277 |
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
|
9278 |
};
|
9279 |
+
|
9280 |
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
|
9281 |
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
|
9282 |
+
|
9283 |
// normalize opt.queue - true/undefined/null -> "fx"
|
9284 |
if ( opt.queue == null || opt.queue === true ) {
|
9285 |
opt.queue = "fx";
|
9286 |
}
|
9287 |
+
|
9288 |
// Queueing
|
9289 |
opt.old = opt.complete;
|
9290 |
+
|
9291 |
opt.complete = function() {
|
9292 |
if ( jQuery.isFunction( opt.old ) ) {
|
9293 |
opt.old.call( this );
|
9294 |
}
|
9295 |
+
|
9296 |
if ( opt.queue ) {
|
9297 |
jQuery.dequeue( this, opt.queue );
|
9298 |
}
|
9299 |
};
|
9300 |
+
|
9301 |
return opt;
|
9302 |
};
|
9303 |
+
|
9304 |
jQuery.easing = {
|
9305 |
linear: function( p ) {
|
9306 |
return p;
|
9309 |
return 0.5 - Math.cos( p*Math.PI ) / 2;
|
9310 |
}
|
9311 |
};
|
9312 |
+
|
9313 |
jQuery.timers = [];
|
9314 |
jQuery.fx = Tween.prototype.init;
|
9315 |
jQuery.fx.tick = function() {
|
9316 |
var timer,
|
9317 |
timers = jQuery.timers,
|
9318 |
i = 0;
|
9319 |
+
|
9320 |
fxNow = jQuery.now();
|
9321 |
+
|
9322 |
for ( ; i < timers.length; i++ ) {
|
9323 |
timer = timers[ i ];
|
9324 |
// Checks the timer has not already been removed
|
9326 |
timers.splice( i--, 1 );
|
9327 |
}
|
9328 |
}
|
9329 |
+
|
9330 |
if ( !timers.length ) {
|
9331 |
jQuery.fx.stop();
|
9332 |
}
|
9333 |
fxNow = undefined;
|
9334 |
};
|
9335 |
+
|
9336 |
jQuery.fx.timer = function( timer ) {
|
9337 |
if ( timer() && jQuery.timers.push( timer ) ) {
|
9338 |
jQuery.fx.start();
|
9339 |
}
|
9340 |
};
|
9341 |
+
|
9342 |
jQuery.fx.interval = 13;
|
9343 |
+
|
9344 |
jQuery.fx.start = function() {
|
9345 |
if ( !timerId ) {
|
9346 |
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
|
9347 |
}
|
9348 |
};
|
9349 |
+
|
9350 |
jQuery.fx.stop = function() {
|
9351 |
clearInterval( timerId );
|
9352 |
timerId = null;
|
9353 |
};
|
9354 |
+
|
9355 |
jQuery.fx.speeds = {
|
9356 |
slow: 600,
|
9357 |
fast: 200,
|
9358 |
// Default speed
|
9359 |
_default: 400
|
9360 |
};
|
9361 |
+
|
9362 |
// Back Compat <1.8 extension point
|
9363 |
jQuery.fx.step = {};
|
9364 |
+
|
9365 |
if ( jQuery.expr && jQuery.expr.filters ) {
|
9366 |
jQuery.expr.filters.animated = function( elem ) {
|
9367 |
return jQuery.grep(jQuery.timers, function( fn ) {
|
9377 |
jQuery.offset.setOffset( this, options, i );
|
9378 |
});
|
9379 |
}
|
9380 |
+
|
9381 |
var docElem, win,
|
9382 |
box = { top: 0, left: 0 },
|
9383 |
elem = this[ 0 ],
|
9384 |
doc = elem && elem.ownerDocument;
|
9385 |
+
|
9386 |
if ( !doc ) {
|
9387 |
return;
|
9388 |
}
|
9389 |
+
|
9390 |
docElem = doc.documentElement;
|
9391 |
+
|
9392 |
// Make sure it's not a disconnected DOM node
|
9393 |
if ( !jQuery.contains( docElem, elem ) ) {
|
9394 |
return box;
|
9395 |
}
|
9396 |
+
|
9397 |
// If we don't have gBCR, just use 0,0 rather than error
|
9398 |
// BlackBerry 5, iOS 3 (original iPhone)
|
9399 |
if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
|
9405 |
left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
|
9406 |
};
|
9407 |
};
|
9408 |
+
|
9409 |
jQuery.offset = {
|
9410 |
+
|
9411 |
setOffset: function( elem, options, i ) {
|
9412 |
var position = jQuery.css( elem, "position" );
|
9413 |
+
|
9414 |
// set position first, in-case top/left are set even on static elem
|
9415 |
if ( position === "static" ) {
|
9416 |
elem.style.position = "relative";
|
9417 |
}
|
9418 |
+
|
9419 |
var curElem = jQuery( elem ),
|
9420 |
curOffset = curElem.offset(),
|
9421 |
curCSSTop = jQuery.css( elem, "top" ),
|
9422 |
curCSSLeft = jQuery.css( elem, "left" ),
|
9423 |
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
|
9424 |
props = {}, curPosition = {}, curTop, curLeft;
|
9425 |
+
|
9426 |
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
|
9427 |
if ( calculatePosition ) {
|
9428 |
curPosition = curElem.position();
|
9432 |
curTop = parseFloat( curCSSTop ) || 0;
|
9433 |
curLeft = parseFloat( curCSSLeft ) || 0;
|
9434 |
}
|
9435 |
+
|
9436 |
if ( jQuery.isFunction( options ) ) {
|
9437 |
options = options.call( elem, i, curOffset );
|
9438 |
}
|
9439 |
+
|
9440 |
if ( options.top != null ) {
|
9441 |
props.top = ( options.top - curOffset.top ) + curTop;
|
9442 |
}
|
9443 |
if ( options.left != null ) {
|
9444 |
props.left = ( options.left - curOffset.left ) + curLeft;
|
9445 |
}
|
9446 |
+
|
9447 |
if ( "using" in options ) {
|
9448 |
options.using.call( elem, props );
|
9449 |
} else {
|
9451 |
}
|
9452 |
}
|
9453 |
};
|
9454 |
+
|
9455 |
+
|
9456 |
jQuery.fn.extend({
|
9457 |
+
|
9458 |
position: function() {
|
9459 |
if ( !this[ 0 ] ) {
|
9460 |
return;
|
9461 |
}
|
9462 |
+
|
9463 |
var offsetParent, offset,
|
9464 |
parentOffset = { top: 0, left: 0 },
|
9465 |
elem = this[ 0 ];
|
9466 |
+
|
9467 |
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
|
9468 |
if ( jQuery.css( elem, "position" ) === "fixed" ) {
|
9469 |
// we assume that getBoundingClientRect is available when computed position is fixed
|
9471 |
} else {
|
9472 |
// Get *real* offsetParent
|
9473 |
offsetParent = this.offsetParent();
|
9474 |
+
|
9475 |
// Get correct offsets
|
9476 |
offset = this.offset();
|
9477 |
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
|
9478 |
parentOffset = offsetParent.offset();
|
9479 |
}
|
9480 |
+
|
9481 |
// Add offsetParent borders
|
9482 |
parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
|
9483 |
parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
|
9484 |
}
|
9485 |
+
|
9486 |
// Subtract parent offsets and element margins
|
9487 |
// note: when an element has margin: auto the offsetLeft and marginLeft
|
9488 |
// are the same in Safari causing offset.left to incorrectly be 0
|
9491 |
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
|
9492 |
};
|
9493 |
},
|
9494 |
+
|
9495 |
offsetParent: function() {
|
9496 |
return this.map(function() {
|
9497 |
var offsetParent = this.offsetParent || document.documentElement;
|
9502 |
});
|
9503 |
}
|
9504 |
});
|
9505 |
+
|
9506 |
+
|
9507 |
// Create scrollLeft and scrollTop methods
|
9508 |
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
|
9509 |
var top = /Y/.test( prop );
|
9510 |
+
|
9511 |
jQuery.fn[ method ] = function( val ) {
|
9512 |
return jQuery.access( this, function( elem, method, val ) {
|
9513 |
var win = getWindow( elem );
|
9514 |
+
|
9515 |
if ( val === undefined ) {
|
9516 |
return win ? (prop in win) ? win[ prop ] :
|
9517 |
win.document.documentElement[ method ] :
|
9518 |
elem[ method ];
|
9519 |
}
|
9520 |
+
|
9521 |
if ( win ) {
|
9522 |
win.scrollTo(
|
9523 |
!top ? val : jQuery( win ).scrollLeft(),
|
9524 |
top ? val : jQuery( win ).scrollTop()
|
9525 |
);
|
9526 |
+
|
9527 |
} else {
|
9528 |
elem[ method ] = val;
|
9529 |
}
|
9530 |
}, method, val, arguments.length, null );
|
9531 |
};
|
9532 |
});
|
9533 |
+
|
9534 |
function getWindow( elem ) {
|
9535 |
return jQuery.isWindow( elem ) ?
|
9536 |
elem :
|
9545 |
jQuery.fn[ funcName ] = function( margin, value ) {
|
9546 |
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
|
9547 |
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
|
9548 |
+
|
9549 |
return jQuery.access( this, function( elem, type, value ) {
|
9550 |
var doc;
|
9551 |
+
|
9552 |
if ( jQuery.isWindow( elem ) ) {
|
9553 |
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
|
9554 |
// isn't a whole lot we can do. See pull request at this URL for discussion:
|
9555 |
// https://github.com/jquery/jquery/pull/764
|
9556 |
return elem.document.documentElement[ "client" + name ];
|
9557 |
}
|
9558 |
+
|
9559 |
// Get document width or height
|
9560 |
if ( elem.nodeType === 9 ) {
|
9561 |
doc = elem.documentElement;
|
9562 |
+
|
9563 |
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
|
9564 |
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
|
9565 |
return Math.max(
|
9568 |
doc[ "client" + name ]
|
9569 |
);
|
9570 |
}
|
9571 |
+
|
9572 |
return value === undefined ?
|
9573 |
// Get width or height on the element, requesting but not forcing parseFloat
|
9574 |
jQuery.css( elem, type, extra ) :
|
9575 |
+
|
9576 |
// Set width or height on the element
|
9577 |
jQuery.style( elem, type, value, extra );
|
9578 |
}, type, chainable ? margin : undefined, chainable, null );
|
9581 |
});
|
9582 |
// Limit scope pollution from any deprecated API
|
9583 |
// (function() {
|
9584 |
+
|
9585 |
// })();
|
9586 |
// Expose jQuery to the global object
|
9587 |
window.jQuery = window.$ = jQuery;
|
9588 |
+
|
9589 |
// Expose jQuery as an AMD module, but only for AMD loaders that
|
9590 |
// understand the issues with loading multiple versions of jQuery
|
9591 |
// in a page that all might call define(). The loader will indicate
|
9601 |
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
|
9602 |
define( "jquery", [], function () { return jQuery; } );
|
9603 |
}
|
9604 |
+
|
9605 |
+
})( window );
|
js/media.js
CHANGED
@@ -1,26 +1,30 @@
|
|
1 |
-
jQuery(document).ready(function($){
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
26 |
});
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
if(pagenow != 'attachment')
|
3 |
+
{
|
4 |
+
var _custom_media = true,
|
5 |
+
_orig_send_attachment = wp.media.editor.send.attachment;
|
6 |
+
$('.bsf_upload_button').click(function(e) {
|
7 |
+
var send_attachment_bkp = wp.media.editor.send.attachment;
|
8 |
+
var button = $(this);
|
9 |
+
var id = 'bsf_upload_file'; //button.attr('id').replace('_button', '');
|
10 |
+
_custom_media = true;
|
11 |
+
wp.media.editor.send.attachment = function(props, attachment){
|
12 |
+
if ( _custom_media ) {
|
13 |
+
$("."+id).val(attachment.url);
|
14 |
+
$(".bsf_media_status").html('<img src="'+ attachment.url +'" />');
|
15 |
+
} else {
|
16 |
+
return _orig_send_attachment.apply( this, [props, attachment] );
|
17 |
+
};
|
18 |
+
}
|
19 |
+
wp.media.editor.open(button);
|
20 |
+
return false;
|
21 |
+
});
|
22 |
+
$('.add_media').on('click', function(){
|
23 |
+
_custom_media = false;
|
24 |
+
});
|
25 |
+
}
|
26 |
+
else
|
27 |
+
{
|
28 |
+
$("#review_metabox").hide();
|
29 |
+
}
|
30 |
});
|
readme.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
=== All In One Schema.org Rich Snippets ===
|
2 |
-
It gives search engines only the important & precise information to display in search result snippets.
|
3 |
-
Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
|
4 |
-
[See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
|
5 |
-
Helps you rank higher in search results
|
6 |
-
Helps Facebook display proper information when users share your links on Facebook
|
7 |
-
Even simpler, shorter, typographic and more beautiful design of MicroData box. May be like this https://moqups.com/brainstormforce/5P0EaLtt
|
8 |
-
Redesigned admin panel
|
9 |
-
Refined MicroData input options
|
10 |
-
Support for more post types (Local Business, etc)
|
11 |
-
It gives search engines only the important & precise information to display in search result snippets.
|
12 |
-
Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
|
13 |
-
[See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
|
14 |
-
Helps you rank higher in search results
|
15 |
-
Helps Facebook display proper information when users share your links on Facebook
|
16 |
-
It gives search engines only the important & precise information to display in search result snippets.
|
17 |
-
Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
|
18 |
-
[See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
|
19 |
-
Helps you rank higher in search results
|
20 |
-
Helps Facebook display proper information when users share your links on Facebook
|
21 |
-
Even simpler, shorter, typographic and more beautiful design of MicroData box. May be like this https://moqups.com/brainstormforce/5P0EaLtt
|
22 |
-
Redesigned admin panel
|
23 |
-
Refined MicroData input options
|
24 |
-
Support for more post types (Local Business, etc)
|
25 |
-
It gives search engines only the important & precise information to display in search result snippets.
|
26 |
-
Rich Snippets are very interactive (photos, star ratings, price, author, etc.) to let you stand out from competition
|
27 |
-
[See what difference it makes](http://dashburst.com/google-search-what-are-rich-snippets/ "See the difference") in CTR (Click Through Rate)
|
28 |
-
Helps you rank higher in search results
|
29 |
-
Helps Facebook display proper information when users share your links on Facebook
|
1 |
+
=== All In One Schema.org Rich Snippets ===
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|