Merge lp:~raoul-snyman/openlp/re-enable-version-checking-2.4 into lp:openlp/2.4
- re-enable-version-checking-2.4
- Merge into 2.4
Status: | Merged |
---|---|
Merged at revision: | 2655 |
Proposed branch: | lp:~raoul-snyman/openlp/re-enable-version-checking-2.4 |
Merge into: | lp:openlp/2.4 |
Diff against target: |
21749 lines (+11719/-7957) 8 files modified
openlp/core/ui/generaltab.py (+0/-1) openlp/plugins/remotes/html/jquery.js (+9265/-7661) openlp/plugins/remotes/html/jquery.min.js (+5/-4) openlp/plugins/remotes/html/jquery.mobile.css (+2332/-0) openlp/plugins/remotes/html/jquery.mobile.js (+92/-287) openlp/plugins/remotes/html/jquery.mobile.min.css (+2/-2) openlp/plugins/remotes/html/jquery.mobile.min.js (+2/-2) tests/functional/openlp_core_ui_media/test_systemplayer.py (+21/-0) |
To merge this branch: | bzr merge lp:~raoul-snyman/openlp/re-enable-version-checking-2.4 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | Approve | ||
Tomas Groth | Approve | ||
Review via email: mp+307271@code.launchpad.net |
This proposal supersedes a proposal from 2016-09-26.
Commit message
Description of the change
Fix up the last of the packaging issues and increase test coverage of systemplayer to 100%
Add this to your merge proposal:
-------
lp:~raoul-snyman/openlp/re-enable-version-checking-2.4 (revision 2656)
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
Phill (phill-ridout) wrote : Posted in a previous version of this proposal | # |
Tomas Groth (tomasgroth) : | # |
Tim Bentley (trb143) : | # |
Preview Diff
1 | === modified file 'openlp/core/ui/generaltab.py' |
2 | --- openlp/core/ui/generaltab.py 2016-01-16 20:13:41 +0000 |
3 | +++ openlp/core/ui/generaltab.py 2016-09-30 07:28:48 +0000 |
4 | @@ -159,7 +159,6 @@ |
5 | self.startup_layout.addWidget(self.show_splash_check_box) |
6 | self.check_for_updates_check_box = QtWidgets.QCheckBox(self.startup_group_box) |
7 | self.check_for_updates_check_box.setObjectName('check_for_updates_check_box') |
8 | - self.check_for_updates_check_box.setVisible(False) |
9 | self.startup_layout.addWidget(self.check_for_updates_check_box) |
10 | self.right_layout.addWidget(self.startup_group_box) |
11 | # Application Settings |
12 | |
13 | === modified file 'openlp/plugins/remotes/html/jquery.js' |
14 | --- openlp/plugins/remotes/html/jquery.js 2015-12-23 12:55:30 +0000 |
15 | +++ openlp/plugins/remotes/html/jquery.js 2016-09-30 07:28:48 +0000 |
16 | @@ -1,291 +1,150 @@ |
17 | /*! |
18 | - * jQuery JavaScript Library v1.7.2 |
19 | + * jQuery JavaScript Library v1.12.4 |
20 | * http://jquery.com/ |
21 | * |
22 | - * Copyright 2011, John Resig |
23 | - * Dual licensed under the MIT or GPL Version 2 licenses. |
24 | - * http://jquery.org/license |
25 | - * |
26 | * Includes Sizzle.js |
27 | * http://sizzlejs.com/ |
28 | - * Copyright 2011, The Dojo Foundation |
29 | - * Released under the MIT, BSD, and GPL Licenses. |
30 | - * |
31 | - * Date: Wed Mar 21 12:46:34 2012 -0700 |
32 | + * |
33 | + * Copyright jQuery Foundation and other contributors |
34 | + * Released under the MIT license |
35 | + * http://jquery.org/license |
36 | + * |
37 | + * Date: 2016-05-20T17:17Z |
38 | */ |
39 | -(function( window, undefined ) { |
40 | - |
41 | -// Use the correct document accordingly with window argument (sandbox) |
42 | -var document = window.document, |
43 | - navigator = window.navigator, |
44 | - location = window.location; |
45 | -var jQuery = (function() { |
46 | - |
47 | -// Define a local copy of jQuery |
48 | -var jQuery = function( selector, context ) { |
49 | + |
50 | +(function( global, factory ) { |
51 | + |
52 | + if ( typeof module === "object" && typeof module.exports === "object" ) { |
53 | + // For CommonJS and CommonJS-like environments where a proper `window` |
54 | + // is present, execute the factory and get jQuery. |
55 | + // For environments that do not have a `window` with a `document` |
56 | + // (such as Node.js), expose a factory as module.exports. |
57 | + // This accentuates the need for the creation of a real `window`. |
58 | + // e.g. var jQuery = require("jquery")(window); |
59 | + // See ticket #14549 for more info. |
60 | + module.exports = global.document ? |
61 | + factory( global, true ) : |
62 | + function( w ) { |
63 | + if ( !w.document ) { |
64 | + throw new Error( "jQuery requires a window with a document" ); |
65 | + } |
66 | + return factory( w ); |
67 | + }; |
68 | + } else { |
69 | + factory( global ); |
70 | + } |
71 | + |
72 | +// Pass this if window is not defined yet |
73 | +}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
74 | + |
75 | +// Support: Firefox 18+ |
76 | +// Can't be in strict mode, several libs including ASP.NET trace |
77 | +// the stack via arguments.caller.callee and Firefox dies if |
78 | +// you try to trace through "use strict" call chains. (#13335) |
79 | +//"use strict"; |
80 | +var deletedIds = []; |
81 | + |
82 | +var document = window.document; |
83 | + |
84 | +var slice = deletedIds.slice; |
85 | + |
86 | +var concat = deletedIds.concat; |
87 | + |
88 | +var push = deletedIds.push; |
89 | + |
90 | +var indexOf = deletedIds.indexOf; |
91 | + |
92 | +var class2type = {}; |
93 | + |
94 | +var toString = class2type.toString; |
95 | + |
96 | +var hasOwn = class2type.hasOwnProperty; |
97 | + |
98 | +var support = {}; |
99 | + |
100 | + |
101 | + |
102 | +var |
103 | + version = "1.12.4", |
104 | + |
105 | + // Define a local copy of jQuery |
106 | + jQuery = function( selector, context ) { |
107 | + |
108 | // The jQuery object is actually just the init constructor 'enhanced' |
109 | - return new jQuery.fn.init( selector, context, rootjQuery ); |
110 | + // Need init if jQuery is called (just allow error to be thrown if not included) |
111 | + return new jQuery.fn.init( selector, context ); |
112 | }, |
113 | |
114 | - // Map over jQuery in case of overwrite |
115 | - _jQuery = window.jQuery, |
116 | - |
117 | - // Map over the $ in case of overwrite |
118 | - _$ = window.$, |
119 | - |
120 | - // A central reference to the root jQuery(document) |
121 | - rootjQuery, |
122 | - |
123 | - // A simple way to check for HTML strings or ID strings |
124 | - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
125 | - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, |
126 | - |
127 | - // Check if a string has a non-whitespace character in it |
128 | - rnotwhite = /\S/, |
129 | - |
130 | - // Used for trimming whitespace |
131 | - trimLeft = /^\s+/, |
132 | - trimRight = /\s+$/, |
133 | - |
134 | - // Match a standalone tag |
135 | - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, |
136 | - |
137 | - // JSON RegExp |
138 | - rvalidchars = /^[\],:{}\s]*$/, |
139 | - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, |
140 | - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, |
141 | - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, |
142 | - |
143 | - // Useragent RegExp |
144 | - rwebkit = /(webkit)[ \/]([\w.]+)/, |
145 | - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, |
146 | - rmsie = /(msie) ([\w.]+)/, |
147 | - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, |
148 | + // Support: Android<4.1, IE<9 |
149 | + // Make sure we trim BOM and NBSP |
150 | + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, |
151 | |
152 | // Matches dashed string for camelizing |
153 | - rdashAlpha = /-([a-z]|[0-9])/ig, |
154 | rmsPrefix = /^-ms-/, |
155 | + rdashAlpha = /-([\da-z])/gi, |
156 | |
157 | // Used by jQuery.camelCase as callback to replace() |
158 | fcamelCase = function( all, letter ) { |
159 | - return ( letter + "" ).toUpperCase(); |
160 | - }, |
161 | - |
162 | - // Keep a UserAgent string for use with jQuery.browser |
163 | - userAgent = navigator.userAgent, |
164 | - |
165 | - // For matching the engine and version of the browser |
166 | - browserMatch, |
167 | - |
168 | - // The deferred used on DOM ready |
169 | - readyList, |
170 | - |
171 | - // The ready event handler |
172 | - DOMContentLoaded, |
173 | - |
174 | - // Save a reference to some core methods |
175 | - toString = Object.prototype.toString, |
176 | - hasOwn = Object.prototype.hasOwnProperty, |
177 | - push = Array.prototype.push, |
178 | - slice = Array.prototype.slice, |
179 | - trim = String.prototype.trim, |
180 | - indexOf = Array.prototype.indexOf, |
181 | - |
182 | - // [[Class]] -> type pairs |
183 | - class2type = {}; |
184 | + return letter.toUpperCase(); |
185 | + }; |
186 | |
187 | jQuery.fn = jQuery.prototype = { |
188 | + |
189 | + // The current version of jQuery being used |
190 | + jquery: version, |
191 | + |
192 | constructor: jQuery, |
193 | - init: function( selector, context, rootjQuery ) { |
194 | - var match, elem, ret, doc; |
195 | - |
196 | - // Handle $(""), $(null), or $(undefined) |
197 | - if ( !selector ) { |
198 | - return this; |
199 | - } |
200 | - |
201 | - // Handle $(DOMElement) |
202 | - if ( selector.nodeType ) { |
203 | - this.context = this[0] = selector; |
204 | - this.length = 1; |
205 | - return this; |
206 | - } |
207 | - |
208 | - // The body element only exists once, optimize finding it |
209 | - if ( selector === "body" && !context && document.body ) { |
210 | - this.context = document; |
211 | - this[0] = document.body; |
212 | - this.selector = selector; |
213 | - this.length = 1; |
214 | - return this; |
215 | - } |
216 | - |
217 | - // Handle HTML strings |
218 | - if ( typeof selector === "string" ) { |
219 | - // Are we dealing with HTML string or an ID? |
220 | - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { |
221 | - // Assume that strings that start and end with <> are HTML and skip the regex check |
222 | - match = [ null, selector, null ]; |
223 | - |
224 | - } else { |
225 | - match = quickExpr.exec( selector ); |
226 | - } |
227 | - |
228 | - // Verify a match, and that no context was specified for #id |
229 | - if ( match && (match[1] || !context) ) { |
230 | - |
231 | - // HANDLE: $(html) -> $(array) |
232 | - if ( match[1] ) { |
233 | - context = context instanceof jQuery ? context[0] : context; |
234 | - doc = ( context ? context.ownerDocument || context : document ); |
235 | - |
236 | - // If a single string is passed in and it's a single tag |
237 | - // just do a createElement and skip the rest |
238 | - ret = rsingleTag.exec( selector ); |
239 | - |
240 | - if ( ret ) { |
241 | - if ( jQuery.isPlainObject( context ) ) { |
242 | - selector = [ document.createElement( ret[1] ) ]; |
243 | - jQuery.fn.attr.call( selector, context, true ); |
244 | - |
245 | - } else { |
246 | - selector = [ doc.createElement( ret[1] ) ]; |
247 | - } |
248 | - |
249 | - } else { |
250 | - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); |
251 | - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; |
252 | - } |
253 | - |
254 | - return jQuery.merge( this, selector ); |
255 | - |
256 | - // HANDLE: $("#id") |
257 | - } else { |
258 | - elem = document.getElementById( match[2] ); |
259 | - |
260 | - // Check parentNode to catch when Blackberry 4.6 returns |
261 | - // nodes that are no longer in the document #6963 |
262 | - if ( elem && elem.parentNode ) { |
263 | - // Handle the case where IE and Opera return items |
264 | - // by name instead of ID |
265 | - if ( elem.id !== match[2] ) { |
266 | - return rootjQuery.find( selector ); |
267 | - } |
268 | - |
269 | - // Otherwise, we inject the element directly into the jQuery object |
270 | - this.length = 1; |
271 | - this[0] = elem; |
272 | - } |
273 | - |
274 | - this.context = document; |
275 | - this.selector = selector; |
276 | - return this; |
277 | - } |
278 | - |
279 | - // HANDLE: $(expr, $(...)) |
280 | - } else if ( !context || context.jquery ) { |
281 | - return ( context || rootjQuery ).find( selector ); |
282 | - |
283 | - // HANDLE: $(expr, context) |
284 | - // (which is just equivalent to: $(context).find(expr) |
285 | - } else { |
286 | - return this.constructor( context ).find( selector ); |
287 | - } |
288 | - |
289 | - // HANDLE: $(function) |
290 | - // Shortcut for document ready |
291 | - } else if ( jQuery.isFunction( selector ) ) { |
292 | - return rootjQuery.ready( selector ); |
293 | - } |
294 | - |
295 | - if ( selector.selector !== undefined ) { |
296 | - this.selector = selector.selector; |
297 | - this.context = selector.context; |
298 | - } |
299 | - |
300 | - return jQuery.makeArray( selector, this ); |
301 | - }, |
302 | |
303 | // Start with an empty selector |
304 | selector: "", |
305 | |
306 | - // The current version of jQuery being used |
307 | - jquery: "1.7.2", |
308 | - |
309 | // The default length of a jQuery object is 0 |
310 | length: 0, |
311 | |
312 | - // The number of elements contained in the matched element set |
313 | - size: function() { |
314 | - return this.length; |
315 | - }, |
316 | - |
317 | toArray: function() { |
318 | - return slice.call( this, 0 ); |
319 | + return slice.call( this ); |
320 | }, |
321 | |
322 | // Get the Nth element in the matched element set OR |
323 | // Get the whole matched element set as a clean array |
324 | get: function( num ) { |
325 | - return num == null ? |
326 | - |
327 | - // Return a 'clean' array |
328 | - this.toArray() : |
329 | - |
330 | - // Return just the object |
331 | - ( num < 0 ? this[ this.length + num ] : this[ num ] ); |
332 | + return num != null ? |
333 | + |
334 | + // Return just the one element from the set |
335 | + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : |
336 | + |
337 | + // Return all the elements in a clean array |
338 | + slice.call( this ); |
339 | }, |
340 | |
341 | // Take an array of elements and push it onto the stack |
342 | // (returning the new matched element set) |
343 | - pushStack: function( elems, name, selector ) { |
344 | + pushStack: function( elems ) { |
345 | + |
346 | // Build a new jQuery matched element set |
347 | - var ret = this.constructor(); |
348 | - |
349 | - if ( jQuery.isArray( elems ) ) { |
350 | - push.apply( ret, elems ); |
351 | - |
352 | - } else { |
353 | - jQuery.merge( ret, elems ); |
354 | - } |
355 | + var ret = jQuery.merge( this.constructor(), elems ); |
356 | |
357 | // Add the old object onto the stack (as a reference) |
358 | ret.prevObject = this; |
359 | - |
360 | ret.context = this.context; |
361 | |
362 | - if ( name === "find" ) { |
363 | - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; |
364 | - } else if ( name ) { |
365 | - ret.selector = this.selector + "." + name + "(" + selector + ")"; |
366 | - } |
367 | - |
368 | // Return the newly-formed element set |
369 | return ret; |
370 | }, |
371 | |
372 | // Execute a callback for every element in the matched set. |
373 | - // (You can seed the arguments with an array of args, but this is |
374 | - // only used internally.) |
375 | - each: function( callback, args ) { |
376 | - return jQuery.each( this, callback, args ); |
377 | - }, |
378 | - |
379 | - ready: function( fn ) { |
380 | - // Attach the listeners |
381 | - jQuery.bindReady(); |
382 | - |
383 | - // Add the callback |
384 | - readyList.add( fn ); |
385 | - |
386 | - return this; |
387 | - }, |
388 | - |
389 | - eq: function( i ) { |
390 | - i = +i; |
391 | - return i === -1 ? |
392 | - this.slice( i ) : |
393 | - this.slice( i, i + 1 ); |
394 | + each: function( callback ) { |
395 | + return jQuery.each( this, callback ); |
396 | + }, |
397 | + |
398 | + map: function( callback ) { |
399 | + return this.pushStack( jQuery.map( this, function( elem, i ) { |
400 | + return callback.call( elem, i, elem ); |
401 | + } ) ); |
402 | + }, |
403 | + |
404 | + slice: function() { |
405 | + return this.pushStack( slice.apply( this, arguments ) ); |
406 | }, |
407 | |
408 | first: function() { |
409 | @@ -296,34 +155,26 @@ |
410 | return this.eq( -1 ); |
411 | }, |
412 | |
413 | - slice: function() { |
414 | - return this.pushStack( slice.apply( this, arguments ), |
415 | - "slice", slice.call(arguments).join(",") ); |
416 | - }, |
417 | - |
418 | - map: function( callback ) { |
419 | - return this.pushStack( jQuery.map(this, function( elem, i ) { |
420 | - return callback.call( elem, i, elem ); |
421 | - })); |
422 | + eq: function( i ) { |
423 | + var len = this.length, |
424 | + j = +i + ( i < 0 ? len : 0 ); |
425 | + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
426 | }, |
427 | |
428 | end: function() { |
429 | - return this.prevObject || this.constructor(null); |
430 | + return this.prevObject || this.constructor(); |
431 | }, |
432 | |
433 | // For internal use only. |
434 | // Behaves like an Array's method, not like a jQuery method. |
435 | push: push, |
436 | - sort: [].sort, |
437 | - splice: [].splice |
438 | + sort: deletedIds.sort, |
439 | + splice: deletedIds.splice |
440 | }; |
441 | |
442 | -// Give the init function the jQuery prototype for later instantiation |
443 | -jQuery.fn.init.prototype = jQuery.fn; |
444 | - |
445 | jQuery.extend = jQuery.fn.extend = function() { |
446 | - var options, name, src, copy, copyIsArray, clone, |
447 | - target = arguments[0] || {}, |
448 | + var src, copyIsArray, copy, name, options, clone, |
449 | + target = arguments[ 0 ] || {}, |
450 | i = 1, |
451 | length = arguments.length, |
452 | deep = false; |
453 | @@ -331,25 +182,28 @@ |
454 | // Handle a deep copy situation |
455 | if ( typeof target === "boolean" ) { |
456 | deep = target; |
457 | - target = arguments[1] || {}; |
458 | + |
459 | // skip the boolean and the target |
460 | - i = 2; |
461 | + target = arguments[ i ] || {}; |
462 | + i++; |
463 | } |
464 | |
465 | // Handle case when target is a string or something (possible in deep copy) |
466 | - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
467 | + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { |
468 | target = {}; |
469 | } |
470 | |
471 | // extend jQuery itself if only one argument is passed |
472 | - if ( length === i ) { |
473 | + if ( i === length ) { |
474 | target = this; |
475 | - --i; |
476 | + i--; |
477 | } |
478 | |
479 | for ( ; i < length; i++ ) { |
480 | + |
481 | // Only deal with non-null/undefined values |
482 | - if ( (options = arguments[ i ]) != null ) { |
483 | + if ( ( options = arguments[ i ] ) != null ) { |
484 | + |
485 | // Extend the base object |
486 | for ( name in options ) { |
487 | src = target[ name ]; |
488 | @@ -361,13 +215,15 @@ |
489 | } |
490 | |
491 | // Recurse if we're merging plain objects or arrays |
492 | - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
493 | + if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
494 | + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { |
495 | + |
496 | if ( copyIsArray ) { |
497 | copyIsArray = false; |
498 | - clone = src && jQuery.isArray(src) ? src : []; |
499 | + clone = src && jQuery.isArray( src ) ? src : []; |
500 | |
501 | } else { |
502 | - clone = src && jQuery.isPlainObject(src) ? src : {}; |
503 | + clone = src && jQuery.isPlainObject( src ) ? src : {}; |
504 | } |
505 | |
506 | // Never move original objects, clone them |
507 | @@ -385,233 +241,112 @@ |
508 | return target; |
509 | }; |
510 | |
511 | -jQuery.extend({ |
512 | - noConflict: function( deep ) { |
513 | - if ( window.$ === jQuery ) { |
514 | - window.$ = _$; |
515 | - } |
516 | - |
517 | - if ( deep && window.jQuery === jQuery ) { |
518 | - window.jQuery = _jQuery; |
519 | - } |
520 | - |
521 | - return jQuery; |
522 | - }, |
523 | - |
524 | - // Is the DOM ready to be used? Set to true once it occurs. |
525 | - isReady: false, |
526 | - |
527 | - // A counter to track how many items to wait for before |
528 | - // the ready event fires. See #6781 |
529 | - readyWait: 1, |
530 | - |
531 | - // Hold (or release) the ready event |
532 | - holdReady: function( hold ) { |
533 | - if ( hold ) { |
534 | - jQuery.readyWait++; |
535 | - } else { |
536 | - jQuery.ready( true ); |
537 | - } |
538 | - }, |
539 | - |
540 | - // Handle when the DOM is ready |
541 | - ready: function( wait ) { |
542 | - // Either a released hold or an DOMready/load event and not yet ready |
543 | - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { |
544 | - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
545 | - if ( !document.body ) { |
546 | - return setTimeout( jQuery.ready, 1 ); |
547 | - } |
548 | - |
549 | - // Remember that the DOM is ready |
550 | - jQuery.isReady = true; |
551 | - |
552 | - // If a normal DOM Ready event fired, decrement, and wait if need be |
553 | - if ( wait !== true && --jQuery.readyWait > 0 ) { |
554 | - return; |
555 | - } |
556 | - |
557 | - // If there are functions bound, to execute |
558 | - readyList.fireWith( document, [ jQuery ] ); |
559 | - |
560 | - // Trigger any bound ready events |
561 | - if ( jQuery.fn.trigger ) { |
562 | - jQuery( document ).trigger( "ready" ).off( "ready" ); |
563 | - } |
564 | - } |
565 | - }, |
566 | - |
567 | - bindReady: function() { |
568 | - if ( readyList ) { |
569 | - return; |
570 | - } |
571 | - |
572 | - readyList = jQuery.Callbacks( "once memory" ); |
573 | - |
574 | - // Catch cases where $(document).ready() is called after the |
575 | - // browser event has already occurred. |
576 | - if ( document.readyState === "complete" ) { |
577 | - // Handle it asynchronously to allow scripts the opportunity to delay ready |
578 | - return setTimeout( jQuery.ready, 1 ); |
579 | - } |
580 | - |
581 | - // Mozilla, Opera and webkit nightlies currently support this event |
582 | - if ( document.addEventListener ) { |
583 | - // Use the handy event callback |
584 | - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
585 | - |
586 | - // A fallback to window.onload, that will always work |
587 | - window.addEventListener( "load", jQuery.ready, false ); |
588 | - |
589 | - // If IE event model is used |
590 | - } else if ( document.attachEvent ) { |
591 | - // ensure firing before onload, |
592 | - // maybe late but safe also for iframes |
593 | - document.attachEvent( "onreadystatechange", DOMContentLoaded ); |
594 | - |
595 | - // A fallback to window.onload, that will always work |
596 | - window.attachEvent( "onload", jQuery.ready ); |
597 | - |
598 | - // If IE and not a frame |
599 | - // continually check to see if the document is ready |
600 | - var toplevel = false; |
601 | - |
602 | - try { |
603 | - toplevel = window.frameElement == null; |
604 | - } catch(e) {} |
605 | - |
606 | - if ( document.documentElement.doScroll && toplevel ) { |
607 | - doScrollCheck(); |
608 | - } |
609 | - } |
610 | - }, |
611 | +jQuery.extend( { |
612 | + |
613 | + // Unique for each copy of jQuery on the page |
614 | + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
615 | + |
616 | + // Assume jQuery is ready without the ready module |
617 | + isReady: true, |
618 | + |
619 | + error: function( msg ) { |
620 | + throw new Error( msg ); |
621 | + }, |
622 | + |
623 | + noop: function() {}, |
624 | |
625 | // See test/unit/core.js for details concerning isFunction. |
626 | // Since version 1.3, DOM methods and functions like alert |
627 | // aren't supported. They return false on IE (#2968). |
628 | isFunction: function( obj ) { |
629 | - return jQuery.type(obj) === "function"; |
630 | + return jQuery.type( obj ) === "function"; |
631 | }, |
632 | |
633 | isArray: Array.isArray || function( obj ) { |
634 | - return jQuery.type(obj) === "array"; |
635 | + return jQuery.type( obj ) === "array"; |
636 | }, |
637 | |
638 | isWindow: function( obj ) { |
639 | + /* jshint eqeqeq: false */ |
640 | return obj != null && obj == obj.window; |
641 | }, |
642 | |
643 | isNumeric: function( obj ) { |
644 | - return !isNaN( parseFloat(obj) ) && isFinite( obj ); |
645 | + |
646 | + // parseFloat NaNs numeric-cast false positives (null|true|false|"") |
647 | + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
648 | + // subtraction forces infinities to NaN |
649 | + // adding 1 corrects loss of precision from parseFloat (#15100) |
650 | + var realStringObj = obj && obj.toString(); |
651 | + return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; |
652 | }, |
653 | |
654 | - type: function( obj ) { |
655 | - return obj == null ? |
656 | - String( obj ) : |
657 | - class2type[ toString.call(obj) ] || "object"; |
658 | + isEmptyObject: function( obj ) { |
659 | + var name; |
660 | + for ( name in obj ) { |
661 | + return false; |
662 | + } |
663 | + return true; |
664 | }, |
665 | |
666 | isPlainObject: function( obj ) { |
667 | + var key; |
668 | + |
669 | // Must be an Object. |
670 | // Because of IE, we also have to check the presence of the constructor property. |
671 | // Make sure that DOM nodes and window objects don't pass through, as well |
672 | - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
673 | + if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
674 | return false; |
675 | } |
676 | |
677 | try { |
678 | + |
679 | // Not own constructor property must be Object |
680 | if ( obj.constructor && |
681 | - !hasOwn.call(obj, "constructor") && |
682 | - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
683 | + !hasOwn.call( obj, "constructor" ) && |
684 | + !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { |
685 | return false; |
686 | } |
687 | } catch ( e ) { |
688 | + |
689 | // IE8,9 Will throw exceptions on certain host objects #9897 |
690 | return false; |
691 | } |
692 | |
693 | + // Support: IE<9 |
694 | + // Handle iteration over inherited properties before own properties. |
695 | + if ( !support.ownFirst ) { |
696 | + for ( key in obj ) { |
697 | + return hasOwn.call( obj, key ); |
698 | + } |
699 | + } |
700 | + |
701 | // Own properties are enumerated firstly, so to speed up, |
702 | // if last one is own, then all properties are own. |
703 | - |
704 | - var key; |
705 | for ( key in obj ) {} |
706 | |
707 | return key === undefined || hasOwn.call( obj, key ); |
708 | }, |
709 | |
710 | - isEmptyObject: function( obj ) { |
711 | - for ( var name in obj ) { |
712 | - return false; |
713 | - } |
714 | - return true; |
715 | - }, |
716 | - |
717 | - error: function( msg ) { |
718 | - throw new Error( msg ); |
719 | - }, |
720 | - |
721 | - parseJSON: function( data ) { |
722 | - if ( typeof data !== "string" || !data ) { |
723 | - return null; |
724 | - } |
725 | - |
726 | - // Make sure leading/trailing whitespace is removed (IE can't handle it) |
727 | - data = jQuery.trim( data ); |
728 | - |
729 | - // Attempt to parse using the native JSON parser first |
730 | - if ( window.JSON && window.JSON.parse ) { |
731 | - return window.JSON.parse( data ); |
732 | - } |
733 | - |
734 | - // Make sure the incoming data is actual JSON |
735 | - // Logic borrowed from http://json.org/json2.js |
736 | - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) |
737 | - .replace( rvalidtokens, "]" ) |
738 | - .replace( rvalidbraces, "")) ) { |
739 | - |
740 | - return ( new Function( "return " + data ) )(); |
741 | - |
742 | - } |
743 | - jQuery.error( "Invalid JSON: " + data ); |
744 | - }, |
745 | - |
746 | - // Cross-browser xml parsing |
747 | - parseXML: function( data ) { |
748 | - if ( typeof data !== "string" || !data ) { |
749 | - return null; |
750 | - } |
751 | - var xml, tmp; |
752 | - try { |
753 | - if ( window.DOMParser ) { // Standard |
754 | - tmp = new DOMParser(); |
755 | - xml = tmp.parseFromString( data , "text/xml" ); |
756 | - } else { // IE |
757 | - xml = new ActiveXObject( "Microsoft.XMLDOM" ); |
758 | - xml.async = "false"; |
759 | - xml.loadXML( data ); |
760 | - } |
761 | - } catch( e ) { |
762 | - xml = undefined; |
763 | - } |
764 | - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { |
765 | - jQuery.error( "Invalid XML: " + data ); |
766 | - } |
767 | - return xml; |
768 | - }, |
769 | - |
770 | - noop: function() {}, |
771 | - |
772 | - // Evaluates a script in a global context |
773 | + type: function( obj ) { |
774 | + if ( obj == null ) { |
775 | + return obj + ""; |
776 | + } |
777 | + return typeof obj === "object" || typeof obj === "function" ? |
778 | + class2type[ toString.call( obj ) ] || "object" : |
779 | + typeof obj; |
780 | + }, |
781 | + |
782 | // Workarounds based on findings by Jim Driscoll |
783 | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context |
784 | globalEval: function( data ) { |
785 | - if ( data && rnotwhite.test( data ) ) { |
786 | + if ( data && jQuery.trim( data ) ) { |
787 | + |
788 | // We use execScript on Internet Explorer |
789 | // We use an anonymous function so that context is window |
790 | // rather than jQuery in Firefox |
791 | ( window.execScript || function( data ) { |
792 | - window[ "eval" ].call( window, data ); |
793 | + window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation |
794 | } )( data ); |
795 | } |
796 | }, |
797 | @@ -623,98 +358,70 @@ |
798 | }, |
799 | |
800 | nodeName: function( elem, name ) { |
801 | - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
802 | + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
803 | }, |
804 | |
805 | - // args is for internal usage only |
806 | - each: function( object, callback, args ) { |
807 | - var name, i = 0, |
808 | - length = object.length, |
809 | - isObj = length === undefined || jQuery.isFunction( object ); |
810 | + each: function( obj, callback ) { |
811 | + var length, i = 0; |
812 | |
813 | - if ( args ) { |
814 | - if ( isObj ) { |
815 | - for ( name in object ) { |
816 | - if ( callback.apply( object[ name ], args ) === false ) { |
817 | - break; |
818 | - } |
819 | - } |
820 | - } else { |
821 | - for ( ; i < length; ) { |
822 | - if ( callback.apply( object[ i++ ], args ) === false ) { |
823 | - break; |
824 | - } |
825 | + if ( isArrayLike( obj ) ) { |
826 | + length = obj.length; |
827 | + for ( ; i < length; i++ ) { |
828 | + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
829 | + break; |
830 | } |
831 | } |
832 | - |
833 | - // A special, fast, case for the most common use of each |
834 | } else { |
835 | - if ( isObj ) { |
836 | - for ( name in object ) { |
837 | - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
838 | - break; |
839 | - } |
840 | - } |
841 | - } else { |
842 | - for ( ; i < length; ) { |
843 | - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { |
844 | - break; |
845 | - } |
846 | + for ( i in obj ) { |
847 | + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
848 | + break; |
849 | } |
850 | } |
851 | } |
852 | |
853 | - return object; |
854 | - }, |
855 | - |
856 | - // Use native String.trim function wherever possible |
857 | - trim: trim ? |
858 | - function( text ) { |
859 | - return text == null ? |
860 | - "" : |
861 | - trim.call( text ); |
862 | - } : |
863 | - |
864 | - // Otherwise use our own trimming functionality |
865 | - function( text ) { |
866 | - return text == null ? |
867 | - "" : |
868 | - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); |
869 | - }, |
870 | + return obj; |
871 | + }, |
872 | + |
873 | + // Support: Android<4.1, IE<9 |
874 | + trim: function( text ) { |
875 | + return text == null ? |
876 | + "" : |
877 | + ( text + "" ).replace( rtrim, "" ); |
878 | + }, |
879 | |
880 | // results is for internal usage only |
881 | - makeArray: function( array, results ) { |
882 | + makeArray: function( arr, results ) { |
883 | var ret = results || []; |
884 | |
885 | - if ( array != null ) { |
886 | - // The window, strings (and functions) also have 'length' |
887 | - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 |
888 | - var type = jQuery.type( array ); |
889 | - |
890 | - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { |
891 | - push.call( ret, array ); |
892 | + if ( arr != null ) { |
893 | + if ( isArrayLike( Object( arr ) ) ) { |
894 | + jQuery.merge( ret, |
895 | + typeof arr === "string" ? |
896 | + [ arr ] : arr |
897 | + ); |
898 | } else { |
899 | - jQuery.merge( ret, array ); |
900 | + push.call( ret, arr ); |
901 | } |
902 | } |
903 | |
904 | return ret; |
905 | }, |
906 | |
907 | - inArray: function( elem, array, i ) { |
908 | + inArray: function( elem, arr, i ) { |
909 | var len; |
910 | |
911 | - if ( array ) { |
912 | + if ( arr ) { |
913 | if ( indexOf ) { |
914 | - return indexOf.call( array, elem, i ); |
915 | + return indexOf.call( arr, elem, i ); |
916 | } |
917 | |
918 | - len = array.length; |
919 | + len = arr.length; |
920 | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; |
921 | |
922 | for ( ; i < len; i++ ) { |
923 | + |
924 | // Skip accessing in sparse arrays |
925 | - if ( i in array && array[ i ] === elem ) { |
926 | + if ( i in arr && arr[ i ] === elem ) { |
927 | return i; |
928 | } |
929 | } |
930 | @@ -724,16 +431,18 @@ |
931 | }, |
932 | |
933 | merge: function( first, second ) { |
934 | - var i = first.length, |
935 | - j = 0; |
936 | - |
937 | - if ( typeof second.length === "number" ) { |
938 | - for ( var l = second.length; j < l; j++ ) { |
939 | - first[ i++ ] = second[ j ]; |
940 | - } |
941 | - |
942 | - } else { |
943 | - while ( second[j] !== undefined ) { |
944 | + var len = +second.length, |
945 | + j = 0, |
946 | + i = first.length; |
947 | + |
948 | + while ( j < len ) { |
949 | + first[ i++ ] = second[ j++ ]; |
950 | + } |
951 | + |
952 | + // Support: IE<9 |
953 | + // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) |
954 | + if ( len !== len ) { |
955 | + while ( second[ j ] !== undefined ) { |
956 | first[ i++ ] = second[ j++ ]; |
957 | } |
958 | } |
959 | @@ -743,53 +452,55 @@ |
960 | return first; |
961 | }, |
962 | |
963 | - grep: function( elems, callback, inv ) { |
964 | - var ret = [], retVal; |
965 | - inv = !!inv; |
966 | + grep: function( elems, callback, invert ) { |
967 | + var callbackInverse, |
968 | + matches = [], |
969 | + i = 0, |
970 | + length = elems.length, |
971 | + callbackExpect = !invert; |
972 | |
973 | // Go through the array, only saving the items |
974 | // that pass the validator function |
975 | - for ( var i = 0, length = elems.length; i < length; i++ ) { |
976 | - retVal = !!callback( elems[ i ], i ); |
977 | - if ( inv !== retVal ) { |
978 | - ret.push( elems[ i ] ); |
979 | + for ( ; i < length; i++ ) { |
980 | + callbackInverse = !callback( elems[ i ], i ); |
981 | + if ( callbackInverse !== callbackExpect ) { |
982 | + matches.push( elems[ i ] ); |
983 | } |
984 | } |
985 | |
986 | - return ret; |
987 | + return matches; |
988 | }, |
989 | |
990 | // arg is for internal usage only |
991 | map: function( elems, callback, arg ) { |
992 | - var value, key, ret = [], |
993 | + var length, value, |
994 | i = 0, |
995 | - length = elems.length, |
996 | - // jquery objects are treated as arrays |
997 | - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; |
998 | + ret = []; |
999 | |
1000 | - // Go through the array, translating each of the items to their |
1001 | - if ( isArray ) { |
1002 | + // Go through the array, translating each of the items to their new values |
1003 | + if ( isArrayLike( elems ) ) { |
1004 | + length = elems.length; |
1005 | for ( ; i < length; i++ ) { |
1006 | value = callback( elems[ i ], i, arg ); |
1007 | |
1008 | if ( value != null ) { |
1009 | - ret[ ret.length ] = value; |
1010 | + ret.push( value ); |
1011 | } |
1012 | } |
1013 | |
1014 | // Go through every key on the object, |
1015 | } else { |
1016 | - for ( key in elems ) { |
1017 | - value = callback( elems[ key ], key, arg ); |
1018 | + for ( i in elems ) { |
1019 | + value = callback( elems[ i ], i, arg ); |
1020 | |
1021 | if ( value != null ) { |
1022 | - ret[ ret.length ] = value; |
1023 | + ret.push( value ); |
1024 | } |
1025 | } |
1026 | } |
1027 | |
1028 | // Flatten any nested arrays |
1029 | - return ret.concat.apply( [], ret ); |
1030 | + return concat.apply( [], ret ); |
1031 | }, |
1032 | |
1033 | // A global GUID counter for objects |
1034 | @@ -798,8 +509,10 @@ |
1035 | // Bind a function to a context, optionally partially applying any |
1036 | // arguments. |
1037 | proxy: function( fn, context ) { |
1038 | + var args, proxy, tmp; |
1039 | + |
1040 | if ( typeof context === "string" ) { |
1041 | - var tmp = fn[ context ]; |
1042 | + tmp = fn[ context ]; |
1043 | context = fn; |
1044 | fn = tmp; |
1045 | } |
1046 | @@ -811,202 +524,2656 @@ |
1047 | } |
1048 | |
1049 | // Simulated bind |
1050 | - var args = slice.call( arguments, 2 ), |
1051 | - proxy = function() { |
1052 | - return fn.apply( context, args.concat( slice.call( arguments ) ) ); |
1053 | - }; |
1054 | + args = slice.call( arguments, 2 ); |
1055 | + proxy = function() { |
1056 | + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
1057 | + }; |
1058 | |
1059 | // Set the guid of unique handler to the same of original handler, so it can be removed |
1060 | - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
1061 | + proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
1062 | |
1063 | return proxy; |
1064 | }, |
1065 | |
1066 | - // Mutifunctional method to get and set values to a collection |
1067 | - // The value/s can optionally be executed if it's a function |
1068 | - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { |
1069 | - var exec, |
1070 | - bulk = key == null, |
1071 | - i = 0, |
1072 | - length = elems.length; |
1073 | - |
1074 | - // Sets many values |
1075 | - if ( key && typeof key === "object" ) { |
1076 | - for ( i in key ) { |
1077 | - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); |
1078 | - } |
1079 | - chainable = 1; |
1080 | - |
1081 | - // Sets one value |
1082 | - } else if ( value !== undefined ) { |
1083 | - // Optionally, function values get executed if exec is true |
1084 | - exec = pass === undefined && jQuery.isFunction( value ); |
1085 | - |
1086 | - if ( bulk ) { |
1087 | - // Bulk operations only iterate when executing function values |
1088 | - if ( exec ) { |
1089 | - exec = fn; |
1090 | - fn = function( elem, key, value ) { |
1091 | - return exec.call( jQuery( elem ), value ); |
1092 | - }; |
1093 | - |
1094 | - // Otherwise they run against the entire set |
1095 | - } else { |
1096 | - fn.call( elems, value ); |
1097 | - fn = null; |
1098 | - } |
1099 | - } |
1100 | - |
1101 | - if ( fn ) { |
1102 | - for (; i < length; i++ ) { |
1103 | - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
1104 | - } |
1105 | - } |
1106 | - |
1107 | - chainable = 1; |
1108 | - } |
1109 | - |
1110 | - return chainable ? |
1111 | - elems : |
1112 | - |
1113 | - // Gets |
1114 | - bulk ? |
1115 | - fn.call( elems ) : |
1116 | - length ? fn( elems[0], key ) : emptyGet; |
1117 | - }, |
1118 | - |
1119 | now: function() { |
1120 | - return ( new Date() ).getTime(); |
1121 | - }, |
1122 | - |
1123 | - // Use of jQuery.browser is frowned upon. |
1124 | - // More details: http://docs.jquery.com/Utilities/jQuery.browser |
1125 | - uaMatch: function( ua ) { |
1126 | - ua = ua.toLowerCase(); |
1127 | - |
1128 | - var match = rwebkit.exec( ua ) || |
1129 | - ropera.exec( ua ) || |
1130 | - rmsie.exec( ua ) || |
1131 | - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || |
1132 | - []; |
1133 | - |
1134 | - return { browser: match[1] || "", version: match[2] || "0" }; |
1135 | - }, |
1136 | - |
1137 | - sub: function() { |
1138 | - function jQuerySub( selector, context ) { |
1139 | - return new jQuerySub.fn.init( selector, context ); |
1140 | - } |
1141 | - jQuery.extend( true, jQuerySub, this ); |
1142 | - jQuerySub.superclass = this; |
1143 | - jQuerySub.fn = jQuerySub.prototype = this(); |
1144 | - jQuerySub.fn.constructor = jQuerySub; |
1145 | - jQuerySub.sub = this.sub; |
1146 | - jQuerySub.fn.init = function init( selector, context ) { |
1147 | - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { |
1148 | - context = jQuerySub( context ); |
1149 | - } |
1150 | - |
1151 | - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); |
1152 | - }; |
1153 | - jQuerySub.fn.init.prototype = jQuerySub.fn; |
1154 | - var rootjQuerySub = jQuerySub(document); |
1155 | - return jQuerySub; |
1156 | - }, |
1157 | - |
1158 | - browser: {} |
1159 | -}); |
1160 | + return +( new Date() ); |
1161 | + }, |
1162 | + |
1163 | + // jQuery.support is not used in Core but other projects attach their |
1164 | + // properties to it so it needs to exist. |
1165 | + support: support |
1166 | +} ); |
1167 | + |
1168 | +// JSHint would error on this code due to the Symbol not being defined in ES5. |
1169 | +// Defining this global in .jshintrc would create a danger of using the global |
1170 | +// unguarded in another place, it seems safer to just disable JSHint for these |
1171 | +// three lines. |
1172 | +/* jshint ignore: start */ |
1173 | +if ( typeof Symbol === "function" ) { |
1174 | + jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ]; |
1175 | +} |
1176 | +/* jshint ignore: end */ |
1177 | |
1178 | // Populate the class2type map |
1179 | -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { |
1180 | +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
1181 | +function( i, name ) { |
1182 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
1183 | +} ); |
1184 | + |
1185 | +function isArrayLike( obj ) { |
1186 | + |
1187 | + // Support: iOS 8.2 (not reproducible in simulator) |
1188 | + // `in` check used to prevent JIT error (gh-2145) |
1189 | + // hasOwn isn't used here due to false negatives |
1190 | + // regarding Nodelist length in IE |
1191 | + var length = !!obj && "length" in obj && obj.length, |
1192 | + type = jQuery.type( obj ); |
1193 | + |
1194 | + if ( type === "function" || jQuery.isWindow( obj ) ) { |
1195 | + return false; |
1196 | + } |
1197 | + |
1198 | + return type === "array" || length === 0 || |
1199 | + typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
1200 | +} |
1201 | +var Sizzle = |
1202 | +/*! |
1203 | + * Sizzle CSS Selector Engine v2.2.1 |
1204 | + * http://sizzlejs.com/ |
1205 | + * |
1206 | + * Copyright jQuery Foundation and other contributors |
1207 | + * Released under the MIT license |
1208 | + * http://jquery.org/license |
1209 | + * |
1210 | + * Date: 2015-10-17 |
1211 | + */ |
1212 | +(function( window ) { |
1213 | + |
1214 | +var i, |
1215 | + support, |
1216 | + Expr, |
1217 | + getText, |
1218 | + isXML, |
1219 | + tokenize, |
1220 | + compile, |
1221 | + select, |
1222 | + outermostContext, |
1223 | + sortInput, |
1224 | + hasDuplicate, |
1225 | + |
1226 | + // Local document vars |
1227 | + setDocument, |
1228 | + document, |
1229 | + docElem, |
1230 | + documentIsHTML, |
1231 | + rbuggyQSA, |
1232 | + rbuggyMatches, |
1233 | + matches, |
1234 | + contains, |
1235 | + |
1236 | + // Instance-specific data |
1237 | + expando = "sizzle" + 1 * new Date(), |
1238 | + preferredDoc = window.document, |
1239 | + dirruns = 0, |
1240 | + done = 0, |
1241 | + classCache = createCache(), |
1242 | + tokenCache = createCache(), |
1243 | + compilerCache = createCache(), |
1244 | + sortOrder = function( a, b ) { |
1245 | + if ( a === b ) { |
1246 | + hasDuplicate = true; |
1247 | + } |
1248 | + return 0; |
1249 | + }, |
1250 | + |
1251 | + // General-purpose constants |
1252 | + MAX_NEGATIVE = 1 << 31, |
1253 | + |
1254 | + // Instance methods |
1255 | + hasOwn = ({}).hasOwnProperty, |
1256 | + arr = [], |
1257 | + pop = arr.pop, |
1258 | + push_native = arr.push, |
1259 | + push = arr.push, |
1260 | + slice = arr.slice, |
1261 | + // Use a stripped-down indexOf as it's faster than native |
1262 | + // http://jsperf.com/thor-indexof-vs-for/5 |
1263 | + indexOf = function( list, elem ) { |
1264 | + var i = 0, |
1265 | + len = list.length; |
1266 | + for ( ; i < len; i++ ) { |
1267 | + if ( list[i] === elem ) { |
1268 | + return i; |
1269 | + } |
1270 | + } |
1271 | + return -1; |
1272 | + }, |
1273 | + |
1274 | + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", |
1275 | + |
1276 | + // Regular expressions |
1277 | + |
1278 | + // http://www.w3.org/TR/css3-selectors/#whitespace |
1279 | + whitespace = "[\\x20\\t\\r\\n\\f]", |
1280 | + |
1281 | + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
1282 | + identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", |
1283 | + |
1284 | + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
1285 | + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
1286 | + // Operator (capture 2) |
1287 | + "*([*^$|!~]?=)" + whitespace + |
1288 | + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
1289 | + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
1290 | + "*\\]", |
1291 | + |
1292 | + pseudos = ":(" + identifier + ")(?:\\((" + |
1293 | + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
1294 | + // 1. quoted (capture 3; capture 4 or capture 5) |
1295 | + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
1296 | + // 2. simple (capture 6) |
1297 | + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
1298 | + // 3. anything else (capture 2) |
1299 | + ".*" + |
1300 | + ")\\)|)", |
1301 | + |
1302 | + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
1303 | + rwhitespace = new RegExp( whitespace + "+", "g" ), |
1304 | + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
1305 | + |
1306 | + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
1307 | + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), |
1308 | + |
1309 | + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), |
1310 | + |
1311 | + rpseudo = new RegExp( pseudos ), |
1312 | + ridentifier = new RegExp( "^" + identifier + "$" ), |
1313 | + |
1314 | + matchExpr = { |
1315 | + "ID": new RegExp( "^#(" + identifier + ")" ), |
1316 | + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
1317 | + "TAG": new RegExp( "^(" + identifier + "|[*])" ), |
1318 | + "ATTR": new RegExp( "^" + attributes ), |
1319 | + "PSEUDO": new RegExp( "^" + pseudos ), |
1320 | + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
1321 | + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
1322 | + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
1323 | + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
1324 | + // For use in libraries implementing .is() |
1325 | + // We use this for POS matching in `select` |
1326 | + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
1327 | + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
1328 | + }, |
1329 | + |
1330 | + rinputs = /^(?:input|select|textarea|button)$/i, |
1331 | + rheader = /^h\d$/i, |
1332 | + |
1333 | + rnative = /^[^{]+\{\s*\[native \w/, |
1334 | + |
1335 | + // Easily-parseable/retrievable ID or TAG or CLASS selectors |
1336 | + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
1337 | + |
1338 | + rsibling = /[+~]/, |
1339 | + rescape = /'|\\/g, |
1340 | + |
1341 | + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
1342 | + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), |
1343 | + funescape = function( _, escaped, escapedWhitespace ) { |
1344 | + var high = "0x" + escaped - 0x10000; |
1345 | + // NaN means non-codepoint |
1346 | + // Support: Firefox<24 |
1347 | + // Workaround erroneous numeric interpretation of +"0x" |
1348 | + return high !== high || escapedWhitespace ? |
1349 | + escaped : |
1350 | + high < 0 ? |
1351 | + // BMP codepoint |
1352 | + String.fromCharCode( high + 0x10000 ) : |
1353 | + // Supplemental Plane codepoint (surrogate pair) |
1354 | + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
1355 | + }, |
1356 | + |
1357 | + // Used for iframes |
1358 | + // See setDocument() |
1359 | + // Removing the function wrapper causes a "Permission Denied" |
1360 | + // error in IE |
1361 | + unloadHandler = function() { |
1362 | + setDocument(); |
1363 | + }; |
1364 | + |
1365 | +// Optimize for push.apply( _, NodeList ) |
1366 | +try { |
1367 | + push.apply( |
1368 | + (arr = slice.call( preferredDoc.childNodes )), |
1369 | + preferredDoc.childNodes |
1370 | + ); |
1371 | + // Support: Android<4.0 |
1372 | + // Detect silently failing push.apply |
1373 | + arr[ preferredDoc.childNodes.length ].nodeType; |
1374 | +} catch ( e ) { |
1375 | + push = { apply: arr.length ? |
1376 | + |
1377 | + // Leverage slice if possible |
1378 | + function( target, els ) { |
1379 | + push_native.apply( target, slice.call(els) ); |
1380 | + } : |
1381 | + |
1382 | + // Support: IE<9 |
1383 | + // Otherwise append directly |
1384 | + function( target, els ) { |
1385 | + var j = target.length, |
1386 | + i = 0; |
1387 | + // Can't trust NodeList.length |
1388 | + while ( (target[j++] = els[i++]) ) {} |
1389 | + target.length = j - 1; |
1390 | + } |
1391 | + }; |
1392 | +} |
1393 | + |
1394 | +function Sizzle( selector, context, results, seed ) { |
1395 | + var m, i, elem, nid, nidselect, match, groups, newSelector, |
1396 | + newContext = context && context.ownerDocument, |
1397 | + |
1398 | + // nodeType defaults to 9, since context defaults to document |
1399 | + nodeType = context ? context.nodeType : 9; |
1400 | + |
1401 | + results = results || []; |
1402 | + |
1403 | + // Return early from calls with invalid selector or context |
1404 | + if ( typeof selector !== "string" || !selector || |
1405 | + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
1406 | + |
1407 | + return results; |
1408 | + } |
1409 | + |
1410 | + // Try to shortcut find operations (as opposed to filters) in HTML documents |
1411 | + if ( !seed ) { |
1412 | + |
1413 | + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { |
1414 | + setDocument( context ); |
1415 | + } |
1416 | + context = context || document; |
1417 | + |
1418 | + if ( documentIsHTML ) { |
1419 | + |
1420 | + // If the selector is sufficiently simple, try using a "get*By*" DOM method |
1421 | + // (excepting DocumentFragment context, where the methods don't exist) |
1422 | + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { |
1423 | + |
1424 | + // ID selector |
1425 | + if ( (m = match[1]) ) { |
1426 | + |
1427 | + // Document context |
1428 | + if ( nodeType === 9 ) { |
1429 | + if ( (elem = context.getElementById( m )) ) { |
1430 | + |
1431 | + // Support: IE, Opera, Webkit |
1432 | + // TODO: identify versions |
1433 | + // getElementById can match elements by name instead of ID |
1434 | + if ( elem.id === m ) { |
1435 | + results.push( elem ); |
1436 | + return results; |
1437 | + } |
1438 | + } else { |
1439 | + return results; |
1440 | + } |
1441 | + |
1442 | + // Element context |
1443 | + } else { |
1444 | + |
1445 | + // Support: IE, Opera, Webkit |
1446 | + // TODO: identify versions |
1447 | + // getElementById can match elements by name instead of ID |
1448 | + if ( newContext && (elem = newContext.getElementById( m )) && |
1449 | + contains( context, elem ) && |
1450 | + elem.id === m ) { |
1451 | + |
1452 | + results.push( elem ); |
1453 | + return results; |
1454 | + } |
1455 | + } |
1456 | + |
1457 | + // Type selector |
1458 | + } else if ( match[2] ) { |
1459 | + push.apply( results, context.getElementsByTagName( selector ) ); |
1460 | + return results; |
1461 | + |
1462 | + // Class selector |
1463 | + } else if ( (m = match[3]) && support.getElementsByClassName && |
1464 | + context.getElementsByClassName ) { |
1465 | + |
1466 | + push.apply( results, context.getElementsByClassName( m ) ); |
1467 | + return results; |
1468 | + } |
1469 | + } |
1470 | + |
1471 | + // Take advantage of querySelectorAll |
1472 | + if ( support.qsa && |
1473 | + !compilerCache[ selector + " " ] && |
1474 | + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { |
1475 | + |
1476 | + if ( nodeType !== 1 ) { |
1477 | + newContext = context; |
1478 | + newSelector = selector; |
1479 | + |
1480 | + // qSA looks outside Element context, which is not what we want |
1481 | + // Thanks to Andrew Dupont for this workaround technique |
1482 | + // Support: IE <=8 |
1483 | + // Exclude object elements |
1484 | + } else if ( context.nodeName.toLowerCase() !== "object" ) { |
1485 | + |
1486 | + // Capture the context ID, setting it first if necessary |
1487 | + if ( (nid = context.getAttribute( "id" )) ) { |
1488 | + nid = nid.replace( rescape, "\\$&" ); |
1489 | + } else { |
1490 | + context.setAttribute( "id", (nid = expando) ); |
1491 | + } |
1492 | + |
1493 | + // Prefix every selector in the list |
1494 | + groups = tokenize( selector ); |
1495 | + i = groups.length; |
1496 | + nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; |
1497 | + while ( i-- ) { |
1498 | + groups[i] = nidselect + " " + toSelector( groups[i] ); |
1499 | + } |
1500 | + newSelector = groups.join( "," ); |
1501 | + |
1502 | + // Expand context for sibling selectors |
1503 | + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
1504 | + context; |
1505 | + } |
1506 | + |
1507 | + if ( newSelector ) { |
1508 | + try { |
1509 | + push.apply( results, |
1510 | + newContext.querySelectorAll( newSelector ) |
1511 | + ); |
1512 | + return results; |
1513 | + } catch ( qsaError ) { |
1514 | + } finally { |
1515 | + if ( nid === expando ) { |
1516 | + context.removeAttribute( "id" ); |
1517 | + } |
1518 | + } |
1519 | + } |
1520 | + } |
1521 | + } |
1522 | + } |
1523 | + |
1524 | + // All others |
1525 | + return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
1526 | +} |
1527 | + |
1528 | +/** |
1529 | + * Create key-value caches of limited size |
1530 | + * @returns {function(string, object)} Returns the Object data after storing it on itself with |
1531 | + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
1532 | + * deleting the oldest entry |
1533 | + */ |
1534 | +function createCache() { |
1535 | + var keys = []; |
1536 | + |
1537 | + function cache( key, value ) { |
1538 | + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
1539 | + if ( keys.push( key + " " ) > Expr.cacheLength ) { |
1540 | + // Only keep the most recent entries |
1541 | + delete cache[ keys.shift() ]; |
1542 | + } |
1543 | + return (cache[ key + " " ] = value); |
1544 | + } |
1545 | + return cache; |
1546 | +} |
1547 | + |
1548 | +/** |
1549 | + * Mark a function for special use by Sizzle |
1550 | + * @param {Function} fn The function to mark |
1551 | + */ |
1552 | +function markFunction( fn ) { |
1553 | + fn[ expando ] = true; |
1554 | + return fn; |
1555 | +} |
1556 | + |
1557 | +/** |
1558 | + * Support testing using an element |
1559 | + * @param {Function} fn Passed the created div and expects a boolean result |
1560 | + */ |
1561 | +function assert( fn ) { |
1562 | + var div = document.createElement("div"); |
1563 | + |
1564 | + try { |
1565 | + return !!fn( div ); |
1566 | + } catch (e) { |
1567 | + return false; |
1568 | + } finally { |
1569 | + // Remove from its parent by default |
1570 | + if ( div.parentNode ) { |
1571 | + div.parentNode.removeChild( div ); |
1572 | + } |
1573 | + // release memory in IE |
1574 | + div = null; |
1575 | + } |
1576 | +} |
1577 | + |
1578 | +/** |
1579 | + * Adds the same handler for all of the specified attrs |
1580 | + * @param {String} attrs Pipe-separated list of attributes |
1581 | + * @param {Function} handler The method that will be applied |
1582 | + */ |
1583 | +function addHandle( attrs, handler ) { |
1584 | + var arr = attrs.split("|"), |
1585 | + i = arr.length; |
1586 | + |
1587 | + while ( i-- ) { |
1588 | + Expr.attrHandle[ arr[i] ] = handler; |
1589 | + } |
1590 | +} |
1591 | + |
1592 | +/** |
1593 | + * Checks document order of two siblings |
1594 | + * @param {Element} a |
1595 | + * @param {Element} b |
1596 | + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
1597 | + */ |
1598 | +function siblingCheck( a, b ) { |
1599 | + var cur = b && a, |
1600 | + diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
1601 | + ( ~b.sourceIndex || MAX_NEGATIVE ) - |
1602 | + ( ~a.sourceIndex || MAX_NEGATIVE ); |
1603 | + |
1604 | + // Use IE sourceIndex if available on both nodes |
1605 | + if ( diff ) { |
1606 | + return diff; |
1607 | + } |
1608 | + |
1609 | + // Check if b follows a |
1610 | + if ( cur ) { |
1611 | + while ( (cur = cur.nextSibling) ) { |
1612 | + if ( cur === b ) { |
1613 | + return -1; |
1614 | + } |
1615 | + } |
1616 | + } |
1617 | + |
1618 | + return a ? 1 : -1; |
1619 | +} |
1620 | + |
1621 | +/** |
1622 | + * Returns a function to use in pseudos for input types |
1623 | + * @param {String} type |
1624 | + */ |
1625 | +function createInputPseudo( type ) { |
1626 | + return function( elem ) { |
1627 | + var name = elem.nodeName.toLowerCase(); |
1628 | + return name === "input" && elem.type === type; |
1629 | + }; |
1630 | +} |
1631 | + |
1632 | +/** |
1633 | + * Returns a function to use in pseudos for buttons |
1634 | + * @param {String} type |
1635 | + */ |
1636 | +function createButtonPseudo( type ) { |
1637 | + return function( elem ) { |
1638 | + var name = elem.nodeName.toLowerCase(); |
1639 | + return (name === "input" || name === "button") && elem.type === type; |
1640 | + }; |
1641 | +} |
1642 | + |
1643 | +/** |
1644 | + * Returns a function to use in pseudos for positionals |
1645 | + * @param {Function} fn |
1646 | + */ |
1647 | +function createPositionalPseudo( fn ) { |
1648 | + return markFunction(function( argument ) { |
1649 | + argument = +argument; |
1650 | + return markFunction(function( seed, matches ) { |
1651 | + var j, |
1652 | + matchIndexes = fn( [], seed.length, argument ), |
1653 | + i = matchIndexes.length; |
1654 | + |
1655 | + // Match elements found at the specified indexes |
1656 | + while ( i-- ) { |
1657 | + if ( seed[ (j = matchIndexes[i]) ] ) { |
1658 | + seed[j] = !(matches[j] = seed[j]); |
1659 | + } |
1660 | + } |
1661 | + }); |
1662 | + }); |
1663 | +} |
1664 | + |
1665 | +/** |
1666 | + * Checks a node for validity as a Sizzle context |
1667 | + * @param {Element|Object=} context |
1668 | + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1669 | + */ |
1670 | +function testContext( context ) { |
1671 | + return context && typeof context.getElementsByTagName !== "undefined" && context; |
1672 | +} |
1673 | + |
1674 | +// Expose support vars for convenience |
1675 | +support = Sizzle.support = {}; |
1676 | + |
1677 | +/** |
1678 | + * Detects XML nodes |
1679 | + * @param {Element|Object} elem An element or a document |
1680 | + * @returns {Boolean} True iff elem is a non-HTML XML node |
1681 | + */ |
1682 | +isXML = Sizzle.isXML = function( elem ) { |
1683 | + // documentElement is verified for cases where it doesn't yet exist |
1684 | + // (such as loading iframes in IE - #4833) |
1685 | + var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
1686 | + return documentElement ? documentElement.nodeName !== "HTML" : false; |
1687 | +}; |
1688 | + |
1689 | +/** |
1690 | + * Sets document-related variables once based on the current document |
1691 | + * @param {Element|Object} [doc] An element or document object to use to set the document |
1692 | + * @returns {Object} Returns the current document |
1693 | + */ |
1694 | +setDocument = Sizzle.setDocument = function( node ) { |
1695 | + var hasCompare, parent, |
1696 | + doc = node ? node.ownerDocument || node : preferredDoc; |
1697 | + |
1698 | + // Return early if doc is invalid or already selected |
1699 | + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { |
1700 | + return document; |
1701 | + } |
1702 | + |
1703 | + // Update global variables |
1704 | + document = doc; |
1705 | + docElem = document.documentElement; |
1706 | + documentIsHTML = !isXML( document ); |
1707 | + |
1708 | + // Support: IE 9-11, Edge |
1709 | + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
1710 | + if ( (parent = document.defaultView) && parent.top !== parent ) { |
1711 | + // Support: IE 11 |
1712 | + if ( parent.addEventListener ) { |
1713 | + parent.addEventListener( "unload", unloadHandler, false ); |
1714 | + |
1715 | + // Support: IE 9 - 10 only |
1716 | + } else if ( parent.attachEvent ) { |
1717 | + parent.attachEvent( "onunload", unloadHandler ); |
1718 | + } |
1719 | + } |
1720 | + |
1721 | + /* Attributes |
1722 | + ---------------------------------------------------------------------- */ |
1723 | + |
1724 | + // Support: IE<8 |
1725 | + // Verify that getAttribute really returns attributes and not properties |
1726 | + // (excepting IE8 booleans) |
1727 | + support.attributes = assert(function( div ) { |
1728 | + div.className = "i"; |
1729 | + return !div.getAttribute("className"); |
1730 | + }); |
1731 | + |
1732 | + /* getElement(s)By* |
1733 | + ---------------------------------------------------------------------- */ |
1734 | + |
1735 | + // Check if getElementsByTagName("*") returns only elements |
1736 | + support.getElementsByTagName = assert(function( div ) { |
1737 | + div.appendChild( document.createComment("") ); |
1738 | + return !div.getElementsByTagName("*").length; |
1739 | + }); |
1740 | + |
1741 | + // Support: IE<9 |
1742 | + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
1743 | + |
1744 | + // Support: IE<10 |
1745 | + // Check if getElementById returns elements by name |
1746 | + // The broken getElementById methods don't pick up programatically-set names, |
1747 | + // so use a roundabout getElementsByName test |
1748 | + support.getById = assert(function( div ) { |
1749 | + docElem.appendChild( div ).id = expando; |
1750 | + return !document.getElementsByName || !document.getElementsByName( expando ).length; |
1751 | + }); |
1752 | + |
1753 | + // ID find and filter |
1754 | + if ( support.getById ) { |
1755 | + Expr.find["ID"] = function( id, context ) { |
1756 | + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1757 | + var m = context.getElementById( id ); |
1758 | + return m ? [ m ] : []; |
1759 | + } |
1760 | + }; |
1761 | + Expr.filter["ID"] = function( id ) { |
1762 | + var attrId = id.replace( runescape, funescape ); |
1763 | + return function( elem ) { |
1764 | + return elem.getAttribute("id") === attrId; |
1765 | + }; |
1766 | + }; |
1767 | + } else { |
1768 | + // Support: IE6/7 |
1769 | + // getElementById is not reliable as a find shortcut |
1770 | + delete Expr.find["ID"]; |
1771 | + |
1772 | + Expr.filter["ID"] = function( id ) { |
1773 | + var attrId = id.replace( runescape, funescape ); |
1774 | + return function( elem ) { |
1775 | + var node = typeof elem.getAttributeNode !== "undefined" && |
1776 | + elem.getAttributeNode("id"); |
1777 | + return node && node.value === attrId; |
1778 | + }; |
1779 | + }; |
1780 | + } |
1781 | + |
1782 | + // Tag |
1783 | + Expr.find["TAG"] = support.getElementsByTagName ? |
1784 | + function( tag, context ) { |
1785 | + if ( typeof context.getElementsByTagName !== "undefined" ) { |
1786 | + return context.getElementsByTagName( tag ); |
1787 | + |
1788 | + // DocumentFragment nodes don't have gEBTN |
1789 | + } else if ( support.qsa ) { |
1790 | + return context.querySelectorAll( tag ); |
1791 | + } |
1792 | + } : |
1793 | + |
1794 | + function( tag, context ) { |
1795 | + var elem, |
1796 | + tmp = [], |
1797 | + i = 0, |
1798 | + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
1799 | + results = context.getElementsByTagName( tag ); |
1800 | + |
1801 | + // Filter out possible comments |
1802 | + if ( tag === "*" ) { |
1803 | + while ( (elem = results[i++]) ) { |
1804 | + if ( elem.nodeType === 1 ) { |
1805 | + tmp.push( elem ); |
1806 | + } |
1807 | + } |
1808 | + |
1809 | + return tmp; |
1810 | + } |
1811 | + return results; |
1812 | + }; |
1813 | + |
1814 | + // Class |
1815 | + Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { |
1816 | + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1817 | + return context.getElementsByClassName( className ); |
1818 | + } |
1819 | + }; |
1820 | + |
1821 | + /* QSA/matchesSelector |
1822 | + ---------------------------------------------------------------------- */ |
1823 | + |
1824 | + // QSA and matchesSelector support |
1825 | + |
1826 | + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
1827 | + rbuggyMatches = []; |
1828 | + |
1829 | + // qSa(:focus) reports false when true (Chrome 21) |
1830 | + // We allow this because of a bug in IE8/9 that throws an error |
1831 | + // whenever `document.activeElement` is accessed on an iframe |
1832 | + // So, we allow :focus to pass through QSA all the time to avoid the IE error |
1833 | + // See http://bugs.jquery.com/ticket/13378 |
1834 | + rbuggyQSA = []; |
1835 | + |
1836 | + if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { |
1837 | + // Build QSA regex |
1838 | + // Regex strategy adopted from Diego Perini |
1839 | + assert(function( div ) { |
1840 | + // Select is set to empty string on purpose |
1841 | + // This is to test IE's treatment of not explicitly |
1842 | + // setting a boolean content attribute, |
1843 | + // since its presence should be enough |
1844 | + // http://bugs.jquery.com/ticket/12359 |
1845 | + docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + |
1846 | + "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
1847 | + "<option selected=''></option></select>"; |
1848 | + |
1849 | + // Support: IE8, Opera 11-12.16 |
1850 | + // Nothing should be selected when empty strings follow ^= or $= or *= |
1851 | + // The test attribute must be unknown in Opera but "safe" for WinRT |
1852 | + // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
1853 | + if ( div.querySelectorAll("[msallowcapture^='']").length ) { |
1854 | + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
1855 | + } |
1856 | + |
1857 | + // Support: IE8 |
1858 | + // Boolean attributes and "value" are not treated correctly |
1859 | + if ( !div.querySelectorAll("[selected]").length ) { |
1860 | + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1861 | + } |
1862 | + |
1863 | + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
1864 | + if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1865 | + rbuggyQSA.push("~="); |
1866 | + } |
1867 | + |
1868 | + // Webkit/Opera - :checked should return selected option elements |
1869 | + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
1870 | + // IE8 throws error here and will not see later tests |
1871 | + if ( !div.querySelectorAll(":checked").length ) { |
1872 | + rbuggyQSA.push(":checked"); |
1873 | + } |
1874 | + |
1875 | + // Support: Safari 8+, iOS 8+ |
1876 | + // https://bugs.webkit.org/show_bug.cgi?id=136851 |
1877 | + // In-page `selector#id sibing-combinator selector` fails |
1878 | + if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1879 | + rbuggyQSA.push(".#.+[+~]"); |
1880 | + } |
1881 | + }); |
1882 | + |
1883 | + assert(function( div ) { |
1884 | + // Support: Windows 8 Native Apps |
1885 | + // The type and name attributes are restricted during .innerHTML assignment |
1886 | + var input = document.createElement("input"); |
1887 | + input.setAttribute( "type", "hidden" ); |
1888 | + div.appendChild( input ).setAttribute( "name", "D" ); |
1889 | + |
1890 | + // Support: IE8 |
1891 | + // Enforce case-sensitivity of name attribute |
1892 | + if ( div.querySelectorAll("[name=d]").length ) { |
1893 | + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
1894 | + } |
1895 | + |
1896 | + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
1897 | + // IE8 throws error here and will not see later tests |
1898 | + if ( !div.querySelectorAll(":enabled").length ) { |
1899 | + rbuggyQSA.push( ":enabled", ":disabled" ); |
1900 | + } |
1901 | + |
1902 | + // Opera 10-11 does not throw on post-comma invalid pseudos |
1903 | + div.querySelectorAll("*,:x"); |
1904 | + rbuggyQSA.push(",.*:"); |
1905 | + }); |
1906 | + } |
1907 | + |
1908 | + if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
1909 | + docElem.webkitMatchesSelector || |
1910 | + docElem.mozMatchesSelector || |
1911 | + docElem.oMatchesSelector || |
1912 | + docElem.msMatchesSelector) )) ) { |
1913 | + |
1914 | + assert(function( div ) { |
1915 | + // Check to see if it's possible to do matchesSelector |
1916 | + // on a disconnected node (IE 9) |
1917 | + support.disconnectedMatch = matches.call( div, "div" ); |
1918 | + |
1919 | + // This should fail with an exception |
1920 | + // Gecko does not error, returns false instead |
1921 | + matches.call( div, "[s!='']:x" ); |
1922 | + rbuggyMatches.push( "!=", pseudos ); |
1923 | + }); |
1924 | + } |
1925 | + |
1926 | + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); |
1927 | + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); |
1928 | + |
1929 | + /* Contains |
1930 | + ---------------------------------------------------------------------- */ |
1931 | + hasCompare = rnative.test( docElem.compareDocumentPosition ); |
1932 | + |
1933 | + // Element contains another |
1934 | + // Purposefully self-exclusive |
1935 | + // As in, an element does not contain itself |
1936 | + contains = hasCompare || rnative.test( docElem.contains ) ? |
1937 | + function( a, b ) { |
1938 | + var adown = a.nodeType === 9 ? a.documentElement : a, |
1939 | + bup = b && b.parentNode; |
1940 | + return a === bup || !!( bup && bup.nodeType === 1 && ( |
1941 | + adown.contains ? |
1942 | + adown.contains( bup ) : |
1943 | + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
1944 | + )); |
1945 | + } : |
1946 | + function( a, b ) { |
1947 | + if ( b ) { |
1948 | + while ( (b = b.parentNode) ) { |
1949 | + if ( b === a ) { |
1950 | + return true; |
1951 | + } |
1952 | + } |
1953 | + } |
1954 | + return false; |
1955 | + }; |
1956 | + |
1957 | + /* Sorting |
1958 | + ---------------------------------------------------------------------- */ |
1959 | + |
1960 | + // Document order sorting |
1961 | + sortOrder = hasCompare ? |
1962 | + function( a, b ) { |
1963 | + |
1964 | + // Flag for duplicate removal |
1965 | + if ( a === b ) { |
1966 | + hasDuplicate = true; |
1967 | + return 0; |
1968 | + } |
1969 | + |
1970 | + // Sort on method existence if only one input has compareDocumentPosition |
1971 | + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
1972 | + if ( compare ) { |
1973 | + return compare; |
1974 | + } |
1975 | + |
1976 | + // Calculate position if both inputs belong to the same document |
1977 | + compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? |
1978 | + a.compareDocumentPosition( b ) : |
1979 | + |
1980 | + // Otherwise we know they are disconnected |
1981 | + 1; |
1982 | + |
1983 | + // Disconnected nodes |
1984 | + if ( compare & 1 || |
1985 | + (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { |
1986 | + |
1987 | + // Choose the first element that is related to our preferred document |
1988 | + if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { |
1989 | + return -1; |
1990 | + } |
1991 | + if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { |
1992 | + return 1; |
1993 | + } |
1994 | + |
1995 | + // Maintain original order |
1996 | + return sortInput ? |
1997 | + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
1998 | + 0; |
1999 | + } |
2000 | + |
2001 | + return compare & 4 ? -1 : 1; |
2002 | + } : |
2003 | + function( a, b ) { |
2004 | + // Exit early if the nodes are identical |
2005 | + if ( a === b ) { |
2006 | + hasDuplicate = true; |
2007 | + return 0; |
2008 | + } |
2009 | + |
2010 | + var cur, |
2011 | + i = 0, |
2012 | + aup = a.parentNode, |
2013 | + bup = b.parentNode, |
2014 | + ap = [ a ], |
2015 | + bp = [ b ]; |
2016 | + |
2017 | + // Parentless nodes are either documents or disconnected |
2018 | + if ( !aup || !bup ) { |
2019 | + return a === document ? -1 : |
2020 | + b === document ? 1 : |
2021 | + aup ? -1 : |
2022 | + bup ? 1 : |
2023 | + sortInput ? |
2024 | + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
2025 | + 0; |
2026 | + |
2027 | + // If the nodes are siblings, we can do a quick check |
2028 | + } else if ( aup === bup ) { |
2029 | + return siblingCheck( a, b ); |
2030 | + } |
2031 | + |
2032 | + // Otherwise we need full lists of their ancestors for comparison |
2033 | + cur = a; |
2034 | + while ( (cur = cur.parentNode) ) { |
2035 | + ap.unshift( cur ); |
2036 | + } |
2037 | + cur = b; |
2038 | + while ( (cur = cur.parentNode) ) { |
2039 | + bp.unshift( cur ); |
2040 | + } |
2041 | + |
2042 | + // Walk down the tree looking for a discrepancy |
2043 | + while ( ap[i] === bp[i] ) { |
2044 | + i++; |
2045 | + } |
2046 | + |
2047 | + return i ? |
2048 | + // Do a sibling check if the nodes have a common ancestor |
2049 | + siblingCheck( ap[i], bp[i] ) : |
2050 | + |
2051 | + // Otherwise nodes in our document sort first |
2052 | + ap[i] === preferredDoc ? -1 : |
2053 | + bp[i] === preferredDoc ? 1 : |
2054 | + 0; |
2055 | + }; |
2056 | + |
2057 | + return document; |
2058 | +}; |
2059 | + |
2060 | +Sizzle.matches = function( expr, elements ) { |
2061 | + return Sizzle( expr, null, null, elements ); |
2062 | +}; |
2063 | + |
2064 | +Sizzle.matchesSelector = function( elem, expr ) { |
2065 | + // Set document vars if needed |
2066 | + if ( ( elem.ownerDocument || elem ) !== document ) { |
2067 | + setDocument( elem ); |
2068 | + } |
2069 | + |
2070 | + // Make sure that attribute selectors are quoted |
2071 | + expr = expr.replace( rattributeQuotes, "='$1']" ); |
2072 | + |
2073 | + if ( support.matchesSelector && documentIsHTML && |
2074 | + !compilerCache[ expr + " " ] && |
2075 | + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
2076 | + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
2077 | + |
2078 | + try { |
2079 | + var ret = matches.call( elem, expr ); |
2080 | + |
2081 | + // IE 9's matchesSelector returns false on disconnected nodes |
2082 | + if ( ret || support.disconnectedMatch || |
2083 | + // As well, disconnected nodes are said to be in a document |
2084 | + // fragment in IE 9 |
2085 | + elem.document && elem.document.nodeType !== 11 ) { |
2086 | + return ret; |
2087 | + } |
2088 | + } catch (e) {} |
2089 | + } |
2090 | + |
2091 | + return Sizzle( expr, document, null, [ elem ] ).length > 0; |
2092 | +}; |
2093 | + |
2094 | +Sizzle.contains = function( context, elem ) { |
2095 | + // Set document vars if needed |
2096 | + if ( ( context.ownerDocument || context ) !== document ) { |
2097 | + setDocument( context ); |
2098 | + } |
2099 | + return contains( context, elem ); |
2100 | +}; |
2101 | + |
2102 | +Sizzle.attr = function( elem, name ) { |
2103 | + // Set document vars if needed |
2104 | + if ( ( elem.ownerDocument || elem ) !== document ) { |
2105 | + setDocument( elem ); |
2106 | + } |
2107 | + |
2108 | + var fn = Expr.attrHandle[ name.toLowerCase() ], |
2109 | + // Don't get fooled by Object.prototype properties (jQuery #13807) |
2110 | + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
2111 | + fn( elem, name, !documentIsHTML ) : |
2112 | + undefined; |
2113 | + |
2114 | + return val !== undefined ? |
2115 | + val : |
2116 | + support.attributes || !documentIsHTML ? |
2117 | + elem.getAttribute( name ) : |
2118 | + (val = elem.getAttributeNode(name)) && val.specified ? |
2119 | + val.value : |
2120 | + null; |
2121 | +}; |
2122 | + |
2123 | +Sizzle.error = function( msg ) { |
2124 | + throw new Error( "Syntax error, unrecognized expression: " + msg ); |
2125 | +}; |
2126 | + |
2127 | +/** |
2128 | + * Document sorting and removing duplicates |
2129 | + * @param {ArrayLike} results |
2130 | + */ |
2131 | +Sizzle.uniqueSort = function( results ) { |
2132 | + var elem, |
2133 | + duplicates = [], |
2134 | + j = 0, |
2135 | + i = 0; |
2136 | + |
2137 | + // Unless we *know* we can detect duplicates, assume their presence |
2138 | + hasDuplicate = !support.detectDuplicates; |
2139 | + sortInput = !support.sortStable && results.slice( 0 ); |
2140 | + results.sort( sortOrder ); |
2141 | + |
2142 | + if ( hasDuplicate ) { |
2143 | + while ( (elem = results[i++]) ) { |
2144 | + if ( elem === results[ i ] ) { |
2145 | + j = duplicates.push( i ); |
2146 | + } |
2147 | + } |
2148 | + while ( j-- ) { |
2149 | + results.splice( duplicates[ j ], 1 ); |
2150 | + } |
2151 | + } |
2152 | + |
2153 | + // Clear input after sorting to release objects |
2154 | + // See https://github.com/jquery/sizzle/pull/225 |
2155 | + sortInput = null; |
2156 | + |
2157 | + return results; |
2158 | +}; |
2159 | + |
2160 | +/** |
2161 | + * Utility function for retrieving the text value of an array of DOM nodes |
2162 | + * @param {Array|Element} elem |
2163 | + */ |
2164 | +getText = Sizzle.getText = function( elem ) { |
2165 | + var node, |
2166 | + ret = "", |
2167 | + i = 0, |
2168 | + nodeType = elem.nodeType; |
2169 | + |
2170 | + if ( !nodeType ) { |
2171 | + // If no nodeType, this is expected to be an array |
2172 | + while ( (node = elem[i++]) ) { |
2173 | + // Do not traverse comment nodes |
2174 | + ret += getText( node ); |
2175 | + } |
2176 | + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
2177 | + // Use textContent for elements |
2178 | + // innerText usage removed for consistency of new lines (jQuery #11153) |
2179 | + if ( typeof elem.textContent === "string" ) { |
2180 | + return elem.textContent; |
2181 | + } else { |
2182 | + // Traverse its children |
2183 | + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
2184 | + ret += getText( elem ); |
2185 | + } |
2186 | + } |
2187 | + } else if ( nodeType === 3 || nodeType === 4 ) { |
2188 | + return elem.nodeValue; |
2189 | + } |
2190 | + // Do not include comment or processing instruction nodes |
2191 | + |
2192 | + return ret; |
2193 | +}; |
2194 | + |
2195 | +Expr = Sizzle.selectors = { |
2196 | + |
2197 | + // Can be adjusted by the user |
2198 | + cacheLength: 50, |
2199 | + |
2200 | + createPseudo: markFunction, |
2201 | + |
2202 | + match: matchExpr, |
2203 | + |
2204 | + attrHandle: {}, |
2205 | + |
2206 | + find: {}, |
2207 | + |
2208 | + relative: { |
2209 | + ">": { dir: "parentNode", first: true }, |
2210 | + " ": { dir: "parentNode" }, |
2211 | + "+": { dir: "previousSibling", first: true }, |
2212 | + "~": { dir: "previousSibling" } |
2213 | + }, |
2214 | + |
2215 | + preFilter: { |
2216 | + "ATTR": function( match ) { |
2217 | + match[1] = match[1].replace( runescape, funescape ); |
2218 | + |
2219 | + // Move the given value to match[3] whether quoted or unquoted |
2220 | + match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
2221 | + |
2222 | + if ( match[2] === "~=" ) { |
2223 | + match[3] = " " + match[3] + " "; |
2224 | + } |
2225 | + |
2226 | + return match.slice( 0, 4 ); |
2227 | + }, |
2228 | + |
2229 | + "CHILD": function( match ) { |
2230 | + /* matches from matchExpr["CHILD"] |
2231 | + 1 type (only|nth|...) |
2232 | + 2 what (child|of-type) |
2233 | + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
2234 | + 4 xn-component of xn+y argument ([+-]?\d*n|) |
2235 | + 5 sign of xn-component |
2236 | + 6 x of xn-component |
2237 | + 7 sign of y-component |
2238 | + 8 y of y-component |
2239 | + */ |
2240 | + match[1] = match[1].toLowerCase(); |
2241 | + |
2242 | + if ( match[1].slice( 0, 3 ) === "nth" ) { |
2243 | + // nth-* requires argument |
2244 | + if ( !match[3] ) { |
2245 | + Sizzle.error( match[0] ); |
2246 | + } |
2247 | + |
2248 | + // numeric x and y parameters for Expr.filter.CHILD |
2249 | + // remember that false/true cast respectively to 0/1 |
2250 | + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
2251 | + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
2252 | + |
2253 | + // other types prohibit arguments |
2254 | + } else if ( match[3] ) { |
2255 | + Sizzle.error( match[0] ); |
2256 | + } |
2257 | + |
2258 | + return match; |
2259 | + }, |
2260 | + |
2261 | + "PSEUDO": function( match ) { |
2262 | + var excess, |
2263 | + unquoted = !match[6] && match[2]; |
2264 | + |
2265 | + if ( matchExpr["CHILD"].test( match[0] ) ) { |
2266 | + return null; |
2267 | + } |
2268 | + |
2269 | + // Accept quoted arguments as-is |
2270 | + if ( match[3] ) { |
2271 | + match[2] = match[4] || match[5] || ""; |
2272 | + |
2273 | + // Strip excess characters from unquoted arguments |
2274 | + } else if ( unquoted && rpseudo.test( unquoted ) && |
2275 | + // Get excess from tokenize (recursively) |
2276 | + (excess = tokenize( unquoted, true )) && |
2277 | + // advance to the next closing parenthesis |
2278 | + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
2279 | + |
2280 | + // excess is a negative index |
2281 | + match[0] = match[0].slice( 0, excess ); |
2282 | + match[2] = unquoted.slice( 0, excess ); |
2283 | + } |
2284 | + |
2285 | + // Return only captures needed by the pseudo filter method (type and argument) |
2286 | + return match.slice( 0, 3 ); |
2287 | + } |
2288 | + }, |
2289 | + |
2290 | + filter: { |
2291 | + |
2292 | + "TAG": function( nodeNameSelector ) { |
2293 | + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
2294 | + return nodeNameSelector === "*" ? |
2295 | + function() { return true; } : |
2296 | + function( elem ) { |
2297 | + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
2298 | + }; |
2299 | + }, |
2300 | + |
2301 | + "CLASS": function( className ) { |
2302 | + var pattern = classCache[ className + " " ]; |
2303 | + |
2304 | + return pattern || |
2305 | + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
2306 | + classCache( className, function( elem ) { |
2307 | + return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); |
2308 | + }); |
2309 | + }, |
2310 | + |
2311 | + "ATTR": function( name, operator, check ) { |
2312 | + return function( elem ) { |
2313 | + var result = Sizzle.attr( elem, name ); |
2314 | + |
2315 | + if ( result == null ) { |
2316 | + return operator === "!="; |
2317 | + } |
2318 | + if ( !operator ) { |
2319 | + return true; |
2320 | + } |
2321 | + |
2322 | + result += ""; |
2323 | + |
2324 | + return operator === "=" ? result === check : |
2325 | + operator === "!=" ? result !== check : |
2326 | + operator === "^=" ? check && result.indexOf( check ) === 0 : |
2327 | + operator === "*=" ? check && result.indexOf( check ) > -1 : |
2328 | + operator === "$=" ? check && result.slice( -check.length ) === check : |
2329 | + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
2330 | + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
2331 | + false; |
2332 | + }; |
2333 | + }, |
2334 | + |
2335 | + "CHILD": function( type, what, argument, first, last ) { |
2336 | + var simple = type.slice( 0, 3 ) !== "nth", |
2337 | + forward = type.slice( -4 ) !== "last", |
2338 | + ofType = what === "of-type"; |
2339 | + |
2340 | + return first === 1 && last === 0 ? |
2341 | + |
2342 | + // Shortcut for :nth-*(n) |
2343 | + function( elem ) { |
2344 | + return !!elem.parentNode; |
2345 | + } : |
2346 | + |
2347 | + function( elem, context, xml ) { |
2348 | + var cache, uniqueCache, outerCache, node, nodeIndex, start, |
2349 | + dir = simple !== forward ? "nextSibling" : "previousSibling", |
2350 | + parent = elem.parentNode, |
2351 | + name = ofType && elem.nodeName.toLowerCase(), |
2352 | + useCache = !xml && !ofType, |
2353 | + diff = false; |
2354 | + |
2355 | + if ( parent ) { |
2356 | + |
2357 | + // :(first|last|only)-(child|of-type) |
2358 | + if ( simple ) { |
2359 | + while ( dir ) { |
2360 | + node = elem; |
2361 | + while ( (node = node[ dir ]) ) { |
2362 | + if ( ofType ? |
2363 | + node.nodeName.toLowerCase() === name : |
2364 | + node.nodeType === 1 ) { |
2365 | + |
2366 | + return false; |
2367 | + } |
2368 | + } |
2369 | + // Reverse direction for :only-* (if we haven't yet done so) |
2370 | + start = dir = type === "only" && !start && "nextSibling"; |
2371 | + } |
2372 | + return true; |
2373 | + } |
2374 | + |
2375 | + start = [ forward ? parent.firstChild : parent.lastChild ]; |
2376 | + |
2377 | + // non-xml :nth-child(...) stores cache data on `parent` |
2378 | + if ( forward && useCache ) { |
2379 | + |
2380 | + // Seek `elem` from a previously-cached index |
2381 | + |
2382 | + // ...in a gzip-friendly way |
2383 | + node = parent; |
2384 | + outerCache = node[ expando ] || (node[ expando ] = {}); |
2385 | + |
2386 | + // Support: IE <9 only |
2387 | + // Defend against cloned attroperties (jQuery gh-1709) |
2388 | + uniqueCache = outerCache[ node.uniqueID ] || |
2389 | + (outerCache[ node.uniqueID ] = {}); |
2390 | + |
2391 | + cache = uniqueCache[ type ] || []; |
2392 | + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
2393 | + diff = nodeIndex && cache[ 2 ]; |
2394 | + node = nodeIndex && parent.childNodes[ nodeIndex ]; |
2395 | + |
2396 | + while ( (node = ++nodeIndex && node && node[ dir ] || |
2397 | + |
2398 | + // Fallback to seeking `elem` from the start |
2399 | + (diff = nodeIndex = 0) || start.pop()) ) { |
2400 | + |
2401 | + // When found, cache indexes on `parent` and break |
2402 | + if ( node.nodeType === 1 && ++diff && node === elem ) { |
2403 | + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
2404 | + break; |
2405 | + } |
2406 | + } |
2407 | + |
2408 | + } else { |
2409 | + // Use previously-cached element index if available |
2410 | + if ( useCache ) { |
2411 | + // ...in a gzip-friendly way |
2412 | + node = elem; |
2413 | + outerCache = node[ expando ] || (node[ expando ] = {}); |
2414 | + |
2415 | + // Support: IE <9 only |
2416 | + // Defend against cloned attroperties (jQuery gh-1709) |
2417 | + uniqueCache = outerCache[ node.uniqueID ] || |
2418 | + (outerCache[ node.uniqueID ] = {}); |
2419 | + |
2420 | + cache = uniqueCache[ type ] || []; |
2421 | + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
2422 | + diff = nodeIndex; |
2423 | + } |
2424 | + |
2425 | + // xml :nth-child(...) |
2426 | + // or :nth-last-child(...) or :nth(-last)?-of-type(...) |
2427 | + if ( diff === false ) { |
2428 | + // Use the same loop as above to seek `elem` from the start |
2429 | + while ( (node = ++nodeIndex && node && node[ dir ] || |
2430 | + (diff = nodeIndex = 0) || start.pop()) ) { |
2431 | + |
2432 | + if ( ( ofType ? |
2433 | + node.nodeName.toLowerCase() === name : |
2434 | + node.nodeType === 1 ) && |
2435 | + ++diff ) { |
2436 | + |
2437 | + // Cache the index of each encountered element |
2438 | + if ( useCache ) { |
2439 | + outerCache = node[ expando ] || (node[ expando ] = {}); |
2440 | + |
2441 | + // Support: IE <9 only |
2442 | + // Defend against cloned attroperties (jQuery gh-1709) |
2443 | + uniqueCache = outerCache[ node.uniqueID ] || |
2444 | + (outerCache[ node.uniqueID ] = {}); |
2445 | + |
2446 | + uniqueCache[ type ] = [ dirruns, diff ]; |
2447 | + } |
2448 | + |
2449 | + if ( node === elem ) { |
2450 | + break; |
2451 | + } |
2452 | + } |
2453 | + } |
2454 | + } |
2455 | + } |
2456 | + |
2457 | + // Incorporate the offset, then check against cycle size |
2458 | + diff -= last; |
2459 | + return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
2460 | + } |
2461 | + }; |
2462 | + }, |
2463 | + |
2464 | + "PSEUDO": function( pseudo, argument ) { |
2465 | + // pseudo-class names are case-insensitive |
2466 | + // http://www.w3.org/TR/selectors/#pseudo-classes |
2467 | + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
2468 | + // Remember that setFilters inherits from pseudos |
2469 | + var args, |
2470 | + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
2471 | + Sizzle.error( "unsupported pseudo: " + pseudo ); |
2472 | + |
2473 | + // The user may use createPseudo to indicate that |
2474 | + // arguments are needed to create the filter function |
2475 | + // just as Sizzle does |
2476 | + if ( fn[ expando ] ) { |
2477 | + return fn( argument ); |
2478 | + } |
2479 | + |
2480 | + // But maintain support for old signatures |
2481 | + if ( fn.length > 1 ) { |
2482 | + args = [ pseudo, pseudo, "", argument ]; |
2483 | + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
2484 | + markFunction(function( seed, matches ) { |
2485 | + var idx, |
2486 | + matched = fn( seed, argument ), |
2487 | + i = matched.length; |
2488 | + while ( i-- ) { |
2489 | + idx = indexOf( seed, matched[i] ); |
2490 | + seed[ idx ] = !( matches[ idx ] = matched[i] ); |
2491 | + } |
2492 | + }) : |
2493 | + function( elem ) { |
2494 | + return fn( elem, 0, args ); |
2495 | + }; |
2496 | + } |
2497 | + |
2498 | + return fn; |
2499 | + } |
2500 | + }, |
2501 | + |
2502 | + pseudos: { |
2503 | + // Potentially complex pseudos |
2504 | + "not": markFunction(function( selector ) { |
2505 | + // Trim the selector passed to compile |
2506 | + // to avoid treating leading and trailing |
2507 | + // spaces as combinators |
2508 | + var input = [], |
2509 | + results = [], |
2510 | + matcher = compile( selector.replace( rtrim, "$1" ) ); |
2511 | + |
2512 | + return matcher[ expando ] ? |
2513 | + markFunction(function( seed, matches, context, xml ) { |
2514 | + var elem, |
2515 | + unmatched = matcher( seed, null, xml, [] ), |
2516 | + i = seed.length; |
2517 | + |
2518 | + // Match elements unmatched by `matcher` |
2519 | + while ( i-- ) { |
2520 | + if ( (elem = unmatched[i]) ) { |
2521 | + seed[i] = !(matches[i] = elem); |
2522 | + } |
2523 | + } |
2524 | + }) : |
2525 | + function( elem, context, xml ) { |
2526 | + input[0] = elem; |
2527 | + matcher( input, null, xml, results ); |
2528 | + // Don't keep the element (issue #299) |
2529 | + input[0] = null; |
2530 | + return !results.pop(); |
2531 | + }; |
2532 | + }), |
2533 | + |
2534 | + "has": markFunction(function( selector ) { |
2535 | + return function( elem ) { |
2536 | + return Sizzle( selector, elem ).length > 0; |
2537 | + }; |
2538 | + }), |
2539 | + |
2540 | + "contains": markFunction(function( text ) { |
2541 | + text = text.replace( runescape, funescape ); |
2542 | + return function( elem ) { |
2543 | + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
2544 | + }; |
2545 | + }), |
2546 | + |
2547 | + // "Whether an element is represented by a :lang() selector |
2548 | + // is based solely on the element's language value |
2549 | + // being equal to the identifier C, |
2550 | + // or beginning with the identifier C immediately followed by "-". |
2551 | + // The matching of C against the element's language value is performed case-insensitively. |
2552 | + // The identifier C does not have to be a valid language name." |
2553 | + // http://www.w3.org/TR/selectors/#lang-pseudo |
2554 | + "lang": markFunction( function( lang ) { |
2555 | + // lang value must be a valid identifier |
2556 | + if ( !ridentifier.test(lang || "") ) { |
2557 | + Sizzle.error( "unsupported lang: " + lang ); |
2558 | + } |
2559 | + lang = lang.replace( runescape, funescape ).toLowerCase(); |
2560 | + return function( elem ) { |
2561 | + var elemLang; |
2562 | + do { |
2563 | + if ( (elemLang = documentIsHTML ? |
2564 | + elem.lang : |
2565 | + elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { |
2566 | + |
2567 | + elemLang = elemLang.toLowerCase(); |
2568 | + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
2569 | + } |
2570 | + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); |
2571 | + return false; |
2572 | + }; |
2573 | + }), |
2574 | + |
2575 | + // Miscellaneous |
2576 | + "target": function( elem ) { |
2577 | + var hash = window.location && window.location.hash; |
2578 | + return hash && hash.slice( 1 ) === elem.id; |
2579 | + }, |
2580 | + |
2581 | + "root": function( elem ) { |
2582 | + return elem === docElem; |
2583 | + }, |
2584 | + |
2585 | + "focus": function( elem ) { |
2586 | + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
2587 | + }, |
2588 | + |
2589 | + // Boolean properties |
2590 | + "enabled": function( elem ) { |
2591 | + return elem.disabled === false; |
2592 | + }, |
2593 | + |
2594 | + "disabled": function( elem ) { |
2595 | + return elem.disabled === true; |
2596 | + }, |
2597 | + |
2598 | + "checked": function( elem ) { |
2599 | + // In CSS3, :checked should return both checked and selected elements |
2600 | + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
2601 | + var nodeName = elem.nodeName.toLowerCase(); |
2602 | + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
2603 | + }, |
2604 | + |
2605 | + "selected": function( elem ) { |
2606 | + // Accessing this property makes selected-by-default |
2607 | + // options in Safari work properly |
2608 | + if ( elem.parentNode ) { |
2609 | + elem.parentNode.selectedIndex; |
2610 | + } |
2611 | + |
2612 | + return elem.selected === true; |
2613 | + }, |
2614 | + |
2615 | + // Contents |
2616 | + "empty": function( elem ) { |
2617 | + // http://www.w3.org/TR/selectors/#empty-pseudo |
2618 | + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
2619 | + // but not by others (comment: 8; processing instruction: 7; etc.) |
2620 | + // nodeType < 6 works because attributes (2) do not appear as children |
2621 | + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
2622 | + if ( elem.nodeType < 6 ) { |
2623 | + return false; |
2624 | + } |
2625 | + } |
2626 | + return true; |
2627 | + }, |
2628 | + |
2629 | + "parent": function( elem ) { |
2630 | + return !Expr.pseudos["empty"]( elem ); |
2631 | + }, |
2632 | + |
2633 | + // Element/input types |
2634 | + "header": function( elem ) { |
2635 | + return rheader.test( elem.nodeName ); |
2636 | + }, |
2637 | + |
2638 | + "input": function( elem ) { |
2639 | + return rinputs.test( elem.nodeName ); |
2640 | + }, |
2641 | + |
2642 | + "button": function( elem ) { |
2643 | + var name = elem.nodeName.toLowerCase(); |
2644 | + return name === "input" && elem.type === "button" || name === "button"; |
2645 | + }, |
2646 | + |
2647 | + "text": function( elem ) { |
2648 | + var attr; |
2649 | + return elem.nodeName.toLowerCase() === "input" && |
2650 | + elem.type === "text" && |
2651 | + |
2652 | + // Support: IE<8 |
2653 | + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
2654 | + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); |
2655 | + }, |
2656 | + |
2657 | + // Position-in-collection |
2658 | + "first": createPositionalPseudo(function() { |
2659 | + return [ 0 ]; |
2660 | + }), |
2661 | + |
2662 | + "last": createPositionalPseudo(function( matchIndexes, length ) { |
2663 | + return [ length - 1 ]; |
2664 | + }), |
2665 | + |
2666 | + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2667 | + return [ argument < 0 ? argument + length : argument ]; |
2668 | + }), |
2669 | + |
2670 | + "even": createPositionalPseudo(function( matchIndexes, length ) { |
2671 | + var i = 0; |
2672 | + for ( ; i < length; i += 2 ) { |
2673 | + matchIndexes.push( i ); |
2674 | + } |
2675 | + return matchIndexes; |
2676 | + }), |
2677 | + |
2678 | + "odd": createPositionalPseudo(function( matchIndexes, length ) { |
2679 | + var i = 1; |
2680 | + for ( ; i < length; i += 2 ) { |
2681 | + matchIndexes.push( i ); |
2682 | + } |
2683 | + return matchIndexes; |
2684 | + }), |
2685 | + |
2686 | + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2687 | + var i = argument < 0 ? argument + length : argument; |
2688 | + for ( ; --i >= 0; ) { |
2689 | + matchIndexes.push( i ); |
2690 | + } |
2691 | + return matchIndexes; |
2692 | + }), |
2693 | + |
2694 | + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
2695 | + var i = argument < 0 ? argument + length : argument; |
2696 | + for ( ; ++i < length; ) { |
2697 | + matchIndexes.push( i ); |
2698 | + } |
2699 | + return matchIndexes; |
2700 | + }) |
2701 | + } |
2702 | +}; |
2703 | + |
2704 | +Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
2705 | + |
2706 | +// Add button/input type pseudos |
2707 | +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2708 | + Expr.pseudos[ i ] = createInputPseudo( i ); |
2709 | +} |
2710 | +for ( i in { submit: true, reset: true } ) { |
2711 | + Expr.pseudos[ i ] = createButtonPseudo( i ); |
2712 | +} |
2713 | + |
2714 | +// Easy API for creating new setFilters |
2715 | +function setFilters() {} |
2716 | +setFilters.prototype = Expr.filters = Expr.pseudos; |
2717 | +Expr.setFilters = new setFilters(); |
2718 | + |
2719 | +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
2720 | + var matched, match, tokens, type, |
2721 | + soFar, groups, preFilters, |
2722 | + cached = tokenCache[ selector + " " ]; |
2723 | + |
2724 | + if ( cached ) { |
2725 | + return parseOnly ? 0 : cached.slice( 0 ); |
2726 | + } |
2727 | + |
2728 | + soFar = selector; |
2729 | + groups = []; |
2730 | + preFilters = Expr.preFilter; |
2731 | + |
2732 | + while ( soFar ) { |
2733 | + |
2734 | + // Comma and first run |
2735 | + if ( !matched || (match = rcomma.exec( soFar )) ) { |
2736 | + if ( match ) { |
2737 | + // Don't consume trailing commas as valid |
2738 | + soFar = soFar.slice( match[0].length ) || soFar; |
2739 | + } |
2740 | + groups.push( (tokens = []) ); |
2741 | + } |
2742 | + |
2743 | + matched = false; |
2744 | + |
2745 | + // Combinators |
2746 | + if ( (match = rcombinators.exec( soFar )) ) { |
2747 | + matched = match.shift(); |
2748 | + tokens.push({ |
2749 | + value: matched, |
2750 | + // Cast descendant combinators to space |
2751 | + type: match[0].replace( rtrim, " " ) |
2752 | + }); |
2753 | + soFar = soFar.slice( matched.length ); |
2754 | + } |
2755 | + |
2756 | + // Filters |
2757 | + for ( type in Expr.filter ) { |
2758 | + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
2759 | + (match = preFilters[ type ]( match ))) ) { |
2760 | + matched = match.shift(); |
2761 | + tokens.push({ |
2762 | + value: matched, |
2763 | + type: type, |
2764 | + matches: match |
2765 | + }); |
2766 | + soFar = soFar.slice( matched.length ); |
2767 | + } |
2768 | + } |
2769 | + |
2770 | + if ( !matched ) { |
2771 | + break; |
2772 | + } |
2773 | + } |
2774 | + |
2775 | + // Return the length of the invalid excess |
2776 | + // if we're just parsing |
2777 | + // Otherwise, throw an error or return tokens |
2778 | + return parseOnly ? |
2779 | + soFar.length : |
2780 | + soFar ? |
2781 | + Sizzle.error( selector ) : |
2782 | + // Cache the tokens |
2783 | + tokenCache( selector, groups ).slice( 0 ); |
2784 | +}; |
2785 | + |
2786 | +function toSelector( tokens ) { |
2787 | + var i = 0, |
2788 | + len = tokens.length, |
2789 | + selector = ""; |
2790 | + for ( ; i < len; i++ ) { |
2791 | + selector += tokens[i].value; |
2792 | + } |
2793 | + return selector; |
2794 | +} |
2795 | + |
2796 | +function addCombinator( matcher, combinator, base ) { |
2797 | + var dir = combinator.dir, |
2798 | + checkNonElements = base && dir === "parentNode", |
2799 | + doneName = done++; |
2800 | + |
2801 | + return combinator.first ? |
2802 | + // Check against closest ancestor/preceding element |
2803 | + function( elem, context, xml ) { |
2804 | + while ( (elem = elem[ dir ]) ) { |
2805 | + if ( elem.nodeType === 1 || checkNonElements ) { |
2806 | + return matcher( elem, context, xml ); |
2807 | + } |
2808 | + } |
2809 | + } : |
2810 | + |
2811 | + // Check against all ancestor/preceding elements |
2812 | + function( elem, context, xml ) { |
2813 | + var oldCache, uniqueCache, outerCache, |
2814 | + newCache = [ dirruns, doneName ]; |
2815 | + |
2816 | + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2817 | + if ( xml ) { |
2818 | + while ( (elem = elem[ dir ]) ) { |
2819 | + if ( elem.nodeType === 1 || checkNonElements ) { |
2820 | + if ( matcher( elem, context, xml ) ) { |
2821 | + return true; |
2822 | + } |
2823 | + } |
2824 | + } |
2825 | + } else { |
2826 | + while ( (elem = elem[ dir ]) ) { |
2827 | + if ( elem.nodeType === 1 || checkNonElements ) { |
2828 | + outerCache = elem[ expando ] || (elem[ expando ] = {}); |
2829 | + |
2830 | + // Support: IE <9 only |
2831 | + // Defend against cloned attroperties (jQuery gh-1709) |
2832 | + uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); |
2833 | + |
2834 | + if ( (oldCache = uniqueCache[ dir ]) && |
2835 | + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2836 | + |
2837 | + // Assign to newCache so results back-propagate to previous elements |
2838 | + return (newCache[ 2 ] = oldCache[ 2 ]); |
2839 | + } else { |
2840 | + // Reuse newcache so results back-propagate to previous elements |
2841 | + uniqueCache[ dir ] = newCache; |
2842 | + |
2843 | + // A match means we're done; a fail means we have to keep checking |
2844 | + if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
2845 | + return true; |
2846 | + } |
2847 | + } |
2848 | + } |
2849 | + } |
2850 | + } |
2851 | + }; |
2852 | +} |
2853 | + |
2854 | +function elementMatcher( matchers ) { |
2855 | + return matchers.length > 1 ? |
2856 | + function( elem, context, xml ) { |
2857 | + var i = matchers.length; |
2858 | + while ( i-- ) { |
2859 | + if ( !matchers[i]( elem, context, xml ) ) { |
2860 | + return false; |
2861 | + } |
2862 | + } |
2863 | + return true; |
2864 | + } : |
2865 | + matchers[0]; |
2866 | +} |
2867 | + |
2868 | +function multipleContexts( selector, contexts, results ) { |
2869 | + var i = 0, |
2870 | + len = contexts.length; |
2871 | + for ( ; i < len; i++ ) { |
2872 | + Sizzle( selector, contexts[i], results ); |
2873 | + } |
2874 | + return results; |
2875 | +} |
2876 | + |
2877 | +function condense( unmatched, map, filter, context, xml ) { |
2878 | + var elem, |
2879 | + newUnmatched = [], |
2880 | + i = 0, |
2881 | + len = unmatched.length, |
2882 | + mapped = map != null; |
2883 | + |
2884 | + for ( ; i < len; i++ ) { |
2885 | + if ( (elem = unmatched[i]) ) { |
2886 | + if ( !filter || filter( elem, context, xml ) ) { |
2887 | + newUnmatched.push( elem ); |
2888 | + if ( mapped ) { |
2889 | + map.push( i ); |
2890 | + } |
2891 | + } |
2892 | + } |
2893 | + } |
2894 | + |
2895 | + return newUnmatched; |
2896 | +} |
2897 | + |
2898 | +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
2899 | + if ( postFilter && !postFilter[ expando ] ) { |
2900 | + postFilter = setMatcher( postFilter ); |
2901 | + } |
2902 | + if ( postFinder && !postFinder[ expando ] ) { |
2903 | + postFinder = setMatcher( postFinder, postSelector ); |
2904 | + } |
2905 | + return markFunction(function( seed, results, context, xml ) { |
2906 | + var temp, i, elem, |
2907 | + preMap = [], |
2908 | + postMap = [], |
2909 | + preexisting = results.length, |
2910 | + |
2911 | + // Get initial elements from seed or context |
2912 | + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
2913 | + |
2914 | + // Prefilter to get matcher input, preserving a map for seed-results synchronization |
2915 | + matcherIn = preFilter && ( seed || !selector ) ? |
2916 | + condense( elems, preMap, preFilter, context, xml ) : |
2917 | + elems, |
2918 | + |
2919 | + matcherOut = matcher ? |
2920 | + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
2921 | + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
2922 | + |
2923 | + // ...intermediate processing is necessary |
2924 | + [] : |
2925 | + |
2926 | + // ...otherwise use results directly |
2927 | + results : |
2928 | + matcherIn; |
2929 | + |
2930 | + // Find primary matches |
2931 | + if ( matcher ) { |
2932 | + matcher( matcherIn, matcherOut, context, xml ); |
2933 | + } |
2934 | + |
2935 | + // Apply postFilter |
2936 | + if ( postFilter ) { |
2937 | + temp = condense( matcherOut, postMap ); |
2938 | + postFilter( temp, [], context, xml ); |
2939 | + |
2940 | + // Un-match failing elements by moving them back to matcherIn |
2941 | + i = temp.length; |
2942 | + while ( i-- ) { |
2943 | + if ( (elem = temp[i]) ) { |
2944 | + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
2945 | + } |
2946 | + } |
2947 | + } |
2948 | + |
2949 | + if ( seed ) { |
2950 | + if ( postFinder || preFilter ) { |
2951 | + if ( postFinder ) { |
2952 | + // Get the final matcherOut by condensing this intermediate into postFinder contexts |
2953 | + temp = []; |
2954 | + i = matcherOut.length; |
2955 | + while ( i-- ) { |
2956 | + if ( (elem = matcherOut[i]) ) { |
2957 | + // Restore matcherIn since elem is not yet a final match |
2958 | + temp.push( (matcherIn[i] = elem) ); |
2959 | + } |
2960 | + } |
2961 | + postFinder( null, (matcherOut = []), temp, xml ); |
2962 | + } |
2963 | + |
2964 | + // Move matched elements from seed to results to keep them synchronized |
2965 | + i = matcherOut.length; |
2966 | + while ( i-- ) { |
2967 | + if ( (elem = matcherOut[i]) && |
2968 | + (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { |
2969 | + |
2970 | + seed[temp] = !(results[temp] = elem); |
2971 | + } |
2972 | + } |
2973 | + } |
2974 | + |
2975 | + // Add elements to results, through postFinder if defined |
2976 | + } else { |
2977 | + matcherOut = condense( |
2978 | + matcherOut === results ? |
2979 | + matcherOut.splice( preexisting, matcherOut.length ) : |
2980 | + matcherOut |
2981 | + ); |
2982 | + if ( postFinder ) { |
2983 | + postFinder( null, results, matcherOut, xml ); |
2984 | + } else { |
2985 | + push.apply( results, matcherOut ); |
2986 | + } |
2987 | + } |
2988 | + }); |
2989 | +} |
2990 | + |
2991 | +function matcherFromTokens( tokens ) { |
2992 | + var checkContext, matcher, j, |
2993 | + len = tokens.length, |
2994 | + leadingRelative = Expr.relative[ tokens[0].type ], |
2995 | + implicitRelative = leadingRelative || Expr.relative[" "], |
2996 | + i = leadingRelative ? 1 : 0, |
2997 | + |
2998 | + // The foundational matcher ensures that elements are reachable from top-level context(s) |
2999 | + matchContext = addCombinator( function( elem ) { |
3000 | + return elem === checkContext; |
3001 | + }, implicitRelative, true ), |
3002 | + matchAnyContext = addCombinator( function( elem ) { |
3003 | + return indexOf( checkContext, elem ) > -1; |
3004 | + }, implicitRelative, true ), |
3005 | + matchers = [ function( elem, context, xml ) { |
3006 | + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
3007 | + (checkContext = context).nodeType ? |
3008 | + matchContext( elem, context, xml ) : |
3009 | + matchAnyContext( elem, context, xml ) ); |
3010 | + // Avoid hanging onto element (issue #299) |
3011 | + checkContext = null; |
3012 | + return ret; |
3013 | + } ]; |
3014 | + |
3015 | + for ( ; i < len; i++ ) { |
3016 | + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
3017 | + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
3018 | + } else { |
3019 | + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
3020 | + |
3021 | + // Return special upon seeing a positional matcher |
3022 | + if ( matcher[ expando ] ) { |
3023 | + // Find the next relative operator (if any) for proper handling |
3024 | + j = ++i; |
3025 | + for ( ; j < len; j++ ) { |
3026 | + if ( Expr.relative[ tokens[j].type ] ) { |
3027 | + break; |
3028 | + } |
3029 | + } |
3030 | + return setMatcher( |
3031 | + i > 1 && elementMatcher( matchers ), |
3032 | + i > 1 && toSelector( |
3033 | + // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
3034 | + tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) |
3035 | + ).replace( rtrim, "$1" ), |
3036 | + matcher, |
3037 | + i < j && matcherFromTokens( tokens.slice( i, j ) ), |
3038 | + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
3039 | + j < len && toSelector( tokens ) |
3040 | + ); |
3041 | + } |
3042 | + matchers.push( matcher ); |
3043 | + } |
3044 | + } |
3045 | + |
3046 | + return elementMatcher( matchers ); |
3047 | +} |
3048 | + |
3049 | +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
3050 | + var bySet = setMatchers.length > 0, |
3051 | + byElement = elementMatchers.length > 0, |
3052 | + superMatcher = function( seed, context, xml, results, outermost ) { |
3053 | + var elem, j, matcher, |
3054 | + matchedCount = 0, |
3055 | + i = "0", |
3056 | + unmatched = seed && [], |
3057 | + setMatched = [], |
3058 | + contextBackup = outermostContext, |
3059 | + // We must always have either seed elements or outermost context |
3060 | + elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
3061 | + // Use integer dirruns iff this is the outermost matcher |
3062 | + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
3063 | + len = elems.length; |
3064 | + |
3065 | + if ( outermost ) { |
3066 | + outermostContext = context === document || context || outermost; |
3067 | + } |
3068 | + |
3069 | + // Add elements passing elementMatchers directly to results |
3070 | + // Support: IE<9, Safari |
3071 | + // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
3072 | + for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
3073 | + if ( byElement && elem ) { |
3074 | + j = 0; |
3075 | + if ( !context && elem.ownerDocument !== document ) { |
3076 | + setDocument( elem ); |
3077 | + xml = !documentIsHTML; |
3078 | + } |
3079 | + while ( (matcher = elementMatchers[j++]) ) { |
3080 | + if ( matcher( elem, context || document, xml) ) { |
3081 | + results.push( elem ); |
3082 | + break; |
3083 | + } |
3084 | + } |
3085 | + if ( outermost ) { |
3086 | + dirruns = dirrunsUnique; |
3087 | + } |
3088 | + } |
3089 | + |
3090 | + // Track unmatched elements for set filters |
3091 | + if ( bySet ) { |
3092 | + // They will have gone through all possible matchers |
3093 | + if ( (elem = !matcher && elem) ) { |
3094 | + matchedCount--; |
3095 | + } |
3096 | + |
3097 | + // Lengthen the array for every element, matched or not |
3098 | + if ( seed ) { |
3099 | + unmatched.push( elem ); |
3100 | + } |
3101 | + } |
3102 | + } |
3103 | + |
3104 | + // `i` is now the count of elements visited above, and adding it to `matchedCount` |
3105 | + // makes the latter nonnegative. |
3106 | + matchedCount += i; |
3107 | + |
3108 | + // Apply set filters to unmatched elements |
3109 | + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
3110 | + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
3111 | + // no element matchers and no seed. |
3112 | + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
3113 | + // case, which will result in a "00" `matchedCount` that differs from `i` but is also |
3114 | + // numerically zero. |
3115 | + if ( bySet && i !== matchedCount ) { |
3116 | + j = 0; |
3117 | + while ( (matcher = setMatchers[j++]) ) { |
3118 | + matcher( unmatched, setMatched, context, xml ); |
3119 | + } |
3120 | + |
3121 | + if ( seed ) { |
3122 | + // Reintegrate element matches to eliminate the need for sorting |
3123 | + if ( matchedCount > 0 ) { |
3124 | + while ( i-- ) { |
3125 | + if ( !(unmatched[i] || setMatched[i]) ) { |
3126 | + setMatched[i] = pop.call( results ); |
3127 | + } |
3128 | + } |
3129 | + } |
3130 | + |
3131 | + // Discard index placeholder values to get only actual matches |
3132 | + setMatched = condense( setMatched ); |
3133 | + } |
3134 | + |
3135 | + // Add matches to results |
3136 | + push.apply( results, setMatched ); |
3137 | + |
3138 | + // Seedless set matches succeeding multiple successful matchers stipulate sorting |
3139 | + if ( outermost && !seed && setMatched.length > 0 && |
3140 | + ( matchedCount + setMatchers.length ) > 1 ) { |
3141 | + |
3142 | + Sizzle.uniqueSort( results ); |
3143 | + } |
3144 | + } |
3145 | + |
3146 | + // Override manipulation of globals by nested matchers |
3147 | + if ( outermost ) { |
3148 | + dirruns = dirrunsUnique; |
3149 | + outermostContext = contextBackup; |
3150 | + } |
3151 | + |
3152 | + return unmatched; |
3153 | + }; |
3154 | + |
3155 | + return bySet ? |
3156 | + markFunction( superMatcher ) : |
3157 | + superMatcher; |
3158 | +} |
3159 | + |
3160 | +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
3161 | + var i, |
3162 | + setMatchers = [], |
3163 | + elementMatchers = [], |
3164 | + cached = compilerCache[ selector + " " ]; |
3165 | + |
3166 | + if ( !cached ) { |
3167 | + // Generate a function of recursive functions that can be used to check each element |
3168 | + if ( !match ) { |
3169 | + match = tokenize( selector ); |
3170 | + } |
3171 | + i = match.length; |
3172 | + while ( i-- ) { |
3173 | + cached = matcherFromTokens( match[i] ); |
3174 | + if ( cached[ expando ] ) { |
3175 | + setMatchers.push( cached ); |
3176 | + } else { |
3177 | + elementMatchers.push( cached ); |
3178 | + } |
3179 | + } |
3180 | + |
3181 | + // Cache the compiled function |
3182 | + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
3183 | + |
3184 | + // Save selector and tokenization |
3185 | + cached.selector = selector; |
3186 | + } |
3187 | + return cached; |
3188 | +}; |
3189 | + |
3190 | +/** |
3191 | + * A low-level selection function that works with Sizzle's compiled |
3192 | + * selector functions |
3193 | + * @param {String|Function} selector A selector or a pre-compiled |
3194 | + * selector function built with Sizzle.compile |
3195 | + * @param {Element} context |
3196 | + * @param {Array} [results] |
3197 | + * @param {Array} [seed] A set of elements to match against |
3198 | + */ |
3199 | +select = Sizzle.select = function( selector, context, results, seed ) { |
3200 | + var i, tokens, token, type, find, |
3201 | + compiled = typeof selector === "function" && selector, |
3202 | + match = !seed && tokenize( (selector = compiled.selector || selector) ); |
3203 | + |
3204 | + results = results || []; |
3205 | + |
3206 | + // Try to minimize operations if there is only one selector in the list and no seed |
3207 | + // (the latter of which guarantees us context) |
3208 | + if ( match.length === 1 ) { |
3209 | + |
3210 | + // Reduce context if the leading compound selector is an ID |
3211 | + tokens = match[0] = match[0].slice( 0 ); |
3212 | + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
3213 | + support.getById && context.nodeType === 9 && documentIsHTML && |
3214 | + Expr.relative[ tokens[1].type ] ) { |
3215 | + |
3216 | + context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; |
3217 | + if ( !context ) { |
3218 | + return results; |
3219 | + |
3220 | + // Precompiled matchers will still verify ancestry, so step up a level |
3221 | + } else if ( compiled ) { |
3222 | + context = context.parentNode; |
3223 | + } |
3224 | + |
3225 | + selector = selector.slice( tokens.shift().value.length ); |
3226 | + } |
3227 | + |
3228 | + // Fetch a seed set for right-to-left matching |
3229 | + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; |
3230 | + while ( i-- ) { |
3231 | + token = tokens[i]; |
3232 | + |
3233 | + // Abort if we hit a combinator |
3234 | + if ( Expr.relative[ (type = token.type) ] ) { |
3235 | + break; |
3236 | + } |
3237 | + if ( (find = Expr.find[ type ]) ) { |
3238 | + // Search, expanding context for leading sibling combinators |
3239 | + if ( (seed = find( |
3240 | + token.matches[0].replace( runescape, funescape ), |
3241 | + rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context |
3242 | + )) ) { |
3243 | + |
3244 | + // If seed is empty or no tokens remain, we can return early |
3245 | + tokens.splice( i, 1 ); |
3246 | + selector = seed.length && toSelector( tokens ); |
3247 | + if ( !selector ) { |
3248 | + push.apply( results, seed ); |
3249 | + return results; |
3250 | + } |
3251 | + |
3252 | + break; |
3253 | + } |
3254 | + } |
3255 | + } |
3256 | + } |
3257 | + |
3258 | + // Compile and execute a filtering function if one is not provided |
3259 | + // Provide `match` to avoid retokenization if we modified the selector above |
3260 | + ( compiled || compile( selector, match ) )( |
3261 | + seed, |
3262 | + context, |
3263 | + !documentIsHTML, |
3264 | + results, |
3265 | + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
3266 | + ); |
3267 | + return results; |
3268 | +}; |
3269 | + |
3270 | +// One-time assignments |
3271 | + |
3272 | +// Sort stability |
3273 | +support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; |
3274 | + |
3275 | +// Support: Chrome 14-35+ |
3276 | +// Always assume duplicates if they aren't passed to the comparison function |
3277 | +support.detectDuplicates = !!hasDuplicate; |
3278 | + |
3279 | +// Initialize against the default document |
3280 | +setDocument(); |
3281 | + |
3282 | +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
3283 | +// Detached nodes confoundingly follow *each other* |
3284 | +support.sortDetached = assert(function( div1 ) { |
3285 | + // Should return 1, but returns 4 (following) |
3286 | + return div1.compareDocumentPosition( document.createElement("div") ) & 1; |
3287 | }); |
3288 | |
3289 | -browserMatch = jQuery.uaMatch( userAgent ); |
3290 | -if ( browserMatch.browser ) { |
3291 | - jQuery.browser[ browserMatch.browser ] = true; |
3292 | - jQuery.browser.version = browserMatch.version; |
3293 | -} |
3294 | - |
3295 | -// Deprecated, use jQuery.browser.webkit instead |
3296 | -if ( jQuery.browser.webkit ) { |
3297 | - jQuery.browser.safari = true; |
3298 | -} |
3299 | - |
3300 | -// IE doesn't match non-breaking spaces with \s |
3301 | -if ( rnotwhite.test( "\xA0" ) ) { |
3302 | - trimLeft = /^[\s\xA0]+/; |
3303 | - trimRight = /[\s\xA0]+$/; |
3304 | -} |
3305 | - |
3306 | -// All jQuery objects should point back to these |
3307 | -rootjQuery = jQuery(document); |
3308 | - |
3309 | -// Cleanup functions for the document ready method |
3310 | -if ( document.addEventListener ) { |
3311 | - DOMContentLoaded = function() { |
3312 | - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
3313 | - jQuery.ready(); |
3314 | - }; |
3315 | - |
3316 | -} else if ( document.attachEvent ) { |
3317 | - DOMContentLoaded = function() { |
3318 | - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
3319 | - if ( document.readyState === "complete" ) { |
3320 | - document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
3321 | - jQuery.ready(); |
3322 | - } |
3323 | - }; |
3324 | -} |
3325 | - |
3326 | -// The DOM ready check for Internet Explorer |
3327 | -function doScrollCheck() { |
3328 | - if ( jQuery.isReady ) { |
3329 | - return; |
3330 | - } |
3331 | - |
3332 | - try { |
3333 | - // If IE is used, use the trick by Diego Perini |
3334 | - // http://javascript.nwbox.com/IEContentLoaded/ |
3335 | - document.documentElement.doScroll("left"); |
3336 | - } catch(e) { |
3337 | - setTimeout( doScrollCheck, 1 ); |
3338 | - return; |
3339 | - } |
3340 | - |
3341 | - // and execute any waiting functions |
3342 | - jQuery.ready(); |
3343 | -} |
3344 | - |
3345 | -return jQuery; |
3346 | - |
3347 | -})(); |
3348 | - |
3349 | - |
3350 | -// String to Object flags format cache |
3351 | -var flagsCache = {}; |
3352 | - |
3353 | -// Convert String-formatted flags into Object-formatted ones and store in cache |
3354 | -function createFlags( flags ) { |
3355 | - var object = flagsCache[ flags ] = {}, |
3356 | - i, length; |
3357 | - flags = flags.split( /\s+/ ); |
3358 | - for ( i = 0, length = flags.length; i < length; i++ ) { |
3359 | - object[ flags[i] ] = true; |
3360 | - } |
3361 | +// Support: IE<8 |
3362 | +// Prevent attribute/property "interpolation" |
3363 | +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
3364 | +if ( !assert(function( div ) { |
3365 | + div.innerHTML = "<a href='#'></a>"; |
3366 | + return div.firstChild.getAttribute("href") === "#" ; |
3367 | +}) ) { |
3368 | + addHandle( "type|href|height|width", function( elem, name, isXML ) { |
3369 | + if ( !isXML ) { |
3370 | + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
3371 | + } |
3372 | + }); |
3373 | +} |
3374 | + |
3375 | +// Support: IE<9 |
3376 | +// Use defaultValue in place of getAttribute("value") |
3377 | +if ( !support.attributes || !assert(function( div ) { |
3378 | + div.innerHTML = "<input/>"; |
3379 | + div.firstChild.setAttribute( "value", "" ); |
3380 | + return div.firstChild.getAttribute( "value" ) === ""; |
3381 | +}) ) { |
3382 | + addHandle( "value", function( elem, name, isXML ) { |
3383 | + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
3384 | + return elem.defaultValue; |
3385 | + } |
3386 | + }); |
3387 | +} |
3388 | + |
3389 | +// Support: IE<9 |
3390 | +// Use getAttributeNode to fetch booleans when getAttribute lies |
3391 | +if ( !assert(function( div ) { |
3392 | + return div.getAttribute("disabled") == null; |
3393 | +}) ) { |
3394 | + addHandle( booleans, function( elem, name, isXML ) { |
3395 | + var val; |
3396 | + if ( !isXML ) { |
3397 | + return elem[ name ] === true ? name.toLowerCase() : |
3398 | + (val = elem.getAttributeNode( name )) && val.specified ? |
3399 | + val.value : |
3400 | + null; |
3401 | + } |
3402 | + }); |
3403 | +} |
3404 | + |
3405 | +return Sizzle; |
3406 | + |
3407 | +})( window ); |
3408 | + |
3409 | + |
3410 | + |
3411 | +jQuery.find = Sizzle; |
3412 | +jQuery.expr = Sizzle.selectors; |
3413 | +jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
3414 | +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
3415 | +jQuery.text = Sizzle.getText; |
3416 | +jQuery.isXMLDoc = Sizzle.isXML; |
3417 | +jQuery.contains = Sizzle.contains; |
3418 | + |
3419 | + |
3420 | + |
3421 | +var dir = function( elem, dir, until ) { |
3422 | + var matched = [], |
3423 | + truncate = until !== undefined; |
3424 | + |
3425 | + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
3426 | + if ( elem.nodeType === 1 ) { |
3427 | + if ( truncate && jQuery( elem ).is( until ) ) { |
3428 | + break; |
3429 | + } |
3430 | + matched.push( elem ); |
3431 | + } |
3432 | + } |
3433 | + return matched; |
3434 | +}; |
3435 | + |
3436 | + |
3437 | +var siblings = function( n, elem ) { |
3438 | + var matched = []; |
3439 | + |
3440 | + for ( ; n; n = n.nextSibling ) { |
3441 | + if ( n.nodeType === 1 && n !== elem ) { |
3442 | + matched.push( n ); |
3443 | + } |
3444 | + } |
3445 | + |
3446 | + return matched; |
3447 | +}; |
3448 | + |
3449 | + |
3450 | +var rneedsContext = jQuery.expr.match.needsContext; |
3451 | + |
3452 | +var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); |
3453 | + |
3454 | + |
3455 | + |
3456 | +var risSimple = /^.[^:#\[\.,]*$/; |
3457 | + |
3458 | +// Implement the identical functionality for filter and not |
3459 | +function winnow( elements, qualifier, not ) { |
3460 | + if ( jQuery.isFunction( qualifier ) ) { |
3461 | + return jQuery.grep( elements, function( elem, i ) { |
3462 | + /* jshint -W018 */ |
3463 | + return !!qualifier.call( elem, i, elem ) !== not; |
3464 | + } ); |
3465 | + |
3466 | + } |
3467 | + |
3468 | + if ( qualifier.nodeType ) { |
3469 | + return jQuery.grep( elements, function( elem ) { |
3470 | + return ( elem === qualifier ) !== not; |
3471 | + } ); |
3472 | + |
3473 | + } |
3474 | + |
3475 | + if ( typeof qualifier === "string" ) { |
3476 | + if ( risSimple.test( qualifier ) ) { |
3477 | + return jQuery.filter( qualifier, elements, not ); |
3478 | + } |
3479 | + |
3480 | + qualifier = jQuery.filter( qualifier, elements ); |
3481 | + } |
3482 | + |
3483 | + return jQuery.grep( elements, function( elem ) { |
3484 | + return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not; |
3485 | + } ); |
3486 | +} |
3487 | + |
3488 | +jQuery.filter = function( expr, elems, not ) { |
3489 | + var elem = elems[ 0 ]; |
3490 | + |
3491 | + if ( not ) { |
3492 | + expr = ":not(" + expr + ")"; |
3493 | + } |
3494 | + |
3495 | + return elems.length === 1 && elem.nodeType === 1 ? |
3496 | + jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : |
3497 | + jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
3498 | + return elem.nodeType === 1; |
3499 | + } ) ); |
3500 | +}; |
3501 | + |
3502 | +jQuery.fn.extend( { |
3503 | + find: function( selector ) { |
3504 | + var i, |
3505 | + ret = [], |
3506 | + self = this, |
3507 | + len = self.length; |
3508 | + |
3509 | + if ( typeof selector !== "string" ) { |
3510 | + return this.pushStack( jQuery( selector ).filter( function() { |
3511 | + for ( i = 0; i < len; i++ ) { |
3512 | + if ( jQuery.contains( self[ i ], this ) ) { |
3513 | + return true; |
3514 | + } |
3515 | + } |
3516 | + } ) ); |
3517 | + } |
3518 | + |
3519 | + for ( i = 0; i < len; i++ ) { |
3520 | + jQuery.find( selector, self[ i ], ret ); |
3521 | + } |
3522 | + |
3523 | + // Needed because $( selector, context ) becomes $( context ).find( selector ) |
3524 | + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); |
3525 | + ret.selector = this.selector ? this.selector + " " + selector : selector; |
3526 | + return ret; |
3527 | + }, |
3528 | + filter: function( selector ) { |
3529 | + return this.pushStack( winnow( this, selector || [], false ) ); |
3530 | + }, |
3531 | + not: function( selector ) { |
3532 | + return this.pushStack( winnow( this, selector || [], true ) ); |
3533 | + }, |
3534 | + is: function( selector ) { |
3535 | + return !!winnow( |
3536 | + this, |
3537 | + |
3538 | + // If this is a positional/relative selector, check membership in the returned set |
3539 | + // so $("p:first").is("p:last") won't return true for a doc with two "p". |
3540 | + typeof selector === "string" && rneedsContext.test( selector ) ? |
3541 | + jQuery( selector ) : |
3542 | + selector || [], |
3543 | + false |
3544 | + ).length; |
3545 | + } |
3546 | +} ); |
3547 | + |
3548 | + |
3549 | +// Initialize a jQuery object |
3550 | + |
3551 | + |
3552 | +// A central reference to the root jQuery(document) |
3553 | +var rootjQuery, |
3554 | + |
3555 | + // A simple way to check for HTML strings |
3556 | + // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
3557 | + // Strict HTML recognition (#11290: must start with <) |
3558 | + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, |
3559 | + |
3560 | + init = jQuery.fn.init = function( selector, context, root ) { |
3561 | + var match, elem; |
3562 | + |
3563 | + // HANDLE: $(""), $(null), $(undefined), $(false) |
3564 | + if ( !selector ) { |
3565 | + return this; |
3566 | + } |
3567 | + |
3568 | + // init accepts an alternate rootjQuery |
3569 | + // so migrate can support jQuery.sub (gh-2101) |
3570 | + root = root || rootjQuery; |
3571 | + |
3572 | + // Handle HTML strings |
3573 | + if ( typeof selector === "string" ) { |
3574 | + if ( selector.charAt( 0 ) === "<" && |
3575 | + selector.charAt( selector.length - 1 ) === ">" && |
3576 | + selector.length >= 3 ) { |
3577 | + |
3578 | + // Assume that strings that start and end with <> are HTML and skip the regex check |
3579 | + match = [ null, selector, null ]; |
3580 | + |
3581 | + } else { |
3582 | + match = rquickExpr.exec( selector ); |
3583 | + } |
3584 | + |
3585 | + // Match html or make sure no context is specified for #id |
3586 | + if ( match && ( match[ 1 ] || !context ) ) { |
3587 | + |
3588 | + // HANDLE: $(html) -> $(array) |
3589 | + if ( match[ 1 ] ) { |
3590 | + context = context instanceof jQuery ? context[ 0 ] : context; |
3591 | + |
3592 | + // scripts is true for back-compat |
3593 | + // Intentionally let the error be thrown if parseHTML is not present |
3594 | + jQuery.merge( this, jQuery.parseHTML( |
3595 | + match[ 1 ], |
3596 | + context && context.nodeType ? context.ownerDocument || context : document, |
3597 | + true |
3598 | + ) ); |
3599 | + |
3600 | + // HANDLE: $(html, props) |
3601 | + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
3602 | + for ( match in context ) { |
3603 | + |
3604 | + // Properties of context are called as methods if possible |
3605 | + if ( jQuery.isFunction( this[ match ] ) ) { |
3606 | + this[ match ]( context[ match ] ); |
3607 | + |
3608 | + // ...and otherwise set as attributes |
3609 | + } else { |
3610 | + this.attr( match, context[ match ] ); |
3611 | + } |
3612 | + } |
3613 | + } |
3614 | + |
3615 | + return this; |
3616 | + |
3617 | + // HANDLE: $(#id) |
3618 | + } else { |
3619 | + elem = document.getElementById( match[ 2 ] ); |
3620 | + |
3621 | + // Check parentNode to catch when Blackberry 4.6 returns |
3622 | + // nodes that are no longer in the document #6963 |
3623 | + if ( elem && elem.parentNode ) { |
3624 | + |
3625 | + // Handle the case where IE and Opera return items |
3626 | + // by name instead of ID |
3627 | + if ( elem.id !== match[ 2 ] ) { |
3628 | + return rootjQuery.find( selector ); |
3629 | + } |
3630 | + |
3631 | + // Otherwise, we inject the element directly into the jQuery object |
3632 | + this.length = 1; |
3633 | + this[ 0 ] = elem; |
3634 | + } |
3635 | + |
3636 | + this.context = document; |
3637 | + this.selector = selector; |
3638 | + return this; |
3639 | + } |
3640 | + |
3641 | + // HANDLE: $(expr, $(...)) |
3642 | + } else if ( !context || context.jquery ) { |
3643 | + return ( context || root ).find( selector ); |
3644 | + |
3645 | + // HANDLE: $(expr, context) |
3646 | + // (which is just equivalent to: $(context).find(expr) |
3647 | + } else { |
3648 | + return this.constructor( context ).find( selector ); |
3649 | + } |
3650 | + |
3651 | + // HANDLE: $(DOMElement) |
3652 | + } else if ( selector.nodeType ) { |
3653 | + this.context = this[ 0 ] = selector; |
3654 | + this.length = 1; |
3655 | + return this; |
3656 | + |
3657 | + // HANDLE: $(function) |
3658 | + // Shortcut for document ready |
3659 | + } else if ( jQuery.isFunction( selector ) ) { |
3660 | + return typeof root.ready !== "undefined" ? |
3661 | + root.ready( selector ) : |
3662 | + |
3663 | + // Execute immediately if ready is not present |
3664 | + selector( jQuery ); |
3665 | + } |
3666 | + |
3667 | + if ( selector.selector !== undefined ) { |
3668 | + this.selector = selector.selector; |
3669 | + this.context = selector.context; |
3670 | + } |
3671 | + |
3672 | + return jQuery.makeArray( selector, this ); |
3673 | + }; |
3674 | + |
3675 | +// Give the init function the jQuery prototype for later instantiation |
3676 | +init.prototype = jQuery.fn; |
3677 | + |
3678 | +// Initialize central reference |
3679 | +rootjQuery = jQuery( document ); |
3680 | + |
3681 | + |
3682 | +var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
3683 | + |
3684 | + // methods guaranteed to produce a unique set when starting from a unique set |
3685 | + guaranteedUnique = { |
3686 | + children: true, |
3687 | + contents: true, |
3688 | + next: true, |
3689 | + prev: true |
3690 | + }; |
3691 | + |
3692 | +jQuery.fn.extend( { |
3693 | + has: function( target ) { |
3694 | + var i, |
3695 | + targets = jQuery( target, this ), |
3696 | + len = targets.length; |
3697 | + |
3698 | + return this.filter( function() { |
3699 | + for ( i = 0; i < len; i++ ) { |
3700 | + if ( jQuery.contains( this, targets[ i ] ) ) { |
3701 | + return true; |
3702 | + } |
3703 | + } |
3704 | + } ); |
3705 | + }, |
3706 | + |
3707 | + closest: function( selectors, context ) { |
3708 | + var cur, |
3709 | + i = 0, |
3710 | + l = this.length, |
3711 | + matched = [], |
3712 | + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
3713 | + jQuery( selectors, context || this.context ) : |
3714 | + 0; |
3715 | + |
3716 | + for ( ; i < l; i++ ) { |
3717 | + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
3718 | + |
3719 | + // Always skip document fragments |
3720 | + if ( cur.nodeType < 11 && ( pos ? |
3721 | + pos.index( cur ) > -1 : |
3722 | + |
3723 | + // Don't pass non-elements to Sizzle |
3724 | + cur.nodeType === 1 && |
3725 | + jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3726 | + |
3727 | + matched.push( cur ); |
3728 | + break; |
3729 | + } |
3730 | + } |
3731 | + } |
3732 | + |
3733 | + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
3734 | + }, |
3735 | + |
3736 | + // Determine the position of an element within |
3737 | + // the matched set of elements |
3738 | + index: function( elem ) { |
3739 | + |
3740 | + // No argument, return index in parent |
3741 | + if ( !elem ) { |
3742 | + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
3743 | + } |
3744 | + |
3745 | + // index in selector |
3746 | + if ( typeof elem === "string" ) { |
3747 | + return jQuery.inArray( this[ 0 ], jQuery( elem ) ); |
3748 | + } |
3749 | + |
3750 | + // Locate the position of the desired element |
3751 | + return jQuery.inArray( |
3752 | + |
3753 | + // If it receives a jQuery object, the first element is used |
3754 | + elem.jquery ? elem[ 0 ] : elem, this ); |
3755 | + }, |
3756 | + |
3757 | + add: function( selector, context ) { |
3758 | + return this.pushStack( |
3759 | + jQuery.uniqueSort( |
3760 | + jQuery.merge( this.get(), jQuery( selector, context ) ) |
3761 | + ) |
3762 | + ); |
3763 | + }, |
3764 | + |
3765 | + addBack: function( selector ) { |
3766 | + return this.add( selector == null ? |
3767 | + this.prevObject : this.prevObject.filter( selector ) |
3768 | + ); |
3769 | + } |
3770 | +} ); |
3771 | + |
3772 | +function sibling( cur, dir ) { |
3773 | + do { |
3774 | + cur = cur[ dir ]; |
3775 | + } while ( cur && cur.nodeType !== 1 ); |
3776 | + |
3777 | + return cur; |
3778 | +} |
3779 | + |
3780 | +jQuery.each( { |
3781 | + parent: function( elem ) { |
3782 | + var parent = elem.parentNode; |
3783 | + return parent && parent.nodeType !== 11 ? parent : null; |
3784 | + }, |
3785 | + parents: function( elem ) { |
3786 | + return dir( elem, "parentNode" ); |
3787 | + }, |
3788 | + parentsUntil: function( elem, i, until ) { |
3789 | + return dir( elem, "parentNode", until ); |
3790 | + }, |
3791 | + next: function( elem ) { |
3792 | + return sibling( elem, "nextSibling" ); |
3793 | + }, |
3794 | + prev: function( elem ) { |
3795 | + return sibling( elem, "previousSibling" ); |
3796 | + }, |
3797 | + nextAll: function( elem ) { |
3798 | + return dir( elem, "nextSibling" ); |
3799 | + }, |
3800 | + prevAll: function( elem ) { |
3801 | + return dir( elem, "previousSibling" ); |
3802 | + }, |
3803 | + nextUntil: function( elem, i, until ) { |
3804 | + return dir( elem, "nextSibling", until ); |
3805 | + }, |
3806 | + prevUntil: function( elem, i, until ) { |
3807 | + return dir( elem, "previousSibling", until ); |
3808 | + }, |
3809 | + siblings: function( elem ) { |
3810 | + return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
3811 | + }, |
3812 | + children: function( elem ) { |
3813 | + return siblings( elem.firstChild ); |
3814 | + }, |
3815 | + contents: function( elem ) { |
3816 | + return jQuery.nodeName( elem, "iframe" ) ? |
3817 | + elem.contentDocument || elem.contentWindow.document : |
3818 | + jQuery.merge( [], elem.childNodes ); |
3819 | + } |
3820 | +}, function( name, fn ) { |
3821 | + jQuery.fn[ name ] = function( until, selector ) { |
3822 | + var ret = jQuery.map( this, fn, until ); |
3823 | + |
3824 | + if ( name.slice( -5 ) !== "Until" ) { |
3825 | + selector = until; |
3826 | + } |
3827 | + |
3828 | + if ( selector && typeof selector === "string" ) { |
3829 | + ret = jQuery.filter( selector, ret ); |
3830 | + } |
3831 | + |
3832 | + if ( this.length > 1 ) { |
3833 | + |
3834 | + // Remove duplicates |
3835 | + if ( !guaranteedUnique[ name ] ) { |
3836 | + ret = jQuery.uniqueSort( ret ); |
3837 | + } |
3838 | + |
3839 | + // Reverse order for parents* and prev-derivatives |
3840 | + if ( rparentsprev.test( name ) ) { |
3841 | + ret = ret.reverse(); |
3842 | + } |
3843 | + } |
3844 | + |
3845 | + return this.pushStack( ret ); |
3846 | + }; |
3847 | +} ); |
3848 | +var rnotwhite = ( /\S+/g ); |
3849 | + |
3850 | + |
3851 | + |
3852 | +// Convert String-formatted options into Object-formatted ones |
3853 | +function createOptions( options ) { |
3854 | + var object = {}; |
3855 | + jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { |
3856 | + object[ flag ] = true; |
3857 | + } ); |
3858 | return object; |
3859 | } |
3860 | |
3861 | /* |
3862 | * Create a callback list using the following parameters: |
3863 | * |
3864 | - * flags: an optional list of space-separated flags that will change how |
3865 | - * the callback list behaves |
3866 | + * options: an optional list of space-separated options that will change how |
3867 | + * the callback list behaves or a more traditional option object |
3868 | * |
3869 | * By default a callback list will act like an event callback list and can be |
3870 | * "fired" multiple times. |
3871 | * |
3872 | - * Possible flags: |
3873 | + * Possible options: |
3874 | * |
3875 | * once: will ensure the callback list can only be fired once (like a Deferred) |
3876 | * |
3877 | @@ -1019,187 +3186,191 @@ |
3878 | * stopOnFalse: interrupt callings when a callback returns false |
3879 | * |
3880 | */ |
3881 | -jQuery.Callbacks = function( flags ) { |
3882 | +jQuery.Callbacks = function( options ) { |
3883 | |
3884 | - // Convert flags from String-formatted to Object-formatted |
3885 | + // Convert options from String-formatted to Object-formatted if needed |
3886 | // (we check in cache first) |
3887 | - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; |
3888 | - |
3889 | - var // Actual callback list |
3890 | - list = [], |
3891 | - // Stack of fire calls for repeatable lists |
3892 | - stack = [], |
3893 | - // Last fire value (for non-forgettable lists) |
3894 | + options = typeof options === "string" ? |
3895 | + createOptions( options ) : |
3896 | + jQuery.extend( {}, options ); |
3897 | + |
3898 | + var // Flag to know if list is currently firing |
3899 | + firing, |
3900 | + |
3901 | + // Last fire value for non-forgettable lists |
3902 | memory, |
3903 | + |
3904 | // Flag to know if list was already fired |
3905 | fired, |
3906 | - // Flag to know if list is currently firing |
3907 | - firing, |
3908 | - // First callback to fire (used internally by add and fireWith) |
3909 | - firingStart, |
3910 | - // End of the loop when firing |
3911 | - firingLength, |
3912 | - // Index of currently firing callback (modified by remove if needed) |
3913 | - firingIndex, |
3914 | - // Add one or several callbacks to the list |
3915 | - add = function( args ) { |
3916 | - var i, |
3917 | - length, |
3918 | - elem, |
3919 | - type, |
3920 | - actual; |
3921 | - for ( i = 0, length = args.length; i < length; i++ ) { |
3922 | - elem = args[ i ]; |
3923 | - type = jQuery.type( elem ); |
3924 | - if ( type === "array" ) { |
3925 | - // Inspect recursively |
3926 | - add( elem ); |
3927 | - } else if ( type === "function" ) { |
3928 | - // Add if not in unique mode and callback is not in |
3929 | - if ( !flags.unique || !self.has( elem ) ) { |
3930 | - list.push( elem ); |
3931 | - } |
3932 | - } |
3933 | - } |
3934 | - }, |
3935 | + |
3936 | + // Flag to prevent firing |
3937 | + locked, |
3938 | + |
3939 | + // Actual callback list |
3940 | + list = [], |
3941 | + |
3942 | + // Queue of execution data for repeatable lists |
3943 | + queue = [], |
3944 | + |
3945 | + // Index of currently firing callback (modified by add/remove as needed) |
3946 | + firingIndex = -1, |
3947 | + |
3948 | // Fire callbacks |
3949 | - fire = function( context, args ) { |
3950 | - args = args || []; |
3951 | - memory = !flags.memory || [ context, args ]; |
3952 | - fired = true; |
3953 | - firing = true; |
3954 | - firingIndex = firingStart || 0; |
3955 | - firingStart = 0; |
3956 | - firingLength = list.length; |
3957 | - for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
3958 | - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { |
3959 | - memory = true; // Mark as halted |
3960 | - break; |
3961 | + fire = function() { |
3962 | + |
3963 | + // Enforce single-firing |
3964 | + locked = options.once; |
3965 | + |
3966 | + // Execute callbacks for all pending executions, |
3967 | + // respecting firingIndex overrides and runtime changes |
3968 | + fired = firing = true; |
3969 | + for ( ; queue.length; firingIndex = -1 ) { |
3970 | + memory = queue.shift(); |
3971 | + while ( ++firingIndex < list.length ) { |
3972 | + |
3973 | + // Run callback and check for early termination |
3974 | + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
3975 | + options.stopOnFalse ) { |
3976 | + |
3977 | + // Jump to end and forget the data so .add doesn't re-fire |
3978 | + firingIndex = list.length; |
3979 | + memory = false; |
3980 | + } |
3981 | } |
3982 | } |
3983 | + |
3984 | + // Forget the data if we're done with it |
3985 | + if ( !options.memory ) { |
3986 | + memory = false; |
3987 | + } |
3988 | + |
3989 | firing = false; |
3990 | - if ( list ) { |
3991 | - if ( !flags.once ) { |
3992 | - if ( stack && stack.length ) { |
3993 | - memory = stack.shift(); |
3994 | - self.fireWith( memory[ 0 ], memory[ 1 ] ); |
3995 | - } |
3996 | - } else if ( memory === true ) { |
3997 | - self.disable(); |
3998 | + |
3999 | + // Clean up if we're done firing for good |
4000 | + if ( locked ) { |
4001 | + |
4002 | + // Keep an empty list if we have data for future add calls |
4003 | + if ( memory ) { |
4004 | + list = []; |
4005 | + |
4006 | + // Otherwise, this object is spent |
4007 | } else { |
4008 | - list = []; |
4009 | + list = ""; |
4010 | } |
4011 | } |
4012 | }, |
4013 | + |
4014 | // Actual Callbacks object |
4015 | self = { |
4016 | + |
4017 | // Add a callback or a collection of callbacks to the list |
4018 | add: function() { |
4019 | if ( list ) { |
4020 | - var length = list.length; |
4021 | - add( arguments ); |
4022 | - // Do we need to add the callbacks to the |
4023 | - // current firing batch? |
4024 | - if ( firing ) { |
4025 | - firingLength = list.length; |
4026 | - // With memory, if we're not firing then |
4027 | - // we should call right away, unless previous |
4028 | - // firing was halted (stopOnFalse) |
4029 | - } else if ( memory && memory !== true ) { |
4030 | - firingStart = length; |
4031 | - fire( memory[ 0 ], memory[ 1 ] ); |
4032 | + |
4033 | + // If we have memory from a past run, we should fire after adding |
4034 | + if ( memory && !firing ) { |
4035 | + firingIndex = list.length - 1; |
4036 | + queue.push( memory ); |
4037 | + } |
4038 | + |
4039 | + ( function add( args ) { |
4040 | + jQuery.each( args, function( _, arg ) { |
4041 | + if ( jQuery.isFunction( arg ) ) { |
4042 | + if ( !options.unique || !self.has( arg ) ) { |
4043 | + list.push( arg ); |
4044 | + } |
4045 | + } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { |
4046 | + |
4047 | + // Inspect recursively |
4048 | + add( arg ); |
4049 | + } |
4050 | + } ); |
4051 | + } )( arguments ); |
4052 | + |
4053 | + if ( memory && !firing ) { |
4054 | + fire(); |
4055 | } |
4056 | } |
4057 | return this; |
4058 | }, |
4059 | + |
4060 | // Remove a callback from the list |
4061 | remove: function() { |
4062 | - if ( list ) { |
4063 | - var args = arguments, |
4064 | - argIndex = 0, |
4065 | - argLength = args.length; |
4066 | - for ( ; argIndex < argLength ; argIndex++ ) { |
4067 | - for ( var i = 0; i < list.length; i++ ) { |
4068 | - if ( args[ argIndex ] === list[ i ] ) { |
4069 | - // Handle firingIndex and firingLength |
4070 | - if ( firing ) { |
4071 | - if ( i <= firingLength ) { |
4072 | - firingLength--; |
4073 | - if ( i <= firingIndex ) { |
4074 | - firingIndex--; |
4075 | - } |
4076 | - } |
4077 | - } |
4078 | - // Remove the element |
4079 | - list.splice( i--, 1 ); |
4080 | - // If we have some unicity property then |
4081 | - // we only need to do this once |
4082 | - if ( flags.unique ) { |
4083 | - break; |
4084 | - } |
4085 | - } |
4086 | + jQuery.each( arguments, function( _, arg ) { |
4087 | + var index; |
4088 | + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
4089 | + list.splice( index, 1 ); |
4090 | + |
4091 | + // Handle firing indexes |
4092 | + if ( index <= firingIndex ) { |
4093 | + firingIndex--; |
4094 | } |
4095 | } |
4096 | - } |
4097 | + } ); |
4098 | return this; |
4099 | }, |
4100 | - // Control if a given callback is in the list |
4101 | + |
4102 | + // Check if a given callback is in the list. |
4103 | + // If no argument is given, return whether or not list has callbacks attached. |
4104 | has: function( fn ) { |
4105 | - if ( list ) { |
4106 | - var i = 0, |
4107 | - length = list.length; |
4108 | - for ( ; i < length; i++ ) { |
4109 | - if ( fn === list[ i ] ) { |
4110 | - return true; |
4111 | - } |
4112 | - } |
4113 | - } |
4114 | - return false; |
4115 | + return fn ? |
4116 | + jQuery.inArray( fn, list ) > -1 : |
4117 | + list.length > 0; |
4118 | }, |
4119 | + |
4120 | // Remove all callbacks from the list |
4121 | empty: function() { |
4122 | - list = []; |
4123 | + if ( list ) { |
4124 | + list = []; |
4125 | + } |
4126 | return this; |
4127 | }, |
4128 | - // Have the list do nothing anymore |
4129 | + |
4130 | + // Disable .fire and .add |
4131 | + // Abort any current/pending executions |
4132 | + // Clear all callbacks and values |
4133 | disable: function() { |
4134 | - list = stack = memory = undefined; |
4135 | + locked = queue = []; |
4136 | + list = memory = ""; |
4137 | return this; |
4138 | }, |
4139 | - // Is it disabled? |
4140 | disabled: function() { |
4141 | return !list; |
4142 | }, |
4143 | - // Lock the list in its current state |
4144 | + |
4145 | + // Disable .fire |
4146 | + // Also disable .add unless we have memory (since it would have no effect) |
4147 | + // Abort any pending executions |
4148 | lock: function() { |
4149 | - stack = undefined; |
4150 | - if ( !memory || memory === true ) { |
4151 | + locked = true; |
4152 | + if ( !memory ) { |
4153 | self.disable(); |
4154 | } |
4155 | return this; |
4156 | }, |
4157 | - // Is it locked? |
4158 | locked: function() { |
4159 | - return !stack; |
4160 | + return !!locked; |
4161 | }, |
4162 | + |
4163 | // Call all callbacks with the given context and arguments |
4164 | fireWith: function( context, args ) { |
4165 | - if ( stack ) { |
4166 | - if ( firing ) { |
4167 | - if ( !flags.once ) { |
4168 | - stack.push( [ context, args ] ); |
4169 | - } |
4170 | - } else if ( !( flags.once && memory ) ) { |
4171 | - fire( context, args ); |
4172 | + if ( !locked ) { |
4173 | + args = args || []; |
4174 | + args = [ context, args.slice ? args.slice() : args ]; |
4175 | + queue.push( args ); |
4176 | + if ( !firing ) { |
4177 | + fire(); |
4178 | } |
4179 | } |
4180 | return this; |
4181 | }, |
4182 | + |
4183 | // Call all the callbacks with the given arguments |
4184 | fire: function() { |
4185 | self.fireWith( this, arguments ); |
4186 | return this; |
4187 | }, |
4188 | + |
4189 | // To know if the callbacks have already been called at least once |
4190 | fired: function() { |
4191 | return !!fired; |
4192 | @@ -1210,96 +3381,91 @@ |
4193 | }; |
4194 | |
4195 | |
4196 | - |
4197 | - |
4198 | -var // Static reference to slice |
4199 | - sliceDeferred = [].slice; |
4200 | - |
4201 | -jQuery.extend({ |
4202 | +jQuery.extend( { |
4203 | |
4204 | Deferred: function( func ) { |
4205 | - var doneList = jQuery.Callbacks( "once memory" ), |
4206 | - failList = jQuery.Callbacks( "once memory" ), |
4207 | - progressList = jQuery.Callbacks( "memory" ), |
4208 | + var tuples = [ |
4209 | + |
4210 | + // action, add listener, listener list, final state |
4211 | + [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], |
4212 | + [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], |
4213 | + [ "notify", "progress", jQuery.Callbacks( "memory" ) ] |
4214 | + ], |
4215 | state = "pending", |
4216 | - lists = { |
4217 | - resolve: doneList, |
4218 | - reject: failList, |
4219 | - notify: progressList |
4220 | - }, |
4221 | promise = { |
4222 | - done: doneList.add, |
4223 | - fail: failList.add, |
4224 | - progress: progressList.add, |
4225 | - |
4226 | state: function() { |
4227 | return state; |
4228 | }, |
4229 | - |
4230 | - // Deprecated |
4231 | - isResolved: doneList.fired, |
4232 | - isRejected: failList.fired, |
4233 | - |
4234 | - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { |
4235 | - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); |
4236 | - return this; |
4237 | - }, |
4238 | always: function() { |
4239 | - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); |
4240 | + deferred.done( arguments ).fail( arguments ); |
4241 | return this; |
4242 | }, |
4243 | - pipe: function( fnDone, fnFail, fnProgress ) { |
4244 | - return jQuery.Deferred(function( newDefer ) { |
4245 | - jQuery.each( { |
4246 | - done: [ fnDone, "resolve" ], |
4247 | - fail: [ fnFail, "reject" ], |
4248 | - progress: [ fnProgress, "notify" ] |
4249 | - }, function( handler, data ) { |
4250 | - var fn = data[ 0 ], |
4251 | - action = data[ 1 ], |
4252 | - returned; |
4253 | - if ( jQuery.isFunction( fn ) ) { |
4254 | - deferred[ handler ](function() { |
4255 | - returned = fn.apply( this, arguments ); |
4256 | - if ( returned && jQuery.isFunction( returned.promise ) ) { |
4257 | - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); |
4258 | - } else { |
4259 | - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); |
4260 | - } |
4261 | - }); |
4262 | - } else { |
4263 | - deferred[ handler ]( newDefer[ action ] ); |
4264 | - } |
4265 | - }); |
4266 | - }).promise(); |
4267 | + then: function( /* fnDone, fnFail, fnProgress */ ) { |
4268 | + var fns = arguments; |
4269 | + return jQuery.Deferred( function( newDefer ) { |
4270 | + jQuery.each( tuples, function( i, tuple ) { |
4271 | + var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; |
4272 | + |
4273 | + // deferred[ done | fail | progress ] for forwarding actions to newDefer |
4274 | + deferred[ tuple[ 1 ] ]( function() { |
4275 | + var returned = fn && fn.apply( this, arguments ); |
4276 | + if ( returned && jQuery.isFunction( returned.promise ) ) { |
4277 | + returned.promise() |
4278 | + .progress( newDefer.notify ) |
4279 | + .done( newDefer.resolve ) |
4280 | + .fail( newDefer.reject ); |
4281 | + } else { |
4282 | + newDefer[ tuple[ 0 ] + "With" ]( |
4283 | + this === promise ? newDefer.promise() : this, |
4284 | + fn ? [ returned ] : arguments |
4285 | + ); |
4286 | + } |
4287 | + } ); |
4288 | + } ); |
4289 | + fns = null; |
4290 | + } ).promise(); |
4291 | }, |
4292 | + |
4293 | // Get a promise for this deferred |
4294 | // If obj is provided, the promise aspect is added to the object |
4295 | promise: function( obj ) { |
4296 | - if ( obj == null ) { |
4297 | - obj = promise; |
4298 | - } else { |
4299 | - for ( var key in promise ) { |
4300 | - obj[ key ] = promise[ key ]; |
4301 | - } |
4302 | - } |
4303 | - return obj; |
4304 | + return obj != null ? jQuery.extend( obj, promise ) : promise; |
4305 | } |
4306 | }, |
4307 | - deferred = promise.promise({}), |
4308 | - key; |
4309 | - |
4310 | - for ( key in lists ) { |
4311 | - deferred[ key ] = lists[ key ].fire; |
4312 | - deferred[ key + "With" ] = lists[ key ].fireWith; |
4313 | - } |
4314 | - |
4315 | - // Handle state |
4316 | - deferred.done( function() { |
4317 | - state = "resolved"; |
4318 | - }, failList.disable, progressList.lock ).fail( function() { |
4319 | - state = "rejected"; |
4320 | - }, doneList.disable, progressList.lock ); |
4321 | + deferred = {}; |
4322 | + |
4323 | + // Keep pipe for back-compat |
4324 | + promise.pipe = promise.then; |
4325 | + |
4326 | + // Add list-specific methods |
4327 | + jQuery.each( tuples, function( i, tuple ) { |
4328 | + var list = tuple[ 2 ], |
4329 | + stateString = tuple[ 3 ]; |
4330 | + |
4331 | + // promise[ done | fail | progress ] = list.add |
4332 | + promise[ tuple[ 1 ] ] = list.add; |
4333 | + |
4334 | + // Handle state |
4335 | + if ( stateString ) { |
4336 | + list.add( function() { |
4337 | + |
4338 | + // state = [ resolved | rejected ] |
4339 | + state = stateString; |
4340 | + |
4341 | + // [ reject_list | resolve_list ].disable; progress_list.lock |
4342 | + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); |
4343 | + } |
4344 | + |
4345 | + // deferred[ resolve | reject | notify ] |
4346 | + deferred[ tuple[ 0 ] ] = function() { |
4347 | + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); |
4348 | + return this; |
4349 | + }; |
4350 | + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
4351 | + } ); |
4352 | + |
4353 | + // Make the deferred a promise |
4354 | + promise.promise( deferred ); |
4355 | |
4356 | // Call given func if any |
4357 | if ( func ) { |
4358 | @@ -1311,608 +3477,582 @@ |
4359 | }, |
4360 | |
4361 | // Deferred helper |
4362 | - when: function( firstParam ) { |
4363 | - var args = sliceDeferred.call( arguments, 0 ), |
4364 | - i = 0, |
4365 | - length = args.length, |
4366 | - pValues = new Array( length ), |
4367 | - count = length, |
4368 | - pCount = length, |
4369 | - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? |
4370 | - firstParam : |
4371 | - jQuery.Deferred(), |
4372 | - promise = deferred.promise(); |
4373 | - function resolveFunc( i ) { |
4374 | - return function( value ) { |
4375 | - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; |
4376 | - if ( !( --count ) ) { |
4377 | - deferred.resolveWith( deferred, args ); |
4378 | - } |
4379 | - }; |
4380 | - } |
4381 | - function progressFunc( i ) { |
4382 | - return function( value ) { |
4383 | - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; |
4384 | - deferred.notifyWith( promise, pValues ); |
4385 | - }; |
4386 | - } |
4387 | + when: function( subordinate /* , ..., subordinateN */ ) { |
4388 | + var i = 0, |
4389 | + resolveValues = slice.call( arguments ), |
4390 | + length = resolveValues.length, |
4391 | + |
4392 | + // the count of uncompleted subordinates |
4393 | + remaining = length !== 1 || |
4394 | + ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, |
4395 | + |
4396 | + // the master Deferred. |
4397 | + // If resolveValues consist of only a single Deferred, just use that. |
4398 | + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), |
4399 | + |
4400 | + // Update function for both resolve and progress values |
4401 | + updateFunc = function( i, contexts, values ) { |
4402 | + return function( value ) { |
4403 | + contexts[ i ] = this; |
4404 | + values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
4405 | + if ( values === progressValues ) { |
4406 | + deferred.notifyWith( contexts, values ); |
4407 | + |
4408 | + } else if ( !( --remaining ) ) { |
4409 | + deferred.resolveWith( contexts, values ); |
4410 | + } |
4411 | + }; |
4412 | + }, |
4413 | + |
4414 | + progressValues, progressContexts, resolveContexts; |
4415 | + |
4416 | + // add listeners to Deferred subordinates; treat others as resolved |
4417 | if ( length > 1 ) { |
4418 | + progressValues = new Array( length ); |
4419 | + progressContexts = new Array( length ); |
4420 | + resolveContexts = new Array( length ); |
4421 | for ( ; i < length; i++ ) { |
4422 | - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { |
4423 | - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); |
4424 | + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { |
4425 | + resolveValues[ i ].promise() |
4426 | + .progress( updateFunc( i, progressContexts, progressValues ) ) |
4427 | + .done( updateFunc( i, resolveContexts, resolveValues ) ) |
4428 | + .fail( deferred.reject ); |
4429 | } else { |
4430 | - --count; |
4431 | + --remaining; |
4432 | } |
4433 | } |
4434 | - if ( !count ) { |
4435 | - deferred.resolveWith( deferred, args ); |
4436 | + } |
4437 | + |
4438 | + // if we're not waiting on anything, resolve the master |
4439 | + if ( !remaining ) { |
4440 | + deferred.resolveWith( resolveContexts, resolveValues ); |
4441 | + } |
4442 | + |
4443 | + return deferred.promise(); |
4444 | + } |
4445 | +} ); |
4446 | + |
4447 | + |
4448 | +// The deferred used on DOM ready |
4449 | +var readyList; |
4450 | + |
4451 | +jQuery.fn.ready = function( fn ) { |
4452 | + |
4453 | + // Add the callback |
4454 | + jQuery.ready.promise().done( fn ); |
4455 | + |
4456 | + return this; |
4457 | +}; |
4458 | + |
4459 | +jQuery.extend( { |
4460 | + |
4461 | + // Is the DOM ready to be used? Set to true once it occurs. |
4462 | + isReady: false, |
4463 | + |
4464 | + // A counter to track how many items to wait for before |
4465 | + // the ready event fires. See #6781 |
4466 | + readyWait: 1, |
4467 | + |
4468 | + // Hold (or release) the ready event |
4469 | + holdReady: function( hold ) { |
4470 | + if ( hold ) { |
4471 | + jQuery.readyWait++; |
4472 | + } else { |
4473 | + jQuery.ready( true ); |
4474 | + } |
4475 | + }, |
4476 | + |
4477 | + // Handle when the DOM is ready |
4478 | + ready: function( wait ) { |
4479 | + |
4480 | + // Abort if there are pending holds or we're already ready |
4481 | + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
4482 | + return; |
4483 | + } |
4484 | + |
4485 | + // Remember that the DOM is ready |
4486 | + jQuery.isReady = true; |
4487 | + |
4488 | + // If a normal DOM Ready event fired, decrement, and wait if need be |
4489 | + if ( wait !== true && --jQuery.readyWait > 0 ) { |
4490 | + return; |
4491 | + } |
4492 | + |
4493 | + // If there are functions bound, to execute |
4494 | + readyList.resolveWith( document, [ jQuery ] ); |
4495 | + |
4496 | + // Trigger any bound ready events |
4497 | + if ( jQuery.fn.triggerHandler ) { |
4498 | + jQuery( document ).triggerHandler( "ready" ); |
4499 | + jQuery( document ).off( "ready" ); |
4500 | + } |
4501 | + } |
4502 | +} ); |
4503 | + |
4504 | +/** |
4505 | + * Clean-up method for dom ready events |
4506 | + */ |
4507 | +function detach() { |
4508 | + if ( document.addEventListener ) { |
4509 | + document.removeEventListener( "DOMContentLoaded", completed ); |
4510 | + window.removeEventListener( "load", completed ); |
4511 | + |
4512 | + } else { |
4513 | + document.detachEvent( "onreadystatechange", completed ); |
4514 | + window.detachEvent( "onload", completed ); |
4515 | + } |
4516 | +} |
4517 | + |
4518 | +/** |
4519 | + * The ready event handler and self cleanup method |
4520 | + */ |
4521 | +function completed() { |
4522 | + |
4523 | + // readyState === "complete" is good enough for us to call the dom ready in oldIE |
4524 | + if ( document.addEventListener || |
4525 | + window.event.type === "load" || |
4526 | + document.readyState === "complete" ) { |
4527 | + |
4528 | + detach(); |
4529 | + jQuery.ready(); |
4530 | + } |
4531 | +} |
4532 | + |
4533 | +jQuery.ready.promise = function( obj ) { |
4534 | + if ( !readyList ) { |
4535 | + |
4536 | + readyList = jQuery.Deferred(); |
4537 | + |
4538 | + // Catch cases where $(document).ready() is called |
4539 | + // after the browser event has already occurred. |
4540 | + // Support: IE6-10 |
4541 | + // Older IE sometimes signals "interactive" too soon |
4542 | + if ( document.readyState === "complete" || |
4543 | + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
4544 | + |
4545 | + // Handle it asynchronously to allow scripts the opportunity to delay ready |
4546 | + window.setTimeout( jQuery.ready ); |
4547 | + |
4548 | + // Standards-based browsers support DOMContentLoaded |
4549 | + } else if ( document.addEventListener ) { |
4550 | + |
4551 | + // Use the handy event callback |
4552 | + document.addEventListener( "DOMContentLoaded", completed ); |
4553 | + |
4554 | + // A fallback to window.onload, that will always work |
4555 | + window.addEventListener( "load", completed ); |
4556 | + |
4557 | + // If IE event model is used |
4558 | + } else { |
4559 | + |
4560 | + // Ensure firing before onload, maybe late but safe also for iframes |
4561 | + document.attachEvent( "onreadystatechange", completed ); |
4562 | + |
4563 | + // A fallback to window.onload, that will always work |
4564 | + window.attachEvent( "onload", completed ); |
4565 | + |
4566 | + // If IE and not a frame |
4567 | + // continually check to see if the document is ready |
4568 | + var top = false; |
4569 | + |
4570 | + try { |
4571 | + top = window.frameElement == null && document.documentElement; |
4572 | + } catch ( e ) {} |
4573 | + |
4574 | + if ( top && top.doScroll ) { |
4575 | + ( function doScrollCheck() { |
4576 | + if ( !jQuery.isReady ) { |
4577 | + |
4578 | + try { |
4579 | + |
4580 | + // Use the trick by Diego Perini |
4581 | + // http://javascript.nwbox.com/IEContentLoaded/ |
4582 | + top.doScroll( "left" ); |
4583 | + } catch ( e ) { |
4584 | + return window.setTimeout( doScrollCheck, 50 ); |
4585 | + } |
4586 | + |
4587 | + // detach all dom ready events |
4588 | + detach(); |
4589 | + |
4590 | + // and execute any waiting functions |
4591 | + jQuery.ready(); |
4592 | + } |
4593 | + } )(); |
4594 | } |
4595 | - } else if ( deferred !== firstParam ) { |
4596 | - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); |
4597 | - } |
4598 | - return promise; |
4599 | - } |
4600 | -}); |
4601 | - |
4602 | - |
4603 | - |
4604 | - |
4605 | -jQuery.support = (function() { |
4606 | - |
4607 | - var support, |
4608 | - all, |
4609 | - a, |
4610 | - select, |
4611 | - opt, |
4612 | - input, |
4613 | - fragment, |
4614 | - tds, |
4615 | - events, |
4616 | - eventName, |
4617 | - i, |
4618 | - isSupported, |
4619 | - div = document.createElement( "div" ), |
4620 | - documentElement = document.documentElement; |
4621 | - |
4622 | - // Preliminary tests |
4623 | - div.setAttribute("className", "t"); |
4624 | - div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
4625 | - |
4626 | - all = div.getElementsByTagName( "*" ); |
4627 | - a = div.getElementsByTagName( "a" )[ 0 ]; |
4628 | - |
4629 | - // Can't get basic test support |
4630 | - if ( !all || !all.length || !a ) { |
4631 | - return {}; |
4632 | - } |
4633 | - |
4634 | - // First batch of supports tests |
4635 | - select = document.createElement( "select" ); |
4636 | - opt = select.appendChild( document.createElement("option") ); |
4637 | - input = div.getElementsByTagName( "input" )[ 0 ]; |
4638 | - |
4639 | - support = { |
4640 | - // IE strips leading whitespace when .innerHTML is used |
4641 | - leadingWhitespace: ( div.firstChild.nodeType === 3 ), |
4642 | - |
4643 | - // Make sure that tbody elements aren't automatically inserted |
4644 | - // IE will insert them into empty tables |
4645 | - tbody: !div.getElementsByTagName("tbody").length, |
4646 | - |
4647 | - // Make sure that link elements get serialized correctly by innerHTML |
4648 | - // This requires a wrapper element in IE |
4649 | - htmlSerialize: !!div.getElementsByTagName("link").length, |
4650 | - |
4651 | - // Get the style information from getAttribute |
4652 | - // (IE uses .cssText instead) |
4653 | - style: /top/.test( a.getAttribute("style") ), |
4654 | - |
4655 | - // Make sure that URLs aren't manipulated |
4656 | - // (IE normalizes it by default) |
4657 | - hrefNormalized: ( a.getAttribute("href") === "/a" ), |
4658 | - |
4659 | - // Make sure that element opacity exists |
4660 | - // (IE uses filter instead) |
4661 | - // Use a regex to work around a WebKit issue. See #5145 |
4662 | - opacity: /^0.55/.test( a.style.opacity ), |
4663 | - |
4664 | - // Verify style float existence |
4665 | - // (IE uses styleFloat instead of cssFloat) |
4666 | - cssFloat: !!a.style.cssFloat, |
4667 | - |
4668 | - // Make sure that if no value is specified for a checkbox |
4669 | - // that it defaults to "on". |
4670 | - // (WebKit defaults to "" instead) |
4671 | - checkOn: ( input.value === "on" ), |
4672 | - |
4673 | - // Make sure that a selected-by-default option has a working selected property. |
4674 | - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
4675 | - optSelected: opt.selected, |
4676 | - |
4677 | - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
4678 | - getSetAttribute: div.className !== "t", |
4679 | - |
4680 | - // Tests for enctype support on a form(#6743) |
4681 | - enctype: !!document.createElement("form").enctype, |
4682 | - |
4683 | - // Makes sure cloning an html5 element does not cause problems |
4684 | - // Where outerHTML is undefined, this still works |
4685 | - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", |
4686 | - |
4687 | - // Will be defined later |
4688 | - submitBubbles: true, |
4689 | - changeBubbles: true, |
4690 | - focusinBubbles: false, |
4691 | - deleteExpando: true, |
4692 | - noCloneEvent: true, |
4693 | - inlineBlockNeedsLayout: false, |
4694 | - shrinkWrapBlocks: false, |
4695 | - reliableMarginRight: true, |
4696 | - pixelMargin: true |
4697 | - }; |
4698 | - |
4699 | - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead |
4700 | - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); |
4701 | - |
4702 | - // Make sure checked status is properly cloned |
4703 | - input.checked = true; |
4704 | - support.noCloneChecked = input.cloneNode( true ).checked; |
4705 | - |
4706 | - // Make sure that the options inside disabled selects aren't marked as disabled |
4707 | - // (WebKit marks them as disabled) |
4708 | - select.disabled = true; |
4709 | - support.optDisabled = !opt.disabled; |
4710 | - |
4711 | - // Test to see if it's possible to delete an expando from an element |
4712 | - // Fails in Internet Explorer |
4713 | + } |
4714 | + } |
4715 | + return readyList.promise( obj ); |
4716 | +}; |
4717 | + |
4718 | +// Kick off the DOM ready check even if the user does not |
4719 | +jQuery.ready.promise(); |
4720 | + |
4721 | + |
4722 | + |
4723 | + |
4724 | +// Support: IE<9 |
4725 | +// Iteration over object's inherited properties before its own |
4726 | +var i; |
4727 | +for ( i in jQuery( support ) ) { |
4728 | + break; |
4729 | +} |
4730 | +support.ownFirst = i === "0"; |
4731 | + |
4732 | +// Note: most support tests are defined in their respective modules. |
4733 | +// false until the test is run |
4734 | +support.inlineBlockNeedsLayout = false; |
4735 | + |
4736 | +// Execute ASAP in case we need to set body.style.zoom |
4737 | +jQuery( function() { |
4738 | + |
4739 | + // Minified: var a,b,c,d |
4740 | + var val, div, body, container; |
4741 | + |
4742 | + body = document.getElementsByTagName( "body" )[ 0 ]; |
4743 | + if ( !body || !body.style ) { |
4744 | + |
4745 | + // Return for frameset docs that don't have a body |
4746 | + return; |
4747 | + } |
4748 | + |
4749 | + // Setup |
4750 | + div = document.createElement( "div" ); |
4751 | + container = document.createElement( "div" ); |
4752 | + container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; |
4753 | + body.appendChild( container ).appendChild( div ); |
4754 | + |
4755 | + if ( typeof div.style.zoom !== "undefined" ) { |
4756 | + |
4757 | + // Support: IE<8 |
4758 | + // Check if natively block-level elements act like inline-block |
4759 | + // elements when setting their display to 'inline' and giving |
4760 | + // them layout |
4761 | + div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; |
4762 | + |
4763 | + support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; |
4764 | + if ( val ) { |
4765 | + |
4766 | + // Prevent IE 6 from affecting layout for positioned elements #11048 |
4767 | + // Prevent IE from shrinking the body in IE 7 mode #12869 |
4768 | + // Support: IE<8 |
4769 | + body.style.zoom = 1; |
4770 | + } |
4771 | + } |
4772 | + |
4773 | + body.removeChild( container ); |
4774 | +} ); |
4775 | + |
4776 | + |
4777 | +( function() { |
4778 | + var div = document.createElement( "div" ); |
4779 | + |
4780 | + // Support: IE<9 |
4781 | + support.deleteExpando = true; |
4782 | try { |
4783 | delete div.test; |
4784 | - } catch( e ) { |
4785 | + } catch ( e ) { |
4786 | support.deleteExpando = false; |
4787 | } |
4788 | |
4789 | - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { |
4790 | - div.attachEvent( "onclick", function() { |
4791 | - // Cloning a node shouldn't copy over any |
4792 | - // bound event handlers (IE does this) |
4793 | - support.noCloneEvent = false; |
4794 | - }); |
4795 | - div.cloneNode( true ).fireEvent( "onclick" ); |
4796 | - } |
4797 | - |
4798 | - // Check if a radio maintains its value |
4799 | - // after being appended to the DOM |
4800 | - input = document.createElement("input"); |
4801 | - input.value = "t"; |
4802 | - input.setAttribute("type", "radio"); |
4803 | - support.radioValue = input.value === "t"; |
4804 | - |
4805 | - input.setAttribute("checked", "checked"); |
4806 | - |
4807 | - // #11217 - WebKit loses check when the name is after the checked attribute |
4808 | - input.setAttribute( "name", "t" ); |
4809 | - |
4810 | - div.appendChild( input ); |
4811 | - fragment = document.createDocumentFragment(); |
4812 | - fragment.appendChild( div.lastChild ); |
4813 | - |
4814 | - // WebKit doesn't clone checked state correctly in fragments |
4815 | - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; |
4816 | - |
4817 | - // Check if a disconnected checkbox will retain its checked |
4818 | - // value of true after appended to the DOM (IE6/7) |
4819 | - support.appendChecked = input.checked; |
4820 | - |
4821 | - fragment.removeChild( input ); |
4822 | - fragment.appendChild( div ); |
4823 | - |
4824 | - // Technique from Juriy Zaytsev |
4825 | - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ |
4826 | - // We only care about the case where non-standard event systems |
4827 | - // are used, namely in IE. Short-circuiting here helps us to |
4828 | - // avoid an eval call (in setAttribute) which can cause CSP |
4829 | - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP |
4830 | - if ( div.attachEvent ) { |
4831 | - for ( i in { |
4832 | - submit: 1, |
4833 | - change: 1, |
4834 | - focusin: 1 |
4835 | - }) { |
4836 | - eventName = "on" + i; |
4837 | - isSupported = ( eventName in div ); |
4838 | - if ( !isSupported ) { |
4839 | - div.setAttribute( eventName, "return;" ); |
4840 | - isSupported = ( typeof div[ eventName ] === "function" ); |
4841 | - } |
4842 | - support[ i + "Bubbles" ] = isSupported; |
4843 | - } |
4844 | - } |
4845 | - |
4846 | - fragment.removeChild( div ); |
4847 | - |
4848 | - // Null elements to avoid leaks in IE |
4849 | - fragment = select = opt = div = input = null; |
4850 | - |
4851 | - // Run tests that need a body at doc ready |
4852 | - jQuery(function() { |
4853 | - var container, outer, inner, table, td, offsetSupport, |
4854 | - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, |
4855 | - paddingMarginBorderVisibility, paddingMarginBorder, |
4856 | - body = document.getElementsByTagName("body")[0]; |
4857 | - |
4858 | - if ( !body ) { |
4859 | - // Return for frameset docs that don't have a body |
4860 | - return; |
4861 | - } |
4862 | - |
4863 | - conMarginTop = 1; |
4864 | - paddingMarginBorder = "padding:0;margin:0;border:"; |
4865 | - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; |
4866 | - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; |
4867 | - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; |
4868 | - html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" + |
4869 | - "<table " + style + "' cellpadding='0' cellspacing='0'>" + |
4870 | - "<tr><td></td></tr></table>"; |
4871 | - |
4872 | - container = document.createElement("div"); |
4873 | - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; |
4874 | - body.insertBefore( container, body.firstChild ); |
4875 | - |
4876 | - // Construct the test element |
4877 | - div = document.createElement("div"); |
4878 | - container.appendChild( div ); |
4879 | - |
4880 | - // Check if table cells still have offsetWidth/Height when they are set |
4881 | - // to display:none and there are still other visible table cells in a |
4882 | - // table row; if so, offsetWidth/Height are not reliable for use when |
4883 | - // determining if an element has been hidden directly using |
4884 | - // display:none (it is still safe to use offsets if a parent element is |
4885 | - // hidden; don safety goggles and see bug #4512 for more information). |
4886 | - // (only IE 8 fails this test) |
4887 | - div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>"; |
4888 | - tds = div.getElementsByTagName( "td" ); |
4889 | - isSupported = ( tds[ 0 ].offsetHeight === 0 ); |
4890 | - |
4891 | - tds[ 0 ].style.display = ""; |
4892 | - tds[ 1 ].style.display = "none"; |
4893 | - |
4894 | - // Check if empty table cells still have offsetWidth/Height |
4895 | - // (IE <= 8 fail this test) |
4896 | - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); |
4897 | - |
4898 | - // Check if div with explicit width and no margin-right incorrectly |
4899 | - // gets computed margin-right based on width of container. For more |
4900 | - // info see bug #3333 |
4901 | - // Fails in WebKit before Feb 2011 nightlies |
4902 | - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
4903 | - if ( window.getComputedStyle ) { |
4904 | - div.innerHTML = ""; |
4905 | - marginDiv = document.createElement( "div" ); |
4906 | - marginDiv.style.width = "0"; |
4907 | - marginDiv.style.marginRight = "0"; |
4908 | - div.style.width = "2px"; |
4909 | - div.appendChild( marginDiv ); |
4910 | - support.reliableMarginRight = |
4911 | - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; |
4912 | - } |
4913 | - |
4914 | - if ( typeof div.style.zoom !== "undefined" ) { |
4915 | - // Check if natively block-level elements act like inline-block |
4916 | - // elements when setting their display to 'inline' and giving |
4917 | - // them layout |
4918 | - // (IE < 8 does this) |
4919 | - div.innerHTML = ""; |
4920 | - div.style.width = div.style.padding = "1px"; |
4921 | - div.style.border = 0; |
4922 | - div.style.overflow = "hidden"; |
4923 | - div.style.display = "inline"; |
4924 | - div.style.zoom = 1; |
4925 | - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); |
4926 | - |
4927 | - // Check if elements with layout shrink-wrap their children |
4928 | - // (IE 6 does this) |
4929 | - div.style.display = "block"; |
4930 | - div.style.overflow = "visible"; |
4931 | - div.innerHTML = "<div style='width:5px;'></div>"; |
4932 | - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); |
4933 | - } |
4934 | - |
4935 | - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; |
4936 | - div.innerHTML = html; |
4937 | - |
4938 | - outer = div.firstChild; |
4939 | - inner = outer.firstChild; |
4940 | - td = outer.nextSibling.firstChild.firstChild; |
4941 | - |
4942 | - offsetSupport = { |
4943 | - doesNotAddBorder: ( inner.offsetTop !== 5 ), |
4944 | - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) |
4945 | - }; |
4946 | - |
4947 | - inner.style.position = "fixed"; |
4948 | - inner.style.top = "20px"; |
4949 | - |
4950 | - // safari subtracts parent border width here which is 5px |
4951 | - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); |
4952 | - inner.style.position = inner.style.top = ""; |
4953 | - |
4954 | - outer.style.overflow = "hidden"; |
4955 | - outer.style.position = "relative"; |
4956 | - |
4957 | - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); |
4958 | - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); |
4959 | - |
4960 | - if ( window.getComputedStyle ) { |
4961 | - div.style.marginTop = "1%"; |
4962 | - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; |
4963 | - } |
4964 | - |
4965 | - if ( typeof container.style.zoom !== "undefined" ) { |
4966 | - container.style.zoom = 1; |
4967 | - } |
4968 | - |
4969 | - body.removeChild( container ); |
4970 | - marginDiv = div = container = null; |
4971 | - |
4972 | - jQuery.extend( support, offsetSupport ); |
4973 | - }); |
4974 | - |
4975 | - return support; |
4976 | -})(); |
4977 | - |
4978 | - |
4979 | - |
4980 | - |
4981 | -var rbrace = /^(?:\{.*\}|\[.*\])$/, |
4982 | + // Null elements to avoid leaks in IE. |
4983 | + div = null; |
4984 | +} )(); |
4985 | +var acceptData = function( elem ) { |
4986 | + var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ], |
4987 | + nodeType = +elem.nodeType || 1; |
4988 | + |
4989 | + // Do not set data on non-element DOM nodes because it will not be cleared (#8335). |
4990 | + return nodeType !== 1 && nodeType !== 9 ? |
4991 | + false : |
4992 | + |
4993 | + // Nodes accept data unless otherwise specified; rejection can be conditional |
4994 | + !noData || noData !== true && elem.getAttribute( "classid" ) === noData; |
4995 | +}; |
4996 | + |
4997 | + |
4998 | + |
4999 | + |
5000 | +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
You've got a lot of conflicts there!