Merge lp:~edb/quam-plures/update_jquery_and_jqueryUI into lp:quam-plures
- update_jquery_and_jqueryUI
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7630 |
Proposed branch: | lp:~edb/quam-plures/update_jquery_and_jqueryUI |
Merge into: | lp:quam-plures |
Diff against target: | 24202 lines |
To merge this branch: | bzr merge lp:~edb/quam-plures/update_jquery_and_jqueryUI |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lee Turner (community) | Approve | ||
Tilman Blumenbach (community) | Approve | ||
Review via email: mp+72840@code.launchpad.net |
Commit message
Description of the change
http://
This updates our jQuery from 1.3.2 to 1.6.2 and our jQueryUI from 1.7 to 1.8.16 I honestly forget if jQuery has a newer version, but I went with 1.6.2 because that is what came with the jQueryUI package. We need this to use uploadify for a mass file uploader.
That was my theory: jqueryUI gave me a jquery that it likes to work with so I went with it and couldn't detect a problem. And uploadify says it needs a higher version of jquery to be used (which is unrelated to this branch).
OT: I'm making some fair progress with a mass uploader using uploadify, which is shocking considering it involves jquery and me.
Oh and one thing I did was to make sure that what we had was EXACTLY what jquery of that version was. In other words I verified that there were no changes to the jquery file(s) made by that other app and therefore in use by us. To find our jquery was exactly what it was supposed to be gave me confidence to simply update the versions ... then drive around the back end and play with file uploading and widget selection/placement as my "testing".
Lee Turner (leeturner) wrote : | # |
Couldn't find any issues with this
I am adding core updates AND retesting everything I have in merge just to be sure, but it is taking a long time due to many conflicts this time around. Will send another comment when I got them back up to speed.
Preview Diff
1 | === modified file 'qp_rsc/js/jquery.js' |
2 | --- qp_rsc/js/jquery.js 2009-03-08 08:42:22 +0000 |
3 | +++ qp_rsc/js/jquery.js 2011-09-04 22:26:29 +0000 |
4 | @@ -1,153 +1,271 @@ |
5 | /*! |
6 | - * jQuery JavaScript Library v1.3.2 |
7 | + * jQuery JavaScript Library v1.6.2 |
8 | * http://jquery.com/ |
9 | * |
10 | - * Copyright (c) 2009 John Resig |
11 | - * Dual licensed under the MIT and GPL licenses. |
12 | - * http://docs.jquery.com/License |
13 | - * |
14 | - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) |
15 | - * Revision: 6246 |
16 | + * Copyright 2011, John Resig |
17 | + * Dual licensed under the MIT or GPL Version 2 licenses. |
18 | + * http://jquery.org/license |
19 | + * |
20 | + * Includes Sizzle.js |
21 | + * http://sizzlejs.com/ |
22 | + * Copyright 2011, The Dojo Foundation |
23 | + * Released under the MIT, BSD, and GPL Licenses. |
24 | + * |
25 | + * Date: Thu Jun 30 14:16:56 2011 -0400 |
26 | */ |
27 | -(function(){ |
28 | - |
29 | -var |
30 | - // Will speed up references to window, and allows munging its name. |
31 | - window = this, |
32 | - // Will speed up references to undefined, and allows munging its name. |
33 | - undefined, |
34 | +(function( window, undefined ) { |
35 | + |
36 | +// Use the correct document accordingly with window argument (sandbox) |
37 | +var document = window.document, |
38 | + navigator = window.navigator, |
39 | + location = window.location; |
40 | +var jQuery = (function() { |
41 | + |
42 | +// Define a local copy of jQuery |
43 | +var jQuery = function( selector, context ) { |
44 | + // The jQuery object is actually just the init constructor 'enhanced' |
45 | + return new jQuery.fn.init( selector, context, rootjQuery ); |
46 | + }, |
47 | + |
48 | // Map over jQuery in case of overwrite |
49 | _jQuery = window.jQuery, |
50 | + |
51 | // Map over the $ in case of overwrite |
52 | _$ = window.$, |
53 | |
54 | - jQuery = window.jQuery = window.$ = function( selector, context ) { |
55 | - // The jQuery object is actually just the init constructor 'enhanced' |
56 | - return new jQuery.fn.init( selector, context ); |
57 | - }, |
58 | + // A central reference to the root jQuery(document) |
59 | + rootjQuery, |
60 | |
61 | // A simple way to check for HTML strings or ID strings |
62 | // (both of which we optimize for) |
63 | - quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
64 | - // Is it a simple selector |
65 | - isSimple = /^.[^:#\[\.,]*$/; |
66 | + quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, |
67 | + |
68 | + // Check if a string has a non-whitespace character in it |
69 | + rnotwhite = /\S/, |
70 | + |
71 | + // Used for trimming whitespace |
72 | + trimLeft = /^\s+/, |
73 | + trimRight = /\s+$/, |
74 | + |
75 | + // Check for digits |
76 | + rdigit = /\d/, |
77 | + |
78 | + // Match a standalone tag |
79 | + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, |
80 | + |
81 | + // JSON RegExp |
82 | + rvalidchars = /^[\],:{}\s]*$/, |
83 | + rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, |
84 | + rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, |
85 | + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, |
86 | + |
87 | + // Useragent RegExp |
88 | + rwebkit = /(webkit)[ \/]([\w.]+)/, |
89 | + ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, |
90 | + rmsie = /(msie) ([\w.]+)/, |
91 | + rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, |
92 | + |
93 | + // Matches dashed string for camelizing |
94 | + rdashAlpha = /-([a-z])/ig, |
95 | + |
96 | + // Used by jQuery.camelCase as callback to replace() |
97 | + fcamelCase = function( all, letter ) { |
98 | + return letter.toUpperCase(); |
99 | + }, |
100 | + |
101 | + // Keep a UserAgent string for use with jQuery.browser |
102 | + userAgent = navigator.userAgent, |
103 | + |
104 | + // For matching the engine and version of the browser |
105 | + browserMatch, |
106 | + |
107 | + // The deferred used on DOM ready |
108 | + readyList, |
109 | + |
110 | + // The ready event handler |
111 | + DOMContentLoaded, |
112 | + |
113 | + // Save a reference to some core methods |
114 | + toString = Object.prototype.toString, |
115 | + hasOwn = Object.prototype.hasOwnProperty, |
116 | + push = Array.prototype.push, |
117 | + slice = Array.prototype.slice, |
118 | + trim = String.prototype.trim, |
119 | + indexOf = Array.prototype.indexOf, |
120 | + |
121 | + // [[Class]] -> type pairs |
122 | + class2type = {}; |
123 | |
124 | jQuery.fn = jQuery.prototype = { |
125 | - init: function( selector, context ) { |
126 | - // Make sure that a selection was provided |
127 | - selector = selector || document; |
128 | + constructor: jQuery, |
129 | + init: function( selector, context, rootjQuery ) { |
130 | + var match, elem, ret, doc; |
131 | + |
132 | + // Handle $(""), $(null), or $(undefined) |
133 | + if ( !selector ) { |
134 | + return this; |
135 | + } |
136 | |
137 | // Handle $(DOMElement) |
138 | if ( selector.nodeType ) { |
139 | - this[0] = selector; |
140 | - this.length = 1; |
141 | - this.context = selector; |
142 | - return this; |
143 | - } |
144 | + this.context = this[0] = selector; |
145 | + this.length = 1; |
146 | + return this; |
147 | + } |
148 | + |
149 | + // The body element only exists once, optimize finding it |
150 | + if ( selector === "body" && !context && document.body ) { |
151 | + this.context = document; |
152 | + this[0] = document.body; |
153 | + this.selector = selector; |
154 | + this.length = 1; |
155 | + return this; |
156 | + } |
157 | + |
158 | // Handle HTML strings |
159 | if ( typeof selector === "string" ) { |
160 | // Are we dealing with HTML string or an ID? |
161 | - var match = quickExpr.exec( selector ); |
162 | + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { |
163 | + // Assume that strings that start and end with <> are HTML and skip the regex check |
164 | + match = [ null, selector, null ]; |
165 | + |
166 | + } else { |
167 | + match = quickExpr.exec( selector ); |
168 | + } |
169 | |
170 | // Verify a match, and that no context was specified for #id |
171 | if ( match && (match[1] || !context) ) { |
172 | |
173 | // HANDLE: $(html) -> $(array) |
174 | - if ( match[1] ) |
175 | - selector = jQuery.clean( [ match[1] ], context ); |
176 | + if ( match[1] ) { |
177 | + context = context instanceof jQuery ? context[0] : context; |
178 | + doc = (context ? context.ownerDocument || context : document); |
179 | + |
180 | + // If a single string is passed in and it's a single tag |
181 | + // just do a createElement and skip the rest |
182 | + ret = rsingleTag.exec( selector ); |
183 | + |
184 | + if ( ret ) { |
185 | + if ( jQuery.isPlainObject( context ) ) { |
186 | + selector = [ document.createElement( ret[1] ) ]; |
187 | + jQuery.fn.attr.call( selector, context, true ); |
188 | + |
189 | + } else { |
190 | + selector = [ doc.createElement( ret[1] ) ]; |
191 | + } |
192 | + |
193 | + } else { |
194 | + ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); |
195 | + selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes; |
196 | + } |
197 | + |
198 | + return jQuery.merge( this, selector ); |
199 | |
200 | // HANDLE: $("#id") |
201 | - else { |
202 | - var elem = document.getElementById( match[3] ); |
203 | - |
204 | - // Handle the case where IE and Opera return items |
205 | - // by name instead of ID |
206 | - if ( elem && elem.id != match[3] ) |
207 | - return jQuery().find( selector ); |
208 | - |
209 | - // Otherwise, we inject the element directly into the jQuery object |
210 | - var ret = jQuery( elem || [] ); |
211 | - ret.context = document; |
212 | - ret.selector = selector; |
213 | - return ret; |
214 | + } else { |
215 | + elem = document.getElementById( match[2] ); |
216 | + |
217 | + // Check parentNode to catch when Blackberry 4.6 returns |
218 | + // nodes that are no longer in the document #6963 |
219 | + if ( elem && elem.parentNode ) { |
220 | + // Handle the case where IE and Opera return items |
221 | + // by name instead of ID |
222 | + if ( elem.id !== match[2] ) { |
223 | + return rootjQuery.find( selector ); |
224 | + } |
225 | + |
226 | + // Otherwise, we inject the element directly into the jQuery object |
227 | + this.length = 1; |
228 | + this[0] = elem; |
229 | + } |
230 | + |
231 | + this.context = document; |
232 | + this.selector = selector; |
233 | + return this; |
234 | } |
235 | |
236 | - // HANDLE: $(expr, [context]) |
237 | - // (which is just equivalent to: $(content).find(expr) |
238 | - } else |
239 | - return jQuery( context ).find( selector ); |
240 | + // HANDLE: $(expr, $(...)) |
241 | + } else if ( !context || context.jquery ) { |
242 | + return (context || rootjQuery).find( selector ); |
243 | + |
244 | + // HANDLE: $(expr, context) |
245 | + // (which is just equivalent to: $(context).find(expr) |
246 | + } else { |
247 | + return this.constructor( context ).find( selector ); |
248 | + } |
249 | |
250 | // HANDLE: $(function) |
251 | // Shortcut for document ready |
252 | - } else if ( jQuery.isFunction( selector ) ) |
253 | - return jQuery( document ).ready( selector ); |
254 | + } else if ( jQuery.isFunction( selector ) ) { |
255 | + return rootjQuery.ready( selector ); |
256 | + } |
257 | |
258 | - // Make sure that old selector state is passed along |
259 | - if ( selector.selector && selector.context ) { |
260 | + if (selector.selector !== undefined) { |
261 | this.selector = selector.selector; |
262 | this.context = selector.context; |
263 | } |
264 | |
265 | - return this.setArray(jQuery.isArray( selector ) ? |
266 | - selector : |
267 | - jQuery.makeArray(selector)); |
268 | + return jQuery.makeArray( selector, this ); |
269 | }, |
270 | |
271 | // Start with an empty selector |
272 | selector: "", |
273 | |
274 | // The current version of jQuery being used |
275 | - jquery: "1.3.2", |
276 | + jquery: "1.6.2", |
277 | + |
278 | + // The default length of a jQuery object is 0 |
279 | + length: 0, |
280 | |
281 | // The number of elements contained in the matched element set |
282 | size: function() { |
283 | return this.length; |
284 | }, |
285 | |
286 | + toArray: function() { |
287 | + return slice.call( this, 0 ); |
288 | + }, |
289 | + |
290 | // Get the Nth element in the matched element set OR |
291 | // Get the whole matched element set as a clean array |
292 | get: function( num ) { |
293 | - return num === undefined ? |
294 | + return num == null ? |
295 | |
296 | // Return a 'clean' array |
297 | - Array.prototype.slice.call( this ) : |
298 | + this.toArray() : |
299 | |
300 | // Return just the object |
301 | - this[ num ]; |
302 | + ( num < 0 ? this[ this.length + num ] : this[ num ] ); |
303 | }, |
304 | |
305 | // Take an array of elements and push it onto the stack |
306 | // (returning the new matched element set) |
307 | pushStack: function( elems, name, selector ) { |
308 | // Build a new jQuery matched element set |
309 | - var ret = jQuery( elems ); |
310 | + var ret = this.constructor(); |
311 | + |
312 | + if ( jQuery.isArray( elems ) ) { |
313 | + push.apply( ret, elems ); |
314 | + |
315 | + } else { |
316 | + jQuery.merge( ret, elems ); |
317 | + } |
318 | |
319 | // Add the old object onto the stack (as a reference) |
320 | ret.prevObject = this; |
321 | |
322 | ret.context = this.context; |
323 | |
324 | - if ( name === "find" ) |
325 | + if ( name === "find" ) { |
326 | ret.selector = this.selector + (this.selector ? " " : "") + selector; |
327 | - else if ( name ) |
328 | + } else if ( name ) { |
329 | ret.selector = this.selector + "." + name + "(" + selector + ")"; |
330 | + } |
331 | |
332 | // Return the newly-formed element set |
333 | return ret; |
334 | }, |
335 | |
336 | - // Force the current matched set of elements to become |
337 | - // the specified array of elements (destroying the stack in the process) |
338 | - // You should use pushStack() in order to do this, but maintain the stack |
339 | - setArray: function( elems ) { |
340 | - // Resetting the length to 0, then using the native Array push |
341 | - // is a super-fast way to populate an object with array-like properties |
342 | - this.length = 0; |
343 | - Array.prototype.push.apply( this, elems ); |
344 | - |
345 | - return this; |
346 | - }, |
347 | - |
348 | // Execute a callback for every element in the matched set. |
349 | // (You can seed the arguments with an array of args, but this is |
350 | // only used internally.) |
351 | @@ -155,413 +273,61 @@ |
352 | return jQuery.each( this, callback, args ); |
353 | }, |
354 | |
355 | - // Determine the position of an element within |
356 | - // the matched set of elements |
357 | - index: function( elem ) { |
358 | - // Locate the position of the desired element |
359 | - return jQuery.inArray( |
360 | - // If it receives a jQuery object, the first element is used |
361 | - elem && elem.jquery ? elem[0] : elem |
362 | - , this ); |
363 | - }, |
364 | - |
365 | - attr: function( name, value, type ) { |
366 | - var options = name; |
367 | - |
368 | - // Look for the case where we're accessing a style value |
369 | - if ( typeof name === "string" ) |
370 | - if ( value === undefined ) |
371 | - return this[0] && jQuery[ type || "attr" ]( this[0], name ); |
372 | - |
373 | - else { |
374 | - options = {}; |
375 | - options[ name ] = value; |
376 | - } |
377 | - |
378 | - // Check to see if we're setting style values |
379 | - return this.each(function(i){ |
380 | - // Set all the styles |
381 | - for ( name in options ) |
382 | - jQuery.attr( |
383 | - type ? |
384 | - this.style : |
385 | - this, |
386 | - name, jQuery.prop( this, options[ name ], type, i, name ) |
387 | - ); |
388 | - }); |
389 | - }, |
390 | - |
391 | - css: function( key, value ) { |
392 | - // ignore negative width and height values |
393 | - if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) |
394 | - value = undefined; |
395 | - return this.attr( key, value, "curCSS" ); |
396 | - }, |
397 | - |
398 | - text: function( text ) { |
399 | - if ( typeof text !== "object" && text != null ) |
400 | - return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); |
401 | - |
402 | - var ret = ""; |
403 | - |
404 | - jQuery.each( text || this, function(){ |
405 | - jQuery.each( this.childNodes, function(){ |
406 | - if ( this.nodeType != 8 ) |
407 | - ret += this.nodeType != 1 ? |
408 | - this.nodeValue : |
409 | - jQuery.fn.text( [ this ] ); |
410 | - }); |
411 | - }); |
412 | - |
413 | - return ret; |
414 | - }, |
415 | - |
416 | - wrapAll: function( html ) { |
417 | - if ( this[0] ) { |
418 | - // The elements to wrap the target around |
419 | - var wrap = jQuery( html, this[0].ownerDocument ).clone(); |
420 | - |
421 | - if ( this[0].parentNode ) |
422 | - wrap.insertBefore( this[0] ); |
423 | - |
424 | - wrap.map(function(){ |
425 | - var elem = this; |
426 | - |
427 | - while ( elem.firstChild ) |
428 | - elem = elem.firstChild; |
429 | - |
430 | - return elem; |
431 | - }).append(this); |
432 | - } |
433 | + ready: function( fn ) { |
434 | + // Attach the listeners |
435 | + jQuery.bindReady(); |
436 | + |
437 | + // Add the callback |
438 | + readyList.done( fn ); |
439 | |
440 | return this; |
441 | }, |
442 | |
443 | - wrapInner: function( html ) { |
444 | - return this.each(function(){ |
445 | - jQuery( this ).contents().wrapAll( html ); |
446 | - }); |
447 | - }, |
448 | - |
449 | - wrap: function( html ) { |
450 | - return this.each(function(){ |
451 | - jQuery( this ).wrapAll( html ); |
452 | - }); |
453 | - }, |
454 | - |
455 | - append: function() { |
456 | - return this.domManip(arguments, true, function(elem){ |
457 | - if (this.nodeType == 1) |
458 | - this.appendChild( elem ); |
459 | - }); |
460 | - }, |
461 | - |
462 | - prepend: function() { |
463 | - return this.domManip(arguments, true, function(elem){ |
464 | - if (this.nodeType == 1) |
465 | - this.insertBefore( elem, this.firstChild ); |
466 | - }); |
467 | - }, |
468 | - |
469 | - before: function() { |
470 | - return this.domManip(arguments, false, function(elem){ |
471 | - this.parentNode.insertBefore( elem, this ); |
472 | - }); |
473 | - }, |
474 | - |
475 | - after: function() { |
476 | - return this.domManip(arguments, false, function(elem){ |
477 | - this.parentNode.insertBefore( elem, this.nextSibling ); |
478 | - }); |
479 | - }, |
480 | - |
481 | - end: function() { |
482 | - return this.prevObject || jQuery( [] ); |
483 | - }, |
484 | - |
485 | - // For internal use only. |
486 | - // Behaves like an Array's method, not like a jQuery method. |
487 | - push: [].push, |
488 | - sort: [].sort, |
489 | - splice: [].splice, |
490 | - |
491 | - find: function( selector ) { |
492 | - if ( this.length === 1 ) { |
493 | - var ret = this.pushStack( [], "find", selector ); |
494 | - ret.length = 0; |
495 | - jQuery.find( selector, this[0], ret ); |
496 | - return ret; |
497 | - } else { |
498 | - return this.pushStack( jQuery.unique(jQuery.map(this, function(elem){ |
499 | - return jQuery.find( selector, elem ); |
500 | - })), "find", selector ); |
501 | - } |
502 | - }, |
503 | - |
504 | - clone: function( events ) { |
505 | - // Do the clone |
506 | - var ret = this.map(function(){ |
507 | - if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) { |
508 | - // IE copies events bound via attachEvent when |
509 | - // using cloneNode. Calling detachEvent on the |
510 | - // clone will also remove the events from the orignal |
511 | - // In order to get around this, we use innerHTML. |
512 | - // Unfortunately, this means some modifications to |
513 | - // attributes in IE that are actually only stored |
514 | - // as properties will not be copied (such as the |
515 | - // the name attribute on an input). |
516 | - var html = this.outerHTML; |
517 | - if ( !html ) { |
518 | - var div = this.ownerDocument.createElement("div"); |
519 | - div.appendChild( this.cloneNode(true) ); |
520 | - html = div.innerHTML; |
521 | - } |
522 | - |
523 | - return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; |
524 | - } else |
525 | - return this.cloneNode(true); |
526 | - }); |
527 | - |
528 | - // Copy the events from the original to the clone |
529 | - if ( events === true ) { |
530 | - var orig = this.find("*").andSelf(), i = 0; |
531 | - |
532 | - ret.find("*").andSelf().each(function(){ |
533 | - if ( this.nodeName !== orig[i].nodeName ) |
534 | - return; |
535 | - |
536 | - var events = jQuery.data( orig[i], "events" ); |
537 | - |
538 | - for ( var type in events ) { |
539 | - for ( var handler in events[ type ] ) { |
540 | - jQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); |
541 | - } |
542 | - } |
543 | - |
544 | - i++; |
545 | - }); |
546 | - } |
547 | - |
548 | - // Return the cloned set |
549 | - return ret; |
550 | - }, |
551 | - |
552 | - filter: function( selector ) { |
553 | - return this.pushStack( |
554 | - jQuery.isFunction( selector ) && |
555 | - jQuery.grep(this, function(elem, i){ |
556 | - return selector.call( elem, i ); |
557 | - }) || |
558 | - |
559 | - jQuery.multiFilter( selector, jQuery.grep(this, function(elem){ |
560 | - return elem.nodeType === 1; |
561 | - }) ), "filter", selector ); |
562 | - }, |
563 | - |
564 | - closest: function( selector ) { |
565 | - var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null, |
566 | - closer = 0; |
567 | - |
568 | - return this.map(function(){ |
569 | - var cur = this; |
570 | - while ( cur && cur.ownerDocument ) { |
571 | - if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) { |
572 | - jQuery.data(cur, "closest", closer); |
573 | - return cur; |
574 | - } |
575 | - cur = cur.parentNode; |
576 | - closer++; |
577 | - } |
578 | - }); |
579 | - }, |
580 | - |
581 | - not: function( selector ) { |
582 | - if ( typeof selector === "string" ) |
583 | - // test special case where just one selector is passed in |
584 | - if ( isSimple.test( selector ) ) |
585 | - return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector ); |
586 | - else |
587 | - selector = jQuery.multiFilter( selector, this ); |
588 | - |
589 | - var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; |
590 | - return this.filter(function() { |
591 | - return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; |
592 | - }); |
593 | - }, |
594 | - |
595 | - add: function( selector ) { |
596 | - return this.pushStack( jQuery.unique( jQuery.merge( |
597 | - this.get(), |
598 | - typeof selector === "string" ? |
599 | - jQuery( selector ) : |
600 | - jQuery.makeArray( selector ) |
601 | - ))); |
602 | - }, |
603 | - |
604 | - is: function( selector ) { |
605 | - return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
606 | - }, |
607 | - |
608 | - hasClass: function( selector ) { |
609 | - return !!selector && this.is( "." + selector ); |
610 | - }, |
611 | - |
612 | - val: function( value ) { |
613 | - if ( value === undefined ) { |
614 | - var elem = this[0]; |
615 | - |
616 | - if ( elem ) { |
617 | - if( jQuery.nodeName( elem, 'option' ) ) |
618 | - return (elem.attributes.value || {}).specified ? elem.value : elem.text; |
619 | - |
620 | - // We need to handle select boxes special |
621 | - if ( jQuery.nodeName( elem, "select" ) ) { |
622 | - var index = elem.selectedIndex, |
623 | - values = [], |
624 | - options = elem.options, |
625 | - one = elem.type == "select-one"; |
626 | - |
627 | - // Nothing was selected |
628 | - if ( index < 0 ) |
629 | - return null; |
630 | - |
631 | - // Loop through all the selected options |
632 | - for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
633 | - var option = options[ i ]; |
634 | - |
635 | - if ( option.selected ) { |
636 | - // Get the specifc value for the option |
637 | - value = jQuery(option).val(); |
638 | - |
639 | - // We don't need an array for one selects |
640 | - if ( one ) |
641 | - return value; |
642 | - |
643 | - // Multi-Selects return an array |
644 | - values.push( value ); |
645 | - } |
646 | - } |
647 | - |
648 | - return values; |
649 | - } |
650 | - |
651 | - // Everything else, we just grab the value |
652 | - return (elem.value || "").replace(/\r/g, ""); |
653 | - |
654 | - } |
655 | - |
656 | - return undefined; |
657 | - } |
658 | - |
659 | - if ( typeof value === "number" ) |
660 | - value += ''; |
661 | - |
662 | - return this.each(function(){ |
663 | - if ( this.nodeType != 1 ) |
664 | - return; |
665 | - |
666 | - if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) |
667 | - this.checked = (jQuery.inArray(this.value, value) >= 0 || |
668 | - jQuery.inArray(this.name, value) >= 0); |
669 | - |
670 | - else if ( jQuery.nodeName( this, "select" ) ) { |
671 | - var values = jQuery.makeArray(value); |
672 | - |
673 | - jQuery( "option", this ).each(function(){ |
674 | - this.selected = (jQuery.inArray( this.value, values ) >= 0 || |
675 | - jQuery.inArray( this.text, values ) >= 0); |
676 | - }); |
677 | - |
678 | - if ( !values.length ) |
679 | - this.selectedIndex = -1; |
680 | - |
681 | - } else |
682 | - this.value = value; |
683 | - }); |
684 | - }, |
685 | - |
686 | - html: function( value ) { |
687 | - return value === undefined ? |
688 | - (this[0] ? |
689 | - this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g, "") : |
690 | - null) : |
691 | - this.empty().append( value ); |
692 | - }, |
693 | - |
694 | - replaceWith: function( value ) { |
695 | - return this.after( value ).remove(); |
696 | - }, |
697 | - |
698 | eq: function( i ) { |
699 | - return this.slice( i, +i + 1 ); |
700 | + return i === -1 ? |
701 | + this.slice( i ) : |
702 | + this.slice( i, +i + 1 ); |
703 | + }, |
704 | + |
705 | + first: function() { |
706 | + return this.eq( 0 ); |
707 | + }, |
708 | + |
709 | + last: function() { |
710 | + return this.eq( -1 ); |
711 | }, |
712 | |
713 | slice: function() { |
714 | - return this.pushStack( Array.prototype.slice.apply( this, arguments ), |
715 | - "slice", Array.prototype.slice.call(arguments).join(",") ); |
716 | + return this.pushStack( slice.apply( this, arguments ), |
717 | + "slice", slice.call(arguments).join(",") ); |
718 | }, |
719 | |
720 | map: function( callback ) { |
721 | - return this.pushStack( jQuery.map(this, function(elem, i){ |
722 | + return this.pushStack( jQuery.map(this, function( elem, i ) { |
723 | return callback.call( elem, i, elem ); |
724 | })); |
725 | }, |
726 | |
727 | - andSelf: function() { |
728 | - return this.add( this.prevObject ); |
729 | + end: function() { |
730 | + return this.prevObject || this.constructor(null); |
731 | }, |
732 | |
733 | - domManip: function( args, table, callback ) { |
734 | - if ( this[0] ) { |
735 | - var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(), |
736 | - scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ), |
737 | - first = fragment.firstChild; |
738 | - |
739 | - if ( first ) |
740 | - for ( var i = 0, l = this.length; i < l; i++ ) |
741 | - callback.call( root(this[i], first), this.length > 1 || i > 0 ? |
742 | - fragment.cloneNode(true) : fragment ); |
743 | - |
744 | - if ( scripts ) |
745 | - jQuery.each( scripts, evalScript ); |
746 | - } |
747 | - |
748 | - return this; |
749 | - |
750 | - function root( elem, cur ) { |
751 | - return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ? |
752 | - (elem.getElementsByTagName("tbody")[0] || |
753 | - elem.appendChild(elem.ownerDocument.createElement("tbody"))) : |
754 | - elem; |
755 | - } |
756 | - } |
757 | + // For internal use only. |
758 | + // Behaves like an Array's method, not like a jQuery method. |
759 | + push: push, |
760 | + sort: [].sort, |
761 | + splice: [].splice |
762 | }; |
763 | |
764 | // Give the init function the jQuery prototype for later instantiation |
765 | jQuery.fn.init.prototype = jQuery.fn; |
766 | |
767 | -function evalScript( i, elem ) { |
768 | - if ( elem.src ) |
769 | - jQuery.ajax({ |
770 | - url: elem.src, |
771 | - async: false, |
772 | - dataType: "script" |
773 | - }); |
774 | - |
775 | - else |
776 | - jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
777 | - |
778 | - if ( elem.parentNode ) |
779 | - elem.parentNode.removeChild( elem ); |
780 | -} |
781 | - |
782 | -function now(){ |
783 | - return +new Date; |
784 | -} |
785 | - |
786 | jQuery.extend = jQuery.fn.extend = function() { |
787 | - // copy reference to target object |
788 | - var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
789 | + var options, name, src, copy, copyIsArray, clone, |
790 | + target = arguments[0] || {}, |
791 | + i = 1, |
792 | + length = arguments.length, |
793 | + deep = false; |
794 | |
795 | // Handle a deep copy situation |
796 | if ( typeof target === "boolean" ) { |
797 | @@ -572,884 +338,3464 @@ |
798 | } |
799 | |
800 | // Handle case when target is a string or something (possible in deep copy) |
801 | - if ( typeof target !== "object" && !jQuery.isFunction(target) ) |
802 | + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
803 | target = {}; |
804 | + } |
805 | |
806 | // extend jQuery itself if only one argument is passed |
807 | - if ( length == i ) { |
808 | + if ( length === i ) { |
809 | target = this; |
810 | --i; |
811 | } |
812 | |
813 | - for ( ; i < length; i++ ) |
814 | + for ( ; i < length; i++ ) { |
815 | // Only deal with non-null/undefined values |
816 | - if ( (options = arguments[ i ]) != null ) |
817 | + if ( (options = arguments[ i ]) != null ) { |
818 | // Extend the base object |
819 | - for ( var name in options ) { |
820 | - var src = target[ name ], copy = options[ name ]; |
821 | + for ( name in options ) { |
822 | + src = target[ name ]; |
823 | + copy = options[ name ]; |
824 | |
825 | // Prevent never-ending loop |
826 | - if ( target === copy ) |
827 | + if ( target === copy ) { |
828 | continue; |
829 | - |
830 | - // Recurse if we're merging object values |
831 | - if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
832 | - target[ name ] = jQuery.extend( deep, |
833 | - // Never move original objects, clone them |
834 | - src || ( copy.length != null ? [ ] : { } ) |
835 | - , copy ); |
836 | + } |
837 | + |
838 | + // Recurse if we're merging plain objects or arrays |
839 | + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
840 | + if ( copyIsArray ) { |
841 | + copyIsArray = false; |
842 | + clone = src && jQuery.isArray(src) ? src : []; |
843 | + |
844 | + } else { |
845 | + clone = src && jQuery.isPlainObject(src) ? src : {}; |
846 | + } |
847 | + |
848 | + // Never move original objects, clone them |
849 | + target[ name ] = jQuery.extend( deep, clone, copy ); |
850 | |
851 | // Don't bring in undefined values |
852 | - else if ( copy !== undefined ) |
853 | + } else if ( copy !== undefined ) { |
854 | target[ name ] = copy; |
855 | - |
856 | + } |
857 | } |
858 | + } |
859 | + } |
860 | |
861 | // Return the modified object |
862 | return target; |
863 | }; |
864 | |
865 | -// exclude the following css properties to add px |
866 | -var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, |
867 | - // cache defaultView |
868 | - defaultView = document.defaultView || {}, |
869 | - toString = Object.prototype.toString; |
870 | - |
871 | jQuery.extend({ |
872 | noConflict: function( deep ) { |
873 | - window.$ = _$; |
874 | + if ( window.$ === jQuery ) { |
875 | + window.$ = _$; |
876 | + } |
877 | |
878 | - if ( deep ) |
879 | + if ( deep && window.jQuery === jQuery ) { |
880 | window.jQuery = _jQuery; |
881 | + } |
882 | |
883 | return jQuery; |
884 | }, |
885 | |
886 | + // Is the DOM ready to be used? Set to true once it occurs. |
887 | + isReady: false, |
888 | + |
889 | + // A counter to track how many items to wait for before |
890 | + // the ready event fires. See #6781 |
891 | + readyWait: 1, |
892 | + |
893 | + // Hold (or release) the ready event |
894 | + holdReady: function( hold ) { |
895 | + if ( hold ) { |
896 | + jQuery.readyWait++; |
897 | + } else { |
898 | + jQuery.ready( true ); |
899 | + } |
900 | + }, |
901 | + |
902 | + // Handle when the DOM is ready |
903 | + ready: function( wait ) { |
904 | + // Either a released hold or an DOMready/load event and not yet ready |
905 | + if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { |
906 | + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
907 | + if ( !document.body ) { |
908 | + return setTimeout( jQuery.ready, 1 ); |
909 | + } |
910 | + |
911 | + // Remember that the DOM is ready |
912 | + jQuery.isReady = true; |
913 | + |
914 | + // If a normal DOM Ready event fired, decrement, and wait if need be |
915 | + if ( wait !== true && --jQuery.readyWait > 0 ) { |
916 | + return; |
917 | + } |
918 | + |
919 | + // If there are functions bound, to execute |
920 | + readyList.resolveWith( document, [ jQuery ] ); |
921 | + |
922 | + // Trigger any bound ready events |
923 | + if ( jQuery.fn.trigger ) { |
924 | + jQuery( document ).trigger( "ready" ).unbind( "ready" ); |
925 | + } |
926 | + } |
927 | + }, |
928 | + |
929 | + bindReady: function() { |
930 | + if ( readyList ) { |
931 | + return; |
932 | + } |
933 | + |
934 | + readyList = jQuery._Deferred(); |
935 | + |
936 | + // Catch cases where $(document).ready() is called after the |
937 | + // browser event has already occurred. |
938 | + if ( document.readyState === "complete" ) { |
939 | + // Handle it asynchronously to allow scripts the opportunity to delay ready |
940 | + return setTimeout( jQuery.ready, 1 ); |
941 | + } |
942 | + |
943 | + // Mozilla, Opera and webkit nightlies currently support this event |
944 | + if ( document.addEventListener ) { |
945 | + // Use the handy event callback |
946 | + document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
947 | + |
948 | + // A fallback to window.onload, that will always work |
949 | + window.addEventListener( "load", jQuery.ready, false ); |
950 | + |
951 | + // If IE event model is used |
952 | + } else if ( document.attachEvent ) { |
953 | + // ensure firing before onload, |
954 | + // maybe late but safe also for iframes |
955 | + document.attachEvent( "onreadystatechange", DOMContentLoaded ); |
956 | + |
957 | + // A fallback to window.onload, that will always work |
958 | + window.attachEvent( "onload", jQuery.ready ); |
959 | + |
960 | + // If IE and not a frame |
961 | + // continually check to see if the document is ready |
962 | + var toplevel = false; |
963 | + |
964 | + try { |
965 | + toplevel = window.frameElement == null; |
966 | + } catch(e) {} |
967 | + |
968 | + if ( document.documentElement.doScroll && toplevel ) { |
969 | + doScrollCheck(); |
970 | + } |
971 | + } |
972 | + }, |
973 | + |
974 | // See test/unit/core.js for details concerning isFunction. |
975 | // Since version 1.3, DOM methods and functions like alert |
976 | // aren't supported. They return false on IE (#2968). |
977 | isFunction: function( obj ) { |
978 | - return toString.call(obj) === "[object Function]"; |
979 | - }, |
980 | - |
981 | - isArray: function( obj ) { |
982 | - return toString.call(obj) === "[object Array]"; |
983 | - }, |
984 | - |
985 | - // check if an element is in a (or is an) XML document |
986 | - isXMLDoc: function( elem ) { |
987 | - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || |
988 | - !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument ); |
989 | - }, |
990 | - |
991 | - // Evalulates a script in a global context |
992 | + return jQuery.type(obj) === "function"; |
993 | + }, |
994 | + |
995 | + isArray: Array.isArray || function( obj ) { |
996 | + return jQuery.type(obj) === "array"; |
997 | + }, |
998 | + |
999 | + // A crude way of determining if an object is a window |
1000 | + isWindow: function( obj ) { |
1001 | + return obj && typeof obj === "object" && "setInterval" in obj; |
1002 | + }, |
1003 | + |
1004 | + isNaN: function( obj ) { |
1005 | + return obj == null || !rdigit.test( obj ) || isNaN( obj ); |
1006 | + }, |
1007 | + |
1008 | + type: function( obj ) { |
1009 | + return obj == null ? |
1010 | + String( obj ) : |
1011 | + class2type[ toString.call(obj) ] || "object"; |
1012 | + }, |
1013 | + |
1014 | + isPlainObject: function( obj ) { |
1015 | + // Must be an Object. |
1016 | + // Because of IE, we also have to check the presence of the constructor property. |
1017 | + // Make sure that DOM nodes and window objects don't pass through, as well |
1018 | + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
1019 | + return false; |
1020 | + } |
1021 | + |
1022 | + // Not own constructor property must be Object |
1023 | + if ( obj.constructor && |
1024 | + !hasOwn.call(obj, "constructor") && |
1025 | + !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
1026 | + return false; |
1027 | + } |
1028 | + |
1029 | + // Own properties are enumerated firstly, so to speed up, |
1030 | + // if last one is own, then all properties are own. |
1031 | + |
1032 | + var key; |
1033 | + for ( key in obj ) {} |
1034 | + |
1035 | + return key === undefined || hasOwn.call( obj, key ); |
1036 | + }, |
1037 | + |
1038 | + isEmptyObject: function( obj ) { |
1039 | + for ( var name in obj ) { |
1040 | + return false; |
1041 | + } |
1042 | + return true; |
1043 | + }, |
1044 | + |
1045 | + error: function( msg ) { |
1046 | + throw msg; |
1047 | + }, |
1048 | + |
1049 | + parseJSON: function( data ) { |
1050 | + if ( typeof data !== "string" || !data ) { |
1051 | + return null; |
1052 | + } |
1053 | + |
1054 | + // Make sure leading/trailing whitespace is removed (IE can't handle it) |
1055 | + data = jQuery.trim( data ); |
1056 | + |
1057 | + // Attempt to parse using the native JSON parser first |
1058 | + if ( window.JSON && window.JSON.parse ) { |
1059 | + return window.JSON.parse( data ); |
1060 | + } |
1061 | + |
1062 | + // Make sure the incoming data is actual JSON |
1063 | + // Logic borrowed from http://json.org/json2.js |
1064 | + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) |
1065 | + .replace( rvalidtokens, "]" ) |
1066 | + .replace( rvalidbraces, "")) ) { |
1067 | + |
1068 | + return (new Function( "return " + data ))(); |
1069 | + |
1070 | + } |
1071 | + jQuery.error( "Invalid JSON: " + data ); |
1072 | + }, |
1073 | + |
1074 | + // Cross-browser xml parsing |
1075 | + // (xml & tmp used internally) |
1076 | + parseXML: function( data , xml , tmp ) { |
1077 | + |
1078 | + if ( window.DOMParser ) { // Standard |
1079 | + tmp = new DOMParser(); |
1080 | + xml = tmp.parseFromString( data , "text/xml" ); |
1081 | + } else { // IE |
1082 | + xml = new ActiveXObject( "Microsoft.XMLDOM" ); |
1083 | + xml.async = "false"; |
1084 | + xml.loadXML( data ); |
1085 | + } |
1086 | + |
1087 | + tmp = xml.documentElement; |
1088 | + |
1089 | + if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) { |
1090 | + jQuery.error( "Invalid XML: " + data ); |
1091 | + } |
1092 | + |
1093 | + return xml; |
1094 | + }, |
1095 | + |
1096 | + noop: function() {}, |
1097 | + |
1098 | + // Evaluates a script in a global context |
1099 | + // Workarounds based on findings by Jim Driscoll |
1100 | + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context |
1101 | globalEval: function( data ) { |
1102 | - if ( data && /\S/.test(data) ) { |
1103 | - // Inspired by code by Andrea Giammarchi |
1104 | - // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
1105 | - var head = document.getElementsByTagName("head")[0] || document.documentElement, |
1106 | - script = document.createElement("script"); |
1107 | - |
1108 | - script.type = "text/javascript"; |
1109 | - if ( jQuery.support.scriptEval ) |
1110 | - script.appendChild( document.createTextNode( data ) ); |
1111 | - else |
1112 | - script.text = data; |
1113 | - |
1114 | - // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
1115 | - // This arises when a base node is used (#2709). |
1116 | - head.insertBefore( script, head.firstChild ); |
1117 | - head.removeChild( script ); |
1118 | + if ( data && rnotwhite.test( data ) ) { |
1119 | + // We use execScript on Internet Explorer |
1120 | + // We use an anonymous function so that context is window |
1121 | + // rather than jQuery in Firefox |
1122 | + ( window.execScript || function( data ) { |
1123 | + window[ "eval" ].call( window, data ); |
1124 | + } )( data ); |
1125 | } |
1126 | }, |
1127 | |
1128 | + // Converts a dashed string to camelCased string; |
1129 | + // Used by both the css and data modules |
1130 | + camelCase: function( string ) { |
1131 | + return string.replace( rdashAlpha, fcamelCase ); |
1132 | + }, |
1133 | + |
1134 | nodeName: function( elem, name ) { |
1135 | - return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
1136 | + return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
1137 | }, |
1138 | |
1139 | // args is for internal usage only |
1140 | each: function( object, callback, args ) { |
1141 | - var name, i = 0, length = object.length; |
1142 | + var name, i = 0, |
1143 | + length = object.length, |
1144 | + isObj = length === undefined || jQuery.isFunction( object ); |
1145 | |
1146 | if ( args ) { |
1147 | - if ( length === undefined ) { |
1148 | - for ( name in object ) |
1149 | - if ( callback.apply( object[ name ], args ) === false ) |
1150 | - break; |
1151 | - } else |
1152 | - for ( ; i < length; ) |
1153 | - if ( callback.apply( object[ i++ ], args ) === false ) |
1154 | - break; |
1155 | + if ( isObj ) { |
1156 | + for ( name in object ) { |
1157 | + if ( callback.apply( object[ name ], args ) === false ) { |
1158 | + break; |
1159 | + } |
1160 | + } |
1161 | + } else { |
1162 | + for ( ; i < length; ) { |
1163 | + if ( callback.apply( object[ i++ ], args ) === false ) { |
1164 | + break; |
1165 | + } |
1166 | + } |
1167 | + } |
1168 | |
1169 | // A special, fast, case for the most common use of each |
1170 | } else { |
1171 | - if ( length === undefined ) { |
1172 | - for ( name in object ) |
1173 | - if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
1174 | - break; |
1175 | - } else |
1176 | - for ( var value = object[0]; |
1177 | - i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
1178 | + if ( isObj ) { |
1179 | + for ( name in object ) { |
1180 | + if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
1181 | + break; |
1182 | + } |
1183 | + } |
1184 | + } else { |
1185 | + for ( ; i < length; ) { |
1186 | + if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { |
1187 | + break; |
1188 | + } |
1189 | + } |
1190 | + } |
1191 | } |
1192 | |
1193 | return object; |
1194 | }, |
1195 | |
1196 | - prop: function( elem, value, type, i, name ) { |
1197 | - // Handle executable functions |
1198 | - if ( jQuery.isFunction( value ) ) |
1199 | - value = value.call( elem, i ); |
1200 | - |
1201 | - // Handle passing in a number to a CSS property |
1202 | - return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? |
1203 | - value + "px" : |
1204 | - value; |
1205 | - }, |
1206 | - |
1207 | - className: { |
1208 | - // internal only, use addClass("class") |
1209 | - add: function( elem, classNames ) { |
1210 | - jQuery.each((classNames || "").split(/\s+/), function(i, className){ |
1211 | - if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) |
1212 | - elem.className += (elem.className ? " " : "") + className; |
1213 | - }); |
1214 | - }, |
1215 | - |
1216 | - // internal only, use removeClass("class") |
1217 | - remove: function( elem, classNames ) { |
1218 | - if (elem.nodeType == 1) |
1219 | - elem.className = classNames !== undefined ? |
1220 | - jQuery.grep(elem.className.split(/\s+/), function(className){ |
1221 | - return !jQuery.className.has( classNames, className ); |
1222 | - }).join(" ") : |
1223 | - ""; |
1224 | - }, |
1225 | - |
1226 | - // internal only, use hasClass("class") |
1227 | - has: function( elem, className ) { |
1228 | - return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; |
1229 | - } |
1230 | - }, |
1231 | - |
1232 | - // A method for quickly swapping in/out CSS properties to get correct calculations |
1233 | - swap: function( elem, options, callback ) { |
1234 | - var old = {}; |
1235 | - // Remember the old values, and insert the new ones |
1236 | - for ( var name in options ) { |
1237 | - old[ name ] = elem.style[ name ]; |
1238 | - elem.style[ name ] = options[ name ]; |
1239 | - } |
1240 | - |
1241 | - callback.call( elem ); |
1242 | - |
1243 | - // Revert the old values |
1244 | - for ( var name in options ) |
1245 | - elem.style[ name ] = old[ name ]; |
1246 | - }, |
1247 | - |
1248 | - css: function( elem, name, force, extra ) { |
1249 | - if ( name == "width" || name == "height" ) { |
1250 | - var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; |
1251 | - |
1252 | - function getWH() { |
1253 | - val = name == "width" ? elem.offsetWidth : elem.offsetHeight; |
1254 | - |
1255 | - if ( extra === "border" ) |
1256 | - return; |
1257 | - |
1258 | - jQuery.each( which, function() { |
1259 | - if ( !extra ) |
1260 | - val -= parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; |
1261 | - if ( extra === "margin" ) |
1262 | - val += parseFloat(jQuery.curCSS( elem, "margin" + this, true)) || 0; |
1263 | - else |
1264 | - val -= parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; |
1265 | - }); |
1266 | - } |
1267 | - |
1268 | - if ( elem.offsetWidth !== 0 ) |
1269 | - getWH(); |
1270 | - else |
1271 | - jQuery.swap( elem, props, getWH ); |
1272 | - |
1273 | - return Math.max(0, Math.round(val)); |
1274 | - } |
1275 | - |
1276 | - return jQuery.curCSS( elem, name, force ); |
1277 | - }, |
1278 | - |
1279 | - curCSS: function( elem, name, force ) { |
1280 | - var ret, style = elem.style; |
1281 | - |
1282 | - // We need to handle opacity special in IE |
1283 | - if ( name == "opacity" && !jQuery.support.opacity ) { |
1284 | - ret = jQuery.attr( style, "opacity" ); |
1285 | - |
1286 | - return ret == "" ? |
1287 | - "1" : |
1288 | - ret; |
1289 | - } |
1290 | - |
1291 | - // Make sure we're using the right name for getting the float value |
1292 | - if ( name.match( /float/i ) ) |
1293 | - name = styleFloat; |
1294 | - |
1295 | - if ( !force && style && style[ name ] ) |
1296 | - ret = style[ name ]; |
1297 | - |
1298 | - else if ( defaultView.getComputedStyle ) { |
1299 | - |
1300 | - // Only "float" is needed here |
1301 | - if ( name.match( /float/i ) ) |
1302 | - name = "float"; |
1303 | - |
1304 | - name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); |
1305 | - |
1306 | - var computedStyle = defaultView.getComputedStyle( elem, null ); |
1307 | - |
1308 | - if ( computedStyle ) |
1309 | - ret = computedStyle.getPropertyValue( name ); |
1310 | - |
1311 | - // We should always get a number back from opacity |
1312 | - if ( name == "opacity" && ret == "" ) |
1313 | - ret = "1"; |
1314 | - |
1315 | - } else if ( elem.currentStyle ) { |
1316 | - var camelCase = name.replace(/\-(\w)/g, function(all, letter){ |
1317 | - return letter.toUpperCase(); |
1318 | - }); |
1319 | - |
1320 | - ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; |
1321 | - |
1322 | - // From the awesome hack by Dean Edwards |
1323 | - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
1324 | - |
1325 | - // If we're not dealing with a regular pixel number |
1326 | - // but a number that has a weird ending, we need to convert it to pixels |
1327 | - if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { |
1328 | - // Remember the original values |
1329 | - var left = style.left, rsLeft = elem.runtimeStyle.left; |
1330 | - |
1331 | - // Put in the new values to get a computed value out |
1332 | - elem.runtimeStyle.left = elem.currentStyle.left; |
1333 | - style.left = ret || 0; |
1334 | - ret = style.pixelLeft + "px"; |
1335 | - |
1336 | - // Revert the changed values |
1337 | - style.left = left; |
1338 | - elem.runtimeStyle.left = rsLeft; |
1339 | - } |
1340 | - } |
1341 | - |
1342 | - return ret; |
1343 | - }, |
1344 | - |
1345 | - clean: function( elems, context, fragment ) { |
1346 | - context = context || document; |
1347 | - |
1348 | - // !context.createElement fails in IE with an error but returns typeof 'object' |
1349 | - if ( typeof context.createElement === "undefined" ) |
1350 | - context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
1351 | - |
1352 | - // If a single string is passed in and it's a single tag |
1353 | - // just do a createElement and skip the rest |
1354 | - if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { |
1355 | - var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); |
1356 | - if ( match ) |
1357 | - return [ context.createElement( match[1] ) ]; |
1358 | - } |
1359 | - |
1360 | - var ret = [], scripts = [], div = context.createElement("div"); |
1361 | - |
1362 | - jQuery.each(elems, function(i, elem){ |
1363 | - if ( typeof elem === "number" ) |
1364 | - elem += ''; |
1365 | - |
1366 | - if ( !elem ) |
1367 | - return; |
1368 | - |
1369 | - // Convert html string into DOM nodes |
1370 | - if ( typeof elem === "string" ) { |
1371 | - // Fix "XHTML"-style tags in all browsers |
1372 | - elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ |
1373 | - return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? |
1374 | - all : |
1375 | - front + "></" + tag + ">"; |
1376 | - }); |
1377 | - |
1378 | - // Trim whitespace, otherwise indexOf won't work as expected |
1379 | - var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); |
1380 | - |
1381 | - var wrap = |
1382 | - // option or optgroup |
1383 | - !tags.indexOf("<opt") && |
1384 | - [ 1, "<select multiple='multiple'>", "</select>" ] || |
1385 | - |
1386 | - !tags.indexOf("<leg") && |
1387 | - [ 1, "<fieldset>", "</fieldset>" ] || |
1388 | - |
1389 | - tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && |
1390 | - [ 1, "<table>", "</table>" ] || |
1391 | - |
1392 | - !tags.indexOf("<tr") && |
1393 | - [ 2, "<table><tbody>", "</tbody></table>" ] || |
1394 | - |
1395 | - // <thead> matched above |
1396 | - (!tags.indexOf("<td") || !tags.indexOf("<th")) && |
1397 | - [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] || |
1398 | - |
1399 | - !tags.indexOf("<col") && |
1400 | - [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] || |
1401 | - |
1402 | - // IE can't serialize <link> and <script> tags normally |
1403 | - !jQuery.support.htmlSerialize && |
1404 | - [ 1, "div<div>", "</div>" ] || |
1405 | - |
1406 | - [ 0, "", "" ]; |
1407 | - |
1408 | - // Go to html and back, then peel off extra wrappers |
1409 | - div.innerHTML = wrap[1] + elem + wrap[2]; |
1410 | - |
1411 | - // Move to the right depth |
1412 | - while ( wrap[0]-- ) |
1413 | - div = div.lastChild; |
1414 | - |
1415 | - // Remove IE's autoinserted <tbody> from table fragments |
1416 | - if ( !jQuery.support.tbody ) { |
1417 | - |
1418 | - // String was a <table>, *may* have spurious <tbody> |
1419 | - var hasBody = /<tbody/i.test(elem), |
1420 | - tbody = !tags.indexOf("<table") && !hasBody ? |
1421 | - div.firstChild && div.firstChild.childNodes : |
1422 | - |
1423 | - // String was a bare <thead> or <tfoot> |
1424 | - wrap[1] == "<table>" && !hasBody ? |
1425 | - div.childNodes : |
1426 | - []; |
1427 | - |
1428 | - for ( var j = tbody.length - 1; j >= 0 ; --j ) |
1429 | - if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) |
1430 | - tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
1431 | - |
1432 | - } |
1433 | - |
1434 | - // IE completely kills leading whitespace when innerHTML is used |
1435 | - if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) ) |
1436 | - div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); |
1437 | - |
1438 | - elem = jQuery.makeArray( div.childNodes ); |
1439 | - } |
1440 | - |
1441 | - if ( elem.nodeType ) |
1442 | - ret.push( elem ); |
1443 | - else |
1444 | - ret = jQuery.merge( ret, elem ); |
1445 | - |
1446 | - }); |
1447 | - |
1448 | - if ( fragment ) { |
1449 | - for ( var i = 0; ret[i]; i++ ) { |
1450 | - if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
1451 | - scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
1452 | - } else { |
1453 | - if ( ret[i].nodeType === 1 ) |
1454 | - ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
1455 | - fragment.appendChild( ret[i] ); |
1456 | - } |
1457 | - } |
1458 | - |
1459 | - return scripts; |
1460 | - } |
1461 | - |
1462 | - return ret; |
1463 | - }, |
1464 | - |
1465 | - attr: function( elem, name, value ) { |
1466 | - // don't set attributes on text and comment nodes |
1467 | - if (!elem || elem.nodeType == 3 || elem.nodeType == 8) |
1468 | - return undefined; |
1469 | - |
1470 | - var notxml = !jQuery.isXMLDoc( elem ), |
1471 | - // Whether we are setting (or getting) |
1472 | - set = value !== undefined; |
1473 | - |
1474 | - // Try to normalize/fix the name |
1475 | - name = notxml && jQuery.props[ name ] || name; |
1476 | - |
1477 | - // Only do all the following if this is a node (faster for style) |
1478 | - // IE elem.getAttribute passes even for style |
1479 | - if ( elem.tagName ) { |
1480 | - |
1481 | - // These attributes require special treatment |
1482 | - var special = /href|src|style/.test( name ); |
1483 | - |
1484 | - // Safari mis-reports the default selected property of a hidden option |
1485 | - // Accessing the parent's selectedIndex property fixes it |
1486 | - if ( name == "selected" && elem.parentNode ) |
1487 | - elem.parentNode.selectedIndex; |
1488 | - |
1489 | - // If applicable, access the attribute via the DOM 0 way |
1490 | - if ( name in elem && notxml && !special ) { |
1491 | - if ( set ){ |
1492 | - // We can't allow the type property to be changed (since it causes problems in IE) |
1493 | - if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode ) |
1494 | - throw "type property can't be changed"; |
1495 | - |
1496 | - elem[ name ] = value; |
1497 | - } |
1498 | - |
1499 | - // browsers index elements by id/name on forms, give priority to attributes. |
1500 | - if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) |
1501 | - return elem.getAttributeNode( name ).nodeValue; |
1502 | - |
1503 | - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
1504 | - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
1505 | - if ( name == "tabIndex" ) { |
1506 | - var attributeNode = elem.getAttributeNode( "tabIndex" ); |
1507 | - return attributeNode && attributeNode.specified |
1508 | - ? attributeNode.value |
1509 | - : elem.nodeName.match(/(button|input|object|select|textarea)/i) |
1510 | - ? 0 |
1511 | - : elem.nodeName.match(/^(a|area)$/i) && elem.href |
1512 | - ? 0 |
1513 | - : undefined; |
1514 | - } |
1515 | - |
1516 | - return elem[ name ]; |
1517 | - } |
1518 | - |
1519 | - if ( !jQuery.support.style && notxml && name == "style" ) |
1520 | - return jQuery.attr( elem.style, "cssText", value ); |
1521 | - |
1522 | - if ( set ) |
1523 | - // convert the value to a string (all browsers do this but IE) see #1070 |
1524 | - elem.setAttribute( name, "" + value ); |
1525 | - |
1526 | - var attr = !jQuery.support.hrefNormalized && notxml && special |
1527 | - // Some attributes require a special call on IE |
1528 | - ? elem.getAttribute( name, 2 ) |
1529 | - : elem.getAttribute( name ); |
1530 | - |
1531 | - // Non-existent attributes return null, we normalize to undefined |
1532 | - return attr === null ? undefined : attr; |
1533 | - } |
1534 | - |
1535 | - // elem is actually elem.style ... set the style |
1536 | - |
1537 | - // IE uses filters for opacity |
1538 | - if ( !jQuery.support.opacity && name == "opacity" ) { |
1539 | - if ( set ) { |
1540 | - // IE has trouble with opacity if it does not have layout |
1541 | - // Force it by setting the zoom level |
1542 | - elem.zoom = 1; |
1543 | - |
1544 | - // Set the alpha filter to set the opacity |
1545 | - elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) + |
1546 | - (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")"); |
1547 | - } |
1548 | - |
1549 | - return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? |
1550 | - (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '': |
1551 | - ""; |
1552 | - } |
1553 | - |
1554 | - name = name.replace(/-([a-z])/ig, function(all, letter){ |
1555 | - return letter.toUpperCase(); |
1556 | - }); |
1557 | - |
1558 | - if ( set ) |
1559 | - elem[ name ] = value; |
1560 | - |
1561 | - return elem[ name ]; |
1562 | - }, |
1563 | - |
1564 | - trim: function( text ) { |
1565 | - return (text || "").replace( /^\s+|\s+$/g, "" ); |
1566 | - }, |
1567 | - |
1568 | - makeArray: function( array ) { |
1569 | - var ret = []; |
1570 | - |
1571 | - if( array != null ){ |
1572 | - var i = array.length; |
1573 | + // Use native String.trim function wherever possible |
1574 | + trim: trim ? |
1575 | + function( text ) { |
1576 | + return text == null ? |
1577 | + "" : |
1578 | + trim.call( text ); |
1579 | + } : |
1580 | + |
1581 | + // Otherwise use our own trimming functionality |
1582 | + function( text ) { |
1583 | + return text == null ? |
1584 | + "" : |
1585 | + text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); |
1586 | + }, |
1587 | + |
1588 | + // results is for internal usage only |
1589 | + makeArray: function( array, results ) { |
1590 | + var ret = results || []; |
1591 | + |
1592 | + if ( array != null ) { |
1593 | // The window, strings (and functions) also have 'length' |
1594 | - if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) |
1595 | - ret[0] = array; |
1596 | - else |
1597 | - while( i ) |
1598 | - ret[--i] = array[i]; |
1599 | + // The extra typeof function check is to prevent crashes |
1600 | + // in Safari 2 (See: #3039) |
1601 | + // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 |
1602 | + var type = jQuery.type( array ); |
1603 | + |
1604 | + if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { |
1605 | + push.call( ret, array ); |
1606 | + } else { |
1607 | + jQuery.merge( ret, array ); |
1608 | + } |
1609 | } |
1610 | |
1611 | return ret; |
1612 | }, |
1613 | |
1614 | inArray: function( elem, array ) { |
1615 | - for ( var i = 0, length = array.length; i < length; i++ ) |
1616 | - // Use === because on IE, window == document |
1617 | - if ( array[ i ] === elem ) |
1618 | + |
1619 | + if ( indexOf ) { |
1620 | + return indexOf.call( array, elem ); |
1621 | + } |
1622 | + |
1623 | + for ( var i = 0, length = array.length; i < length; i++ ) { |
1624 | + if ( array[ i ] === elem ) { |
1625 | return i; |
1626 | + } |
1627 | + } |
1628 | |
1629 | return -1; |
1630 | }, |
1631 | |
1632 | merge: function( first, second ) { |
1633 | - // We have to loop this way because IE & Opera overwrite the length |
1634 | - // expando of getElementsByTagName |
1635 | - var i = 0, elem, pos = first.length; |
1636 | - // Also, we need to make sure that the correct elements are being returned |
1637 | - // (IE returns comment nodes in a '*' query) |
1638 | - if ( !jQuery.support.getAll ) { |
1639 | - while ( (elem = second[ i++ ]) != null ) |
1640 | - if ( elem.nodeType != 8 ) |
1641 | - first[ pos++ ] = elem; |
1642 | - |
1643 | - } else |
1644 | - while ( (elem = second[ i++ ]) != null ) |
1645 | - first[ pos++ ] = elem; |
1646 | + var i = first.length, |
1647 | + j = 0; |
1648 | + |
1649 | + if ( typeof second.length === "number" ) { |
1650 | + for ( var l = second.length; j < l; j++ ) { |
1651 | + first[ i++ ] = second[ j ]; |
1652 | + } |
1653 | + |
1654 | + } else { |
1655 | + while ( second[j] !== undefined ) { |
1656 | + first[ i++ ] = second[ j++ ]; |
1657 | + } |
1658 | + } |
1659 | + |
1660 | + first.length = i; |
1661 | |
1662 | return first; |
1663 | }, |
1664 | |
1665 | - unique: function( array ) { |
1666 | - var ret = [], done = {}; |
1667 | - |
1668 | - try { |
1669 | - |
1670 | - for ( var i = 0, length = array.length; i < length; i++ ) { |
1671 | - var id = jQuery.data( array[ i ] ); |
1672 | - |
1673 | - if ( !done[ id ] ) { |
1674 | - done[ id ] = true; |
1675 | - ret.push( array[ i ] ); |
1676 | - } |
1677 | - } |
1678 | - |
1679 | - } catch( e ) { |
1680 | - ret = array; |
1681 | - } |
1682 | - |
1683 | - return ret; |
1684 | - }, |
1685 | - |
1686 | grep: function( elems, callback, inv ) { |
1687 | - var ret = []; |
1688 | + var ret = [], retVal; |
1689 | + inv = !!inv; |
1690 | |
1691 | // Go through the array, only saving the items |
1692 | // that pass the validator function |
1693 | - for ( var i = 0, length = elems.length; i < length; i++ ) |
1694 | - if ( !inv != !callback( elems[ i ], i ) ) |
1695 | + for ( var i = 0, length = elems.length; i < length; i++ ) { |
1696 | + retVal = !!callback( elems[ i ], i ); |
1697 | + if ( inv !== retVal ) { |
1698 | ret.push( elems[ i ] ); |
1699 | + } |
1700 | + } |
1701 | |
1702 | return ret; |
1703 | }, |
1704 | |
1705 | - map: function( elems, callback ) { |
1706 | - var ret = []; |
1707 | + // arg is for internal usage only |
1708 | + map: function( elems, callback, arg ) { |
1709 | + var value, key, ret = [], |
1710 | + i = 0, |
1711 | + length = elems.length, |
1712 | + // jquery objects are treated as arrays |
1713 | + isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; |
1714 | |
1715 | // Go through the array, translating each of the items to their |
1716 | - // new value (or values). |
1717 | - for ( var i = 0, length = elems.length; i < length; i++ ) { |
1718 | - var value = callback( elems[ i ], i ); |
1719 | - |
1720 | - if ( value != null ) |
1721 | - ret[ ret.length ] = value; |
1722 | + if ( isArray ) { |
1723 | + for ( ; i < length; i++ ) { |
1724 | + value = callback( elems[ i ], i, arg ); |
1725 | + |
1726 | + if ( value != null ) { |
1727 | + ret[ ret.length ] = value; |
1728 | + } |
1729 | + } |
1730 | + |
1731 | + // Go through every key on the object, |
1732 | + } else { |
1733 | + for ( key in elems ) { |
1734 | + value = callback( elems[ key ], key, arg ); |
1735 | + |
1736 | + if ( value != null ) { |
1737 | + ret[ ret.length ] = value; |
1738 | + } |
1739 | + } |
1740 | } |
1741 | |
1742 | + // Flatten any nested arrays |
1743 | return ret.concat.apply( [], ret ); |
1744 | - } |
1745 | -}); |
1746 | - |
1747 | -// Use of jQuery.browser is deprecated. |
1748 | -// It's included for backwards compatibility and plugins, |
1749 | -// although they should work to migrate away. |
1750 | - |
1751 | -var userAgent = navigator.userAgent.toLowerCase(); |
1752 | - |
1753 | -// Figure out what browser is being used |
1754 | -jQuery.browser = { |
1755 | - version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
1756 | - safari: /webkit/.test( userAgent ), |
1757 | - opera: /opera/.test( userAgent ), |
1758 | - msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
1759 | - mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
1760 | -}; |
1761 | - |
1762 | -jQuery.each({ |
1763 | - parent: function(elem){return elem.parentNode;}, |
1764 | - parents: function(elem){return jQuery.dir(elem,"parentNode");}, |
1765 | - next: function(elem){return jQuery.nth(elem,2,"nextSibling");}, |
1766 | - prev: function(elem){return jQuery.nth(elem,2,"previousSibling");}, |
1767 | - nextAll: function(elem){return jQuery.dir(elem,"nextSibling");}, |
1768 | - prevAll: function(elem){return jQuery.dir(elem,"previousSibling");}, |
1769 | - siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);}, |
1770 | - children: function(elem){return jQuery.sibling(elem.firstChild);}, |
1771 | - contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);} |
1772 | -}, function(name, fn){ |
1773 | - jQuery.fn[ name ] = function( selector ) { |
1774 | - var ret = jQuery.map( this, fn ); |
1775 | - |
1776 | - if ( selector && typeof selector == "string" ) |
1777 | - ret = jQuery.multiFilter( selector, ret ); |
1778 | - |
1779 | - return this.pushStack( jQuery.unique( ret ), name, selector ); |
1780 | - }; |
1781 | -}); |
1782 | - |
1783 | -jQuery.each({ |
1784 | - appendTo: "append", |
1785 | - prependTo: "prepend", |
1786 | - insertBefore: "before", |
1787 | - insertAfter: "after", |
1788 | - replaceAll: "replaceWith" |
1789 | -}, function(name, original){ |
1790 | - jQuery.fn[ name ] = function( selector ) { |
1791 | - var ret = [], insert = jQuery( selector ); |
1792 | - |
1793 | - for ( var i = 0, l = insert.length; i < l; i++ ) { |
1794 | - var elems = (i > 0 ? this.clone(true) : this).get(); |
1795 | - jQuery.fn[ original ].apply( jQuery(insert[i]), elems ); |
1796 | - ret = ret.concat( elems ); |
1797 | - } |
1798 | - |
1799 | - return this.pushStack( ret, name, selector ); |
1800 | - }; |
1801 | -}); |
1802 | - |
1803 | -jQuery.each({ |
1804 | - removeAttr: function( name ) { |
1805 | - jQuery.attr( this, name, "" ); |
1806 | - if (this.nodeType == 1) |
1807 | - this.removeAttribute( name ); |
1808 | - }, |
1809 | - |
1810 | - addClass: function( classNames ) { |
1811 | - jQuery.className.add( this, classNames ); |
1812 | - }, |
1813 | - |
1814 | - removeClass: function( classNames ) { |
1815 | - jQuery.className.remove( this, classNames ); |
1816 | - }, |
1817 | - |
1818 | - toggleClass: function( classNames, state ) { |
1819 | - if( typeof state !== "boolean" ) |
1820 | - state = !jQuery.className.has( this, classNames ); |
1821 | - jQuery.className[ state ? "add" : "remove" ]( this, classNames ); |
1822 | - }, |
1823 | - |
1824 | - remove: function( selector ) { |
1825 | - if ( !selector || jQuery.filter( selector, [ this ] ).length ) { |
1826 | - // Prevent memory leaks |
1827 | - jQuery( "*", this ).add([this]).each(function(){ |
1828 | - jQuery.event.remove(this); |
1829 | - jQuery.removeData(this); |
1830 | - }); |
1831 | - if (this.parentNode) |
1832 | - this.parentNode.removeChild( this ); |
1833 | - } |
1834 | - }, |
1835 | - |
1836 | - empty: function() { |
1837 | - // Remove element nodes and prevent memory leaks |
1838 | - jQuery(this).children().remove(); |
1839 | - |
1840 | - // Remove any remaining nodes |
1841 | - while ( this.firstChild ) |
1842 | - this.removeChild( this.firstChild ); |
1843 | - } |
1844 | -}, function(name, fn){ |
1845 | - jQuery.fn[ name ] = function(){ |
1846 | - return this.each( fn, arguments ); |
1847 | - }; |
1848 | -}); |
1849 | - |
1850 | -// Helper function used by the dimensions and offset modules |
1851 | -function num(elem, prop) { |
1852 | - return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; |
1853 | -} |
1854 | -var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
1855 | + }, |
1856 | + |
1857 | + // A global GUID counter for objects |
1858 | + guid: 1, |
1859 | + |
1860 | + // Bind a function to a context, optionally partially applying any |
1861 | + // arguments. |
1862 | + proxy: function( fn, context ) { |
1863 | + if ( typeof context === "string" ) { |
1864 | + var tmp = fn[ context ]; |
1865 | + context = fn; |
1866 | + fn = tmp; |
1867 | + } |
1868 | + |
1869 | + // Quick check to determine if target is callable, in the spec |
1870 | + // this throws a TypeError, but we will just return undefined. |
1871 | + if ( !jQuery.isFunction( fn ) ) { |
1872 | + return undefined; |
1873 | + } |
1874 | + |
1875 | + // Simulated bind |
1876 | + var args = slice.call( arguments, 2 ), |
1877 | + proxy = function() { |
1878 | + return fn.apply( context, args.concat( slice.call( arguments ) ) ); |
1879 | + }; |
1880 | + |
1881 | + // Set the guid of unique handler to the same of original handler, so it can be removed |
1882 | + proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
1883 | + |
1884 | + return proxy; |
1885 | + }, |
1886 | + |
1887 | + // Mutifunctional method to get and set values to a collection |
1888 | + // The value/s can optionally be executed if it's a function |
1889 | + access: function( elems, key, value, exec, fn, pass ) { |
1890 | + var length = elems.length; |
1891 | + |
1892 | + // Setting many attributes |
1893 | + if ( typeof key === "object" ) { |
1894 | + for ( var k in key ) { |
1895 | + jQuery.access( elems, k, key[k], exec, fn, value ); |
1896 | + } |
1897 | + return elems; |
1898 | + } |
1899 | + |
1900 | + // Setting one attribute |
1901 | + if ( value !== undefined ) { |
1902 | + // Optionally, function values get executed if exec is true |
1903 | + exec = !pass && exec && jQuery.isFunction(value); |
1904 | + |
1905 | + for ( var i = 0; i < length; i++ ) { |
1906 | + fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); |
1907 | + } |
1908 | + |
1909 | + return elems; |
1910 | + } |
1911 | + |
1912 | + // Getting an attribute |
1913 | + return length ? fn( elems[0], key ) : undefined; |
1914 | + }, |
1915 | + |
1916 | + now: function() { |
1917 | + return (new Date()).getTime(); |
1918 | + }, |
1919 | + |
1920 | + // Use of jQuery.browser is frowned upon. |
1921 | + // More details: http://docs.jquery.com/Utilities/jQuery.browser |
1922 | + uaMatch: function( ua ) { |
1923 | + ua = ua.toLowerCase(); |
1924 | + |
1925 | + var match = rwebkit.exec( ua ) || |
1926 | + ropera.exec( ua ) || |
1927 | + rmsie.exec( ua ) || |
1928 | + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || |
1929 | + []; |
1930 | + |
1931 | + return { browser: match[1] || "", version: match[2] || "0" }; |
1932 | + }, |
1933 | + |
1934 | + sub: function() { |
1935 | + function jQuerySub( selector, context ) { |
1936 | + return new jQuerySub.fn.init( selector, context ); |
1937 | + } |
1938 | + jQuery.extend( true, jQuerySub, this ); |
1939 | + jQuerySub.superclass = this; |
1940 | + jQuerySub.fn = jQuerySub.prototype = this(); |
1941 | + jQuerySub.fn.constructor = jQuerySub; |
1942 | + jQuerySub.sub = this.sub; |
1943 | + jQuerySub.fn.init = function init( selector, context ) { |
1944 | + if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { |
1945 | + context = jQuerySub( context ); |
1946 | + } |
1947 | + |
1948 | + return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); |
1949 | + }; |
1950 | + jQuerySub.fn.init.prototype = jQuerySub.fn; |
1951 | + var rootjQuerySub = jQuerySub(document); |
1952 | + return jQuerySub; |
1953 | + }, |
1954 | + |
1955 | + browser: {} |
1956 | +}); |
1957 | + |
1958 | +// Populate the class2type map |
1959 | +jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { |
1960 | + class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
1961 | +}); |
1962 | + |
1963 | +browserMatch = jQuery.uaMatch( userAgent ); |
1964 | +if ( browserMatch.browser ) { |
1965 | + jQuery.browser[ browserMatch.browser ] = true; |
1966 | + jQuery.browser.version = browserMatch.version; |
1967 | +} |
1968 | + |
1969 | +// Deprecated, use jQuery.browser.webkit instead |
1970 | +if ( jQuery.browser.webkit ) { |
1971 | + jQuery.browser.safari = true; |
1972 | +} |
1973 | + |
1974 | +// IE doesn't match non-breaking spaces with \s |
1975 | +if ( rnotwhite.test( "\xA0" ) ) { |
1976 | + trimLeft = /^[\s\xA0]+/; |
1977 | + trimRight = /[\s\xA0]+$/; |
1978 | +} |
1979 | + |
1980 | +// All jQuery objects should point back to these |
1981 | +rootjQuery = jQuery(document); |
1982 | + |
1983 | +// Cleanup functions for the document ready method |
1984 | +if ( document.addEventListener ) { |
1985 | + DOMContentLoaded = function() { |
1986 | + document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
1987 | + jQuery.ready(); |
1988 | + }; |
1989 | + |
1990 | +} else if ( document.attachEvent ) { |
1991 | + DOMContentLoaded = function() { |
1992 | + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
1993 | + if ( document.readyState === "complete" ) { |
1994 | + document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
1995 | + jQuery.ready(); |
1996 | + } |
1997 | + }; |
1998 | +} |
1999 | + |
2000 | +// The DOM ready check for Internet Explorer |
2001 | +function doScrollCheck() { |
2002 | + if ( jQuery.isReady ) { |
2003 | + return; |
2004 | + } |
2005 | + |
2006 | + try { |
2007 | + // If IE is used, use the trick by Diego Perini |
2008 | + // http://javascript.nwbox.com/IEContentLoaded/ |
2009 | + document.documentElement.doScroll("left"); |
2010 | + } catch(e) { |
2011 | + setTimeout( doScrollCheck, 1 ); |
2012 | + return; |
2013 | + } |
2014 | + |
2015 | + // and execute any waiting functions |
2016 | + jQuery.ready(); |
2017 | +} |
2018 | + |
2019 | +return jQuery; |
2020 | + |
2021 | +})(); |
2022 | + |
2023 | + |
2024 | +var // Promise methods |
2025 | + promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), |
2026 | + // Static reference to slice |
2027 | + sliceDeferred = [].slice; |
2028 | + |
2029 | +jQuery.extend({ |
2030 | + // Create a simple deferred (one callbacks list) |
2031 | + _Deferred: function() { |
2032 | + var // callbacks list |
2033 | + callbacks = [], |
2034 | + // stored [ context , args ] |
2035 | + fired, |
2036 | + // to avoid firing when already doing so |
2037 | + firing, |
2038 | + // flag to know if the deferred has been cancelled |
2039 | + cancelled, |
2040 | + // the deferred itself |
2041 | + deferred = { |
2042 | + |
2043 | + // done( f1, f2, ...) |
2044 | + done: function() { |
2045 | + if ( !cancelled ) { |
2046 | + var args = arguments, |
2047 | + i, |
2048 | + length, |
2049 | + elem, |
2050 | + type, |
2051 | + _fired; |
2052 | + if ( fired ) { |
2053 | + _fired = fired; |
2054 | + fired = 0; |
2055 | + } |
2056 | + for ( i = 0, length = args.length; i < length; i++ ) { |
2057 | + elem = args[ i ]; |
2058 | + type = jQuery.type( elem ); |
2059 | + if ( type === "array" ) { |
2060 | + deferred.done.apply( deferred, elem ); |
2061 | + } else if ( type === "function" ) { |
2062 | + callbacks.push( elem ); |
2063 | + } |
2064 | + } |
2065 | + if ( _fired ) { |
2066 | + deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); |
2067 | + } |
2068 | + } |
2069 | + return this; |
2070 | + }, |
2071 | + |
2072 | + // resolve with given context and args |
2073 | + resolveWith: function( context, args ) { |
2074 | + if ( !cancelled && !fired && !firing ) { |
2075 | + // make sure args are available (#8421) |
2076 | + args = args || []; |
2077 | + firing = 1; |
2078 | + try { |
2079 | + while( callbacks[ 0 ] ) { |
2080 | + callbacks.shift().apply( context, args ); |
2081 | + } |
2082 | + } |
2083 | + finally { |
2084 | + fired = [ context, args ]; |
2085 | + firing = 0; |
2086 | + } |
2087 | + } |
2088 | + return this; |
2089 | + }, |
2090 | + |
2091 | + // resolve with this as context and given arguments |
2092 | + resolve: function() { |
2093 | + deferred.resolveWith( this, arguments ); |
2094 | + return this; |
2095 | + }, |
2096 | + |
2097 | + // Has this deferred been resolved? |
2098 | + isResolved: function() { |
2099 | + return !!( firing || fired ); |
2100 | + }, |
2101 | + |
2102 | + // Cancel |
2103 | + cancel: function() { |
2104 | + cancelled = 1; |
2105 | + callbacks = []; |
2106 | + return this; |
2107 | + } |
2108 | + }; |
2109 | + |
2110 | + return deferred; |
2111 | + }, |
2112 | + |
2113 | + // Full fledged deferred (two callbacks list) |
2114 | + Deferred: function( func ) { |
2115 | + var deferred = jQuery._Deferred(), |
2116 | + failDeferred = jQuery._Deferred(), |
2117 | + promise; |
2118 | + // Add errorDeferred methods, then and promise |
2119 | + jQuery.extend( deferred, { |
2120 | + then: function( doneCallbacks, failCallbacks ) { |
2121 | + deferred.done( doneCallbacks ).fail( failCallbacks ); |
2122 | + return this; |
2123 | + }, |
2124 | + always: function() { |
2125 | + return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); |
2126 | + }, |
2127 | + fail: failDeferred.done, |
2128 | + rejectWith: failDeferred.resolveWith, |
2129 | + reject: failDeferred.resolve, |
2130 | + isRejected: failDeferred.isResolved, |
2131 | + pipe: function( fnDone, fnFail ) { |
2132 | + return jQuery.Deferred(function( newDefer ) { |
2133 | + jQuery.each( { |
2134 | + done: [ fnDone, "resolve" ], |
2135 | + fail: [ fnFail, "reject" ] |
2136 | + }, function( handler, data ) { |
2137 | + var fn = data[ 0 ], |
2138 | + action = data[ 1 ], |
2139 | + returned; |
2140 | + if ( jQuery.isFunction( fn ) ) { |
2141 | + deferred[ handler ](function() { |
2142 | + returned = fn.apply( this, arguments ); |
2143 | + if ( returned && jQuery.isFunction( returned.promise ) ) { |
2144 | + returned.promise().then( newDefer.resolve, newDefer.reject ); |
2145 | + } else { |
2146 | + newDefer[ action ]( returned ); |
2147 | + } |
2148 | + }); |
2149 | + } else { |
2150 | + deferred[ handler ]( newDefer[ action ] ); |
2151 | + } |
2152 | + }); |
2153 | + }).promise(); |
2154 | + }, |
2155 | + // Get a promise for this deferred |
2156 | + // If obj is provided, the promise aspect is added to the object |
2157 | + promise: function( obj ) { |
2158 | + if ( obj == null ) { |
2159 | + if ( promise ) { |
2160 | + return promise; |
2161 | + } |
2162 | + promise = obj = {}; |
2163 | + } |
2164 | + var i = promiseMethods.length; |
2165 | + while( i-- ) { |
2166 | + obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; |
2167 | + } |
2168 | + return obj; |
2169 | + } |
2170 | + }); |
2171 | + // Make sure only one callback list will be used |
2172 | + deferred.done( failDeferred.cancel ).fail( deferred.cancel ); |
2173 | + // Unexpose cancel |
2174 | + delete deferred.cancel; |
2175 | + // Call given func if any |
2176 | + if ( func ) { |
2177 | + func.call( deferred, deferred ); |
2178 | + } |
2179 | + return deferred; |
2180 | + }, |
2181 | + |
2182 | + // Deferred helper |
2183 | + when: function( firstParam ) { |
2184 | + var args = arguments, |
2185 | + i = 0, |
2186 | + length = args.length, |
2187 | + count = length, |
2188 | + deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? |
2189 | + firstParam : |
2190 | + jQuery.Deferred(); |
2191 | + function resolveFunc( i ) { |
2192 | + return function( value ) { |
2193 | + args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; |
2194 | + if ( !( --count ) ) { |
2195 | + // Strange bug in FF4: |
2196 | + // Values changed onto the arguments object sometimes end up as undefined values |
2197 | + // outside the $.when method. Cloning the object into a fresh array solves the issue |
2198 | + deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); |
2199 | + } |
2200 | + }; |
2201 | + } |
2202 | + if ( length > 1 ) { |
2203 | + for( ; i < length; i++ ) { |
2204 | + if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { |
2205 | + args[ i ].promise().then( resolveFunc(i), deferred.reject ); |
2206 | + } else { |
2207 | + --count; |
2208 | + } |
2209 | + } |
2210 | + if ( !count ) { |
2211 | + deferred.resolveWith( deferred, args ); |
2212 | + } |
2213 | + } else if ( deferred !== firstParam ) { |
2214 | + deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); |
2215 | + } |
2216 | + return deferred.promise(); |
2217 | + } |
2218 | +}); |
2219 | + |
2220 | + |
2221 | + |
2222 | +jQuery.support = (function() { |
2223 | + |
2224 | + var div = document.createElement( "div" ), |
2225 | + documentElement = document.documentElement, |
2226 | + all, |
2227 | + a, |
2228 | + select, |
2229 | + opt, |
2230 | + input, |
2231 | + marginDiv, |
2232 | + support, |
2233 | + fragment, |
2234 | + body, |
2235 | + testElementParent, |
2236 | + testElement, |
2237 | + testElementStyle, |
2238 | + tds, |
2239 | + events, |
2240 | + eventName, |
2241 | + i, |
2242 | + isSupported; |
2243 | + |
2244 | + // Preliminary tests |
2245 | + div.setAttribute("className", "t"); |
2246 | + div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
2247 | + |
2248 | + all = div.getElementsByTagName( "*" ); |
2249 | + a = div.getElementsByTagName( "a" )[ 0 ]; |
2250 | + |
2251 | + // Can't get basic test support |
2252 | + if ( !all || !all.length || !a ) { |
2253 | + return {}; |
2254 | + } |
2255 | + |
2256 | + // First batch of supports tests |
2257 | + select = document.createElement( "select" ); |
2258 | + opt = select.appendChild( document.createElement("option") ); |
2259 | + input = div.getElementsByTagName( "input" )[ 0 ]; |
2260 | + |
2261 | + support = { |
2262 | + // IE strips leading whitespace when .innerHTML is used |
2263 | + leadingWhitespace: ( div.firstChild.nodeType === 3 ), |
2264 | + |
2265 | + // Make sure that tbody elements aren't automatically inserted |
2266 | + // IE will insert them into empty tables |
2267 | + tbody: !div.getElementsByTagName( "tbody" ).length, |
2268 | + |
2269 | + // Make sure that link elements get serialized correctly by innerHTML |
2270 | + // This requires a wrapper element in IE |
2271 | + htmlSerialize: !!div.getElementsByTagName( "link" ).length, |
2272 | + |
2273 | + // Get the style information from getAttribute |
2274 | + // (IE uses .cssText instead) |
2275 | + style: /top/.test( a.getAttribute("style") ), |
2276 | + |
2277 | + // Make sure that URLs aren't manipulated |
2278 | + // (IE normalizes it by default) |
2279 | + hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), |
2280 | + |
2281 | + // Make sure that element opacity exists |
2282 | + // (IE uses filter instead) |
2283 | + // Use a regex to work around a WebKit issue. See #5145 |
2284 | + opacity: /^0.55$/.test( a.style.opacity ), |
2285 | + |
2286 | + // Verify style float existence |
2287 | + // (IE uses styleFloat instead of cssFloat) |
2288 | + cssFloat: !!a.style.cssFloat, |
2289 | + |
2290 | + // Make sure that if no value is specified for a checkbox |
2291 | + // that it defaults to "on". |
2292 | + // (WebKit defaults to "" instead) |
2293 | + checkOn: ( input.value === "on" ), |
2294 | + |
2295 | + // Make sure that a selected-by-default option has a working selected property. |
2296 | + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
2297 | + optSelected: opt.selected, |
2298 | + |
2299 | + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
2300 | + getSetAttribute: div.className !== "t", |
2301 | + |
2302 | + // Will be defined later |
2303 | + submitBubbles: true, |
2304 | + changeBubbles: true, |
2305 | + focusinBubbles: false, |
2306 | + deleteExpando: true, |
2307 | + noCloneEvent: true, |
2308 | + inlineBlockNeedsLayout: false, |
2309 | + shrinkWrapBlocks: false, |
2310 | + reliableMarginRight: true |
2311 | + }; |
2312 | + |
2313 | + // Make sure checked status is properly cloned |
2314 | + input.checked = true; |
2315 | + support.noCloneChecked = input.cloneNode( true ).checked; |
2316 | + |
2317 | + // Make sure that the options inside disabled selects aren't marked as disabled |
2318 | + // (WebKit marks them as disabled) |
2319 | + select.disabled = true; |
2320 | + support.optDisabled = !opt.disabled; |
2321 | + |
2322 | + // Test to see if it's possible to delete an expando from an element |
2323 | + // Fails in Internet Explorer |
2324 | + try { |
2325 | + delete div.test; |
2326 | + } catch( e ) { |
2327 | + support.deleteExpando = false; |
2328 | + } |
2329 | + |
2330 | + if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { |
2331 | + div.attachEvent( "onclick", function() { |
2332 | + // Cloning a node shouldn't copy over any |
2333 | + // bound event handlers (IE does this) |
2334 | + support.noCloneEvent = false; |
2335 | + }); |
2336 | + div.cloneNode( true ).fireEvent( "onclick" ); |
2337 | + } |
2338 | + |
2339 | + // Check if a radio maintains it's value |
2340 | + // after being appended to the DOM |
2341 | + input = document.createElement("input"); |
2342 | + input.value = "t"; |
2343 | + input.setAttribute("type", "radio"); |
2344 | + support.radioValue = input.value === "t"; |
2345 | + |
2346 | + input.setAttribute("checked", "checked"); |
2347 | + div.appendChild( input ); |
2348 | + fragment = document.createDocumentFragment(); |
2349 | + fragment.appendChild( div.firstChild ); |
2350 | + |
2351 | + // WebKit doesn't clone checked state correctly in fragments |
2352 | + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; |
2353 | + |
2354 | + div.innerHTML = ""; |
2355 | + |
2356 | + // Figure out if the W3C box model works as expected |
2357 | + div.style.width = div.style.paddingLeft = "1px"; |
2358 | + |
2359 | + body = document.getElementsByTagName( "body" )[ 0 ]; |
2360 | + // We use our own, invisible, body unless the body is already present |
2361 | + // in which case we use a div (#9239) |
2362 | + testElement = document.createElement( body ? "div" : "body" ); |
2363 | + testElementStyle = { |
2364 | + visibility: "hidden", |
2365 | + width: 0, |
2366 | + height: 0, |
2367 | + border: 0, |
2368 | + margin: 0 |
2369 | + }; |
2370 | + if ( body ) { |
2371 | + jQuery.extend( testElementStyle, { |
2372 | + position: "absolute", |
2373 | + left: -1000, |
2374 | + top: -1000 |
2375 | + }); |
2376 | + } |
2377 | + for ( i in testElementStyle ) { |
2378 | + testElement.style[ i ] = testElementStyle[ i ]; |
2379 | + } |
2380 | + testElement.appendChild( div ); |
2381 | + testElementParent = body || documentElement; |
2382 | + testElementParent.insertBefore( testElement, testElementParent.firstChild ); |
2383 | + |
2384 | + // Check if a disconnected checkbox will retain its checked |
2385 | + // value of true after appended to the DOM (IE6/7) |
2386 | + support.appendChecked = input.checked; |
2387 | + |
2388 | + support.boxModel = div.offsetWidth === 2; |
2389 | + |
2390 | + if ( "zoom" in div.style ) { |
2391 | + // Check if natively block-level elements act like inline-block |
2392 | + // elements when setting their display to 'inline' and giving |
2393 | + // them layout |
2394 | + // (IE < 8 does this) |
2395 | + div.style.display = "inline"; |
2396 | + div.style.zoom = 1; |
2397 | + support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); |
2398 | + |
2399 | + // Check if elements with layout shrink-wrap their children |
2400 | + // (IE 6 does this) |
2401 | + div.style.display = ""; |
2402 | + div.innerHTML = "<div style='width:4px;'></div>"; |
2403 | + support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); |
2404 | + } |
2405 | + |
2406 | + div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; |
2407 | + tds = div.getElementsByTagName( "td" ); |
2408 | + |
2409 | + // Check if table cells still have offsetWidth/Height when they are set |
2410 | + // to display:none and there are still other visible table cells in a |
2411 | + // table row; if so, offsetWidth/Height are not reliable for use when |
2412 | + // determining if an element has been hidden directly using |
2413 | + // display:none (it is still safe to use offsets if a parent element is |
2414 | + // hidden; don safety goggles and see bug #4512 for more information). |
2415 | + // (only IE 8 fails this test) |
2416 | + isSupported = ( tds[ 0 ].offsetHeight === 0 ); |
2417 | + |
2418 | + tds[ 0 ].style.display = ""; |
2419 | + tds[ 1 ].style.display = "none"; |
2420 | + |
2421 | + // Check if empty table cells still have offsetWidth/Height |
2422 | + // (IE < 8 fail this test) |
2423 | + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); |
2424 | + div.innerHTML = ""; |
2425 | + |
2426 | + // Check if div with explicit width and no margin-right incorrectly |
2427 | + // gets computed margin-right based on width of container. For more |
2428 | + // info see bug #3333 |
2429 | + // Fails in WebKit before Feb 2011 nightlies |
2430 | + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
2431 | + if ( document.defaultView && document.defaultView.getComputedStyle ) { |
2432 | + marginDiv = document.createElement( "div" ); |
2433 | + marginDiv.style.width = "0"; |
2434 | + marginDiv.style.marginRight = "0"; |
2435 | + div.appendChild( marginDiv ); |
2436 | + support.reliableMarginRight = |
2437 | + ( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; |
2438 | + } |
2439 | + |
2440 | + // Remove the body element we added |
2441 | + testElement.innerHTML = ""; |
2442 | + testElementParent.removeChild( testElement ); |
2443 | + |
2444 | + // Technique from Juriy Zaytsev |
2445 | + // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ |
2446 | + // We only care about the case where non-standard event systems |
2447 | + // are used, namely in IE. Short-circuiting here helps us to |
2448 | + // avoid an eval call (in setAttribute) which can cause CSP |
2449 | + // to go haywire. See: https://developer.mozilla.org/en/Security/CSP |
2450 | + if ( div.attachEvent ) { |
2451 | + for( i in { |
2452 | + submit: 1, |
2453 | + change: 1, |
2454 | + focusin: 1 |
2455 | + } ) { |
2456 | + eventName = "on" + i; |
2457 | + isSupported = ( eventName in div ); |
2458 | + if ( !isSupported ) { |
2459 | + div.setAttribute( eventName, "return;" ); |
2460 | + isSupported = ( typeof div[ eventName ] === "function" ); |
2461 | + } |
2462 | + support[ i + "Bubbles" ] = isSupported; |
2463 | + } |
2464 | + } |
2465 | + |
2466 | + // Null connected elements to avoid leaks in IE |
2467 | + testElement = fragment = select = opt = body = marginDiv = div = input = null; |
2468 | + |
2469 | + return support; |
2470 | +})(); |
2471 | + |
2472 | +// Keep track of boxModel |
2473 | +jQuery.boxModel = jQuery.support.boxModel; |
2474 | + |
2475 | + |
2476 | + |
2477 | + |
2478 | +var rbrace = /^(?:\{.*\}|\[.*\])$/, |
2479 | + rmultiDash = /([a-z])([A-Z])/g; |
2480 | |
2481 | jQuery.extend({ |
2482 | cache: {}, |
2483 | |
2484 | - data: function( elem, name, data ) { |
2485 | - elem = elem == window ? |
2486 | - windowData : |
2487 | - elem; |
2488 | - |
2489 | - var id = elem[ expando ]; |
2490 | - |
2491 | - // Compute a unique ID for the element |
2492 | - if ( !id ) |
2493 | - id = elem[ expando ] = ++uuid; |
2494 | - |
2495 | - // Only generate the data cache if we're |
2496 | - // trying to access or manipulate it |
2497 | - if ( name && !jQuery.cache[ id ] ) |
2498 | - jQuery.cache[ id ] = {}; |
2499 | - |
2500 | - // Prevent overriding the named cache with undefined values |
2501 | - if ( data !== undefined ) |
2502 | - jQuery.cache[ id ][ name ] = data; |
2503 | - |
2504 | - // Return the named cache data, or the ID for the element |
2505 | - return name ? |
2506 | - jQuery.cache[ id ][ name ] : |
2507 | - id; |
2508 | - }, |
2509 | - |
2510 | - removeData: function( elem, name ) { |
2511 | - elem = elem == window ? |
2512 | - windowData : |
2513 | - elem; |
2514 | - |
2515 | - var id = elem[ expando ]; |
2516 | - |
2517 | - // If we want to remove a specific section of the element's data |
2518 | + // Please use with caution |
2519 | + uuid: 0, |
2520 | + |
2521 | + // Unique for each copy of jQuery on the page |
2522 | + // Non-digits removed to match rinlinejQuery |
2523 | + expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), |
2524 | + |
2525 | + // The following elements throw uncatchable exceptions if you |
2526 | + // attempt to add expando properties to them. |
2527 | + noData: { |
2528 | + "embed": true, |
2529 | + // Ban all objects except for Flash (which handle expandos) |
2530 | + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", |
2531 | + "applet": true |
2532 | + }, |
2533 | + |
2534 | + hasData: function( elem ) { |
2535 | + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; |
2536 | + |
2537 | + return !!elem && !isEmptyDataObject( elem ); |
2538 | + }, |
2539 | + |
2540 | + data: function( elem, name, data, pvt /* Internal Use Only */ ) { |
2541 | + if ( !jQuery.acceptData( elem ) ) { |
2542 | + return; |
2543 | + } |
2544 | + |
2545 | + var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache, |
2546 | + |
2547 | + // We have to handle DOM nodes and JS objects differently because IE6-7 |
2548 | + // can't GC object references properly across the DOM-JS boundary |
2549 | + isNode = elem.nodeType, |
2550 | + |
2551 | + // Only DOM nodes need the global jQuery cache; JS object data is |
2552 | + // attached directly to the object so GC can occur automatically |
2553 | + cache = isNode ? jQuery.cache : elem, |
2554 | + |
2555 | + // Only defining an ID for JS objects if its cache already exists allows |
2556 | + // the code to shortcut on the same path as a DOM node with no cache |
2557 | + id = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando; |
2558 | + |
2559 | + // Avoid doing any more work than we need to when trying to get data on an |
2560 | + // object that has no data at all |
2561 | + if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) { |
2562 | + return; |
2563 | + } |
2564 | + |
2565 | + if ( !id ) { |
2566 | + // Only DOM nodes need a new unique ID for each element since their data |
2567 | + // ends up in the global cache |
2568 | + if ( isNode ) { |
2569 | + elem[ jQuery.expando ] = id = ++jQuery.uuid; |
2570 | + } else { |
2571 | + id = jQuery.expando; |
2572 | + } |
2573 | + } |
2574 | + |
2575 | + if ( !cache[ id ] ) { |
2576 | + cache[ id ] = {}; |
2577 | + |
2578 | + // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery |
2579 | + // metadata on plain JS objects when the object is serialized using |
2580 | + // JSON.stringify |
2581 | + if ( !isNode ) { |
2582 | + cache[ id ].toJSON = jQuery.noop; |
2583 | + } |
2584 | + } |
2585 | + |
2586 | + // An object can be passed to jQuery.data instead of a key/value pair; this gets |
2587 | + // shallow copied over onto the existing cache |
2588 | + if ( typeof name === "object" || typeof name === "function" ) { |
2589 | + if ( pvt ) { |
2590 | + cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); |
2591 | + } else { |
2592 | + cache[ id ] = jQuery.extend(cache[ id ], name); |
2593 | + } |
2594 | + } |
2595 | + |
2596 | + thisCache = cache[ id ]; |
2597 | + |
2598 | + // Internal jQuery data is stored in a separate object inside the object's data |
2599 | + // cache in order to avoid key collisions between internal data and user-defined |
2600 | + // data |
2601 | + if ( pvt ) { |
2602 | + if ( !thisCache[ internalKey ] ) { |
2603 | + thisCache[ internalKey ] = {}; |
2604 | + } |
2605 | + |
2606 | + thisCache = thisCache[ internalKey ]; |
2607 | + } |
2608 | + |
2609 | + if ( data !== undefined ) { |
2610 | + thisCache[ jQuery.camelCase( name ) ] = data; |
2611 | + } |
2612 | + |
2613 | + // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should |
2614 | + // not attempt to inspect the internal events object using jQuery.data, as this |
2615 | + // internal data object is undocumented and subject to change. |
2616 | + if ( name === "events" && !thisCache[name] ) { |
2617 | + return thisCache[ internalKey ] && thisCache[ internalKey ].events; |
2618 | + } |
2619 | + |
2620 | + return getByName ? |
2621 | + // Check for both converted-to-camel and non-converted data property names |
2622 | + thisCache[ jQuery.camelCase( name ) ] || thisCache[ name ] : |
2623 | + thisCache; |
2624 | + }, |
2625 | + |
2626 | + removeData: function( elem, name, pvt /* Internal Use Only */ ) { |
2627 | + if ( !jQuery.acceptData( elem ) ) { |
2628 | + return; |
2629 | + } |
2630 | + |
2631 | + var internalKey = jQuery.expando, isNode = elem.nodeType, |
2632 | + |
2633 | + // See jQuery.data for more information |
2634 | + cache = isNode ? jQuery.cache : elem, |
2635 | + |
2636 | + // See jQuery.data for more information |
2637 | + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
2638 | + |
2639 | + // If there is already no cache entry for this object, there is no |
2640 | + // purpose in continuing |
2641 | + if ( !cache[ id ] ) { |
2642 | + return; |
2643 | + } |
2644 | + |
2645 | if ( name ) { |
2646 | - if ( jQuery.cache[ id ] ) { |
2647 | - // Remove the section of cache data |
2648 | - delete jQuery.cache[ id ][ name ]; |
2649 | - |
2650 | - // If we've removed all the data, remove the element's cache |
2651 | - name = ""; |
2652 | - |
2653 | - for ( name in jQuery.cache[ id ] ) |
2654 | - break; |
2655 | - |
2656 | - if ( !name ) |
2657 | - jQuery.removeData( elem ); |
2658 | - } |
2659 | - |
2660 | - // Otherwise, we want to remove all of the element's data |
2661 | + var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ]; |
2662 | + |
2663 | + if ( thisCache ) { |
2664 | + delete thisCache[ name ]; |
2665 | + |
2666 | + // If there is no data left in the cache, we want to continue |
2667 | + // and let the cache object itself get destroyed |
2668 | + if ( !isEmptyDataObject(thisCache) ) { |
2669 | + return; |
2670 | + } |
2671 | + } |
2672 | + } |
2673 | + |
2674 | + // See jQuery.data for more information |
2675 | + if ( pvt ) { |
2676 | + delete cache[ id ][ internalKey ]; |
2677 | + |
2678 | + // Don't destroy the parent cache unless the internal data object |
2679 | + // had been the only thing left in it |
2680 | + if ( !isEmptyDataObject(cache[ id ]) ) { |
2681 | + return; |
2682 | + } |
2683 | + } |
2684 | + |
2685 | + var internalCache = cache[ id ][ internalKey ]; |
2686 | + |
2687 | + // Browsers that fail expando deletion also refuse to delete expandos on |
2688 | + // the window, but it will allow it on all other JS objects; other browsers |
2689 | + // don't care |
2690 | + if ( jQuery.support.deleteExpando || cache != window ) { |
2691 | + delete cache[ id ]; |
2692 | } else { |
2693 | - // Clean up the element expando |
2694 | - try { |
2695 | - delete elem[ expando ]; |
2696 | - } catch(e){ |
2697 | - // IE has trouble directly removing the expando |
2698 | - // but it's ok with using removeAttribute |
2699 | - if ( elem.removeAttribute ) |
2700 | - elem.removeAttribute( expando ); |
2701 | - } |
2702 | - |
2703 | - // Completely remove the data cache |
2704 | - delete jQuery.cache[ id ]; |
2705 | - } |
2706 | - }, |
2707 | - queue: function( elem, type, data ) { |
2708 | - if ( elem ){ |
2709 | - |
2710 | - type = (type || "fx") + "queue"; |
2711 | - |
2712 | - var q = jQuery.data( elem, type ); |
2713 | - |
2714 | - if ( !q || jQuery.isArray(data) ) |
2715 | - q = jQuery.data( elem, type, jQuery.makeArray(data) ); |
2716 | - else if( data ) |
2717 | - q.push( data ); |
2718 | - |
2719 | - } |
2720 | - return q; |
2721 | - }, |
2722 | - |
2723 | - dequeue: function( elem, type ){ |
2724 | - var queue = jQuery.queue( elem, type ), |
2725 | - fn = queue.shift(); |
2726 | - |
2727 | - if( !type || type === "fx" ) |
2728 | - fn = queue[0]; |
2729 | - |
2730 | - if( fn !== undefined ) |
2731 | - fn.call(elem); |
2732 | + cache[ id ] = null; |
2733 | + } |
2734 | + |
2735 | + // We destroyed the entire user cache at once because it's faster than |
2736 | + // iterating through each key, but we need to continue to persist internal |
2737 | + // data if it existed |
2738 | + if ( internalCache ) { |
2739 | + cache[ id ] = {}; |
2740 | + // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery |
2741 | + // metadata on plain JS objects when the object is serialized using |
2742 | + // JSON.stringify |
2743 | + if ( !isNode ) { |
2744 | + cache[ id ].toJSON = jQuery.noop; |
2745 | + } |
2746 | + |
2747 | + cache[ id ][ internalKey ] = internalCache; |
2748 | + |
2749 | + // Otherwise, we need to eliminate the expando on the node to avoid |
2750 | + // false lookups in the cache for entries that no longer exist |
2751 | + } else if ( isNode ) { |
2752 | + // IE does not allow us to delete expando properties from nodes, |
2753 | + // nor does it have a removeAttribute function on Document nodes; |
2754 | + // we must handle all of these cases |
2755 | + if ( jQuery.support.deleteExpando ) { |
2756 | + delete elem[ jQuery.expando ]; |
2757 | + } else if ( elem.removeAttribute ) { |
2758 | + elem.removeAttribute( jQuery.expando ); |
2759 | + } else { |
2760 | + elem[ jQuery.expando ] = null; |
2761 | + } |
2762 | + } |
2763 | + }, |
2764 | + |
2765 | + // For internal use only. |
2766 | + _data: function( elem, name, data ) { |
2767 | + return jQuery.data( elem, name, data, true ); |
2768 | + }, |
2769 | + |
2770 | + // A method for determining if a DOM node can handle the data expando |
2771 | + acceptData: function( elem ) { |
2772 | + if ( elem.nodeName ) { |
2773 | + var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; |
2774 | + |
2775 | + if ( match ) { |
2776 | + return !(match === true || elem.getAttribute("classid") !== match); |
2777 | + } |
2778 | + } |
2779 | + |
2780 | + return true; |
2781 | } |
2782 | }); |
2783 | |
2784 | jQuery.fn.extend({ |
2785 | - data: function( key, value ){ |
2786 | + data: function( key, value ) { |
2787 | + var data = null; |
2788 | + |
2789 | + if ( typeof key === "undefined" ) { |
2790 | + if ( this.length ) { |
2791 | + data = jQuery.data( this[0] ); |
2792 | + |
2793 | + if ( this[0].nodeType === 1 ) { |
2794 | + var attr = this[0].attributes, name; |
2795 | + for ( var i = 0, l = attr.length; i < l; i++ ) { |
2796 | + name = attr[i].name; |
2797 | + |
2798 | + if ( name.indexOf( "data-" ) === 0 ) { |
2799 | + name = jQuery.camelCase( name.substring(5) ); |
2800 | + |
2801 | + dataAttr( this[0], name, data[ name ] ); |
2802 | + } |
2803 | + } |
2804 | + } |
2805 | + } |
2806 | + |
2807 | + return data; |
2808 | + |
2809 | + } else if ( typeof key === "object" ) { |
2810 | + return this.each(function() { |
2811 | + jQuery.data( this, key ); |
2812 | + }); |
2813 | + } |
2814 | + |
2815 | var parts = key.split("."); |
2816 | parts[1] = parts[1] ? "." + parts[1] : ""; |
2817 | |
2818 | if ( value === undefined ) { |
2819 | - var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
2820 | + data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); |
2821 | |
2822 | - if ( data === undefined && this.length ) |
2823 | + // Try to fetch any internally stored data first |
2824 | + if ( data === undefined && this.length ) { |
2825 | data = jQuery.data( this[0], key ); |
2826 | + data = dataAttr( this[0], key, data ); |
2827 | + } |
2828 | |
2829 | return data === undefined && parts[1] ? |
2830 | this.data( parts[0] ) : |
2831 | data; |
2832 | - } else |
2833 | - return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ |
2834 | + |
2835 | + } else { |
2836 | + return this.each(function() { |
2837 | + var $this = jQuery( this ), |
2838 | + args = [ parts[0], value ]; |
2839 | + |
2840 | + $this.triggerHandler( "setData" + parts[1] + "!", args ); |
2841 | jQuery.data( this, key, value ); |
2842 | + $this.triggerHandler( "changeData" + parts[1] + "!", args ); |
2843 | }); |
2844 | + } |
2845 | }, |
2846 | |
2847 | - removeData: function( key ){ |
2848 | - return this.each(function(){ |
2849 | + removeData: function( key ) { |
2850 | + return this.each(function() { |
2851 | jQuery.removeData( this, key ); |
2852 | }); |
2853 | - }, |
2854 | - queue: function(type, data){ |
2855 | + } |
2856 | +}); |
2857 | + |
2858 | +function dataAttr( elem, key, data ) { |
2859 | + // If nothing was found internally, try to fetch any |
2860 | + // data from the HTML5 data-* attribute |
2861 | + if ( data === undefined && elem.nodeType === 1 ) { |
2862 | + var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); |
2863 | + |
2864 | + data = elem.getAttribute( name ); |
2865 | + |
2866 | + if ( typeof data === "string" ) { |
2867 | + try { |
2868 | + data = data === "true" ? true : |
2869 | + data === "false" ? false : |
2870 | + data === "null" ? null : |
2871 | + !jQuery.isNaN( data ) ? parseFloat( data ) : |
2872 | + rbrace.test( data ) ? jQuery.parseJSON( data ) : |
2873 | + data; |
2874 | + } catch( e ) {} |
2875 | + |
2876 | + // Make sure we set the data so it isn't changed later |
2877 | + jQuery.data( elem, key, data ); |
2878 | + |
2879 | + } else { |
2880 | + data = undefined; |
2881 | + } |
2882 | + } |
2883 | + |
2884 | + return data; |
2885 | +} |
2886 | + |
2887 | +// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON |
2888 | +// property to be considered empty objects; this property always exists in |
2889 | +// order to make sure JSON.stringify does not expose internal metadata |
2890 | +function isEmptyDataObject( obj ) { |
2891 | + for ( var name in obj ) { |
2892 | + if ( name !== "toJSON" ) { |
2893 | + return false; |
2894 | + } |
2895 | + } |
2896 | + |
2897 | + return true; |
2898 | +} |
2899 | + |
2900 | + |
2901 | + |
2902 | + |
2903 | +function handleQueueMarkDefer( elem, type, src ) { |
2904 | + var deferDataKey = type + "defer", |
2905 | + queueDataKey = type + "queue", |
2906 | + markDataKey = type + "mark", |
2907 | + defer = jQuery.data( elem, deferDataKey, undefined, true ); |
2908 | + if ( defer && |
2909 | + ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && |
2910 | + ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { |
2911 | + // Give room for hard-coded callbacks to fire first |
2912 | + // and eventually mark/queue something else on the element |
2913 | + setTimeout( function() { |
2914 | + if ( !jQuery.data( elem, queueDataKey, undefined, true ) && |
2915 | + !jQuery.data( elem, markDataKey, undefined, true ) ) { |
2916 | + jQuery.removeData( elem, deferDataKey, true ); |
2917 | + defer.resolve(); |
2918 | + } |
2919 | + }, 0 ); |
2920 | + } |
2921 | +} |
2922 | + |
2923 | +jQuery.extend({ |
2924 | + |
2925 | + _mark: function( elem, type ) { |
2926 | + if ( elem ) { |
2927 | + type = (type || "fx") + "mark"; |
2928 | + jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); |
2929 | + } |
2930 | + }, |
2931 | + |
2932 | + _unmark: function( force, elem, type ) { |
2933 | + if ( force !== true ) { |
2934 | + type = elem; |
2935 | + elem = force; |
2936 | + force = false; |
2937 | + } |
2938 | + if ( elem ) { |
2939 | + type = type || "fx"; |
2940 | + var key = type + "mark", |
2941 | + count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); |
2942 | + if ( count ) { |
2943 | + jQuery.data( elem, key, count, true ); |
2944 | + } else { |
2945 | + jQuery.removeData( elem, key, true ); |
2946 | + handleQueueMarkDefer( elem, type, "mark" ); |
2947 | + } |
2948 | + } |
2949 | + }, |
2950 | + |
2951 | + queue: function( elem, type, data ) { |
2952 | + if ( elem ) { |
2953 | + type = (type || "fx") + "queue"; |
2954 | + var q = jQuery.data( elem, type, undefined, true ); |
2955 | + // Speed up dequeue by getting out quickly if this is just a lookup |
2956 | + if ( data ) { |
2957 | + if ( !q || jQuery.isArray(data) ) { |
2958 | + q = jQuery.data( elem, type, jQuery.makeArray(data), true ); |
2959 | + } else { |
2960 | + q.push( data ); |
2961 | + } |
2962 | + } |
2963 | + return q || []; |
2964 | + } |
2965 | + }, |
2966 | + |
2967 | + dequeue: function( elem, type ) { |
2968 | + type = type || "fx"; |
2969 | + |
2970 | + var queue = jQuery.queue( elem, type ), |
2971 | + fn = queue.shift(), |
2972 | + defer; |
2973 | + |
2974 | + // If the fx queue is dequeued, always remove the progress sentinel |
2975 | + if ( fn === "inprogress" ) { |
2976 | + fn = queue.shift(); |
2977 | + } |
2978 | + |
2979 | + if ( fn ) { |
2980 | + // Add a progress sentinel to prevent the fx queue from being |
2981 | + // automatically dequeued |
2982 | + if ( type === "fx" ) { |
2983 | + queue.unshift("inprogress"); |
2984 | + } |
2985 | + |
2986 | + fn.call(elem, function() { |
2987 | + jQuery.dequeue(elem, type); |
2988 | + }); |
2989 | + } |
2990 | + |
2991 | + if ( !queue.length ) { |
2992 | + jQuery.removeData( elem, type + "queue", true ); |
2993 | + handleQueueMarkDefer( elem, type, "queue" ); |
2994 | + } |
2995 | + } |
2996 | +}); |
2997 | + |
2998 | +jQuery.fn.extend({ |
2999 | + queue: function( type, data ) { |
3000 | if ( typeof type !== "string" ) { |
3001 | data = type; |
3002 | type = "fx"; |
3003 | } |
3004 | |
3005 | - if ( data === undefined ) |
3006 | + if ( data === undefined ) { |
3007 | return jQuery.queue( this[0], type ); |
3008 | - |
3009 | - return this.each(function(){ |
3010 | + } |
3011 | + return this.each(function() { |
3012 | var queue = jQuery.queue( this, type, data ); |
3013 | - |
3014 | - if( type == "fx" && queue.length == 1 ) |
3015 | - queue[0].call(this); |
3016 | + |
3017 | + if ( type === "fx" && queue[0] !== "inprogress" ) { |
3018 | + jQuery.dequeue( this, type ); |
3019 | + } |
3020 | }); |
3021 | }, |
3022 | - dequeue: function(type){ |
3023 | - return this.each(function(){ |
3024 | + dequeue: function( type ) { |
3025 | + return this.each(function() { |
3026 | jQuery.dequeue( this, type ); |
3027 | }); |
3028 | - } |
3029 | -});/*! |
3030 | - * Sizzle CSS Selector Engine - v0.9.3 |
3031 | - * Copyright 2009, The Dojo Foundation |
3032 | + }, |
3033 | + // Based off of the plugin by Clint Helfers, with permission. |
3034 | + // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
3035 | + delay: function( time, type ) { |
3036 | + time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
3037 | + type = type || "fx"; |
3038 | + |
3039 | + return this.queue( type, function() { |
3040 | + var elem = this; |
3041 | + setTimeout(function() { |
3042 | + jQuery.dequeue( elem, type ); |
3043 | + }, time ); |
3044 | + }); |
3045 | + }, |
3046 | + clearQueue: function( type ) { |
3047 | + return this.queue( type || "fx", [] ); |
3048 | + }, |
3049 | + // Get a promise resolved when queues of a certain type |
3050 | + // are emptied (fx is the type by default) |
3051 | + promise: function( type, object ) { |
3052 | + if ( typeof type !== "string" ) { |
3053 | + object = type; |
3054 | + type = undefined; |
3055 | + } |
3056 | + type = type || "fx"; |
3057 | + var defer = jQuery.Deferred(), |
3058 | + elements = this, |
3059 | + i = elements.length, |
3060 | + count = 1, |
3061 | + deferDataKey = type + "defer", |
3062 | + queueDataKey = type + "queue", |
3063 | + markDataKey = type + "mark", |
3064 | + tmp; |
3065 | + function resolve() { |
3066 | + if ( !( --count ) ) { |
3067 | + defer.resolveWith( elements, [ elements ] ); |
3068 | + } |
3069 | + } |
3070 | + while( i-- ) { |
3071 | + if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || |
3072 | + ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || |
3073 | + jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && |
3074 | + jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { |
3075 | + count++; |
3076 | + tmp.done( resolve ); |
3077 | + } |
3078 | + } |
3079 | + resolve(); |
3080 | + return defer.promise(); |
3081 | + } |
3082 | +}); |
3083 | + |
3084 | + |
3085 | + |
3086 | + |
3087 | +var rclass = /[\n\t\r]/g, |
3088 | + rspace = /\s+/, |
3089 | + rreturn = /\r/g, |
3090 | + rtype = /^(?:button|input)$/i, |
3091 | + rfocusable = /^(?:button|input|object|select|textarea)$/i, |
3092 | + rclickable = /^a(?:rea)?$/i, |
3093 | + rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, |
3094 | + rinvalidChar = /\:|^on/, |
3095 | + formHook, boolHook; |
3096 | + |
3097 | +jQuery.fn.extend({ |
3098 | + attr: function( name, value ) { |
3099 | + return jQuery.access( this, name, value, true, jQuery.attr ); |
3100 | + }, |
3101 | + |
3102 | + removeAttr: function( name ) { |
3103 | + return this.each(function() { |
3104 | + jQuery.removeAttr( this, name ); |
3105 | + }); |
3106 | + }, |
3107 | + |
3108 | + prop: function( name, value ) { |
3109 | + return jQuery.access( this, name, value, true, jQuery.prop ); |
3110 | + }, |
3111 | + |
3112 | + removeProp: function( name ) { |
3113 | + name = jQuery.propFix[ name ] || name; |
3114 | + return this.each(function() { |
3115 | + // try/catch handles cases where IE balks (such as removing a property on window) |
3116 | + try { |
3117 | + this[ name ] = undefined; |
3118 | + delete this[ name ]; |
3119 | + } catch( e ) {} |
3120 | + }); |
3121 | + }, |
3122 | + |
3123 | + addClass: function( value ) { |
3124 | + var classNames, i, l, elem, |
3125 | + setClass, c, cl; |
3126 | + |
3127 | + if ( jQuery.isFunction( value ) ) { |
3128 | + return this.each(function( j ) { |
3129 | + jQuery( this ).addClass( value.call(this, j, this.className) ); |
3130 | + }); |
3131 | + } |
3132 | + |
3133 | + if ( value && typeof value === "string" ) { |
3134 | + classNames = value.split( rspace ); |
3135 | + |
3136 | + for ( i = 0, l = this.length; i < l; i++ ) { |
3137 | + elem = this[ i ]; |
3138 | + |
3139 | + if ( elem.nodeType === 1 ) { |
3140 | + if ( !elem.className && classNames.length === 1 ) { |
3141 | + elem.className = value; |
3142 | + |
3143 | + } else { |
3144 | + setClass = " " + elem.className + " "; |
3145 | + |
3146 | + for ( c = 0, cl = classNames.length; c < cl; c++ ) { |
3147 | + if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { |
3148 | + setClass += classNames[ c ] + " "; |
3149 | + } |
3150 | + } |
3151 | + elem.className = jQuery.trim( setClass ); |
3152 | + } |
3153 | + } |
3154 | + } |
3155 | + } |
3156 | + |
3157 | + return this; |
3158 | + }, |
3159 | + |
3160 | + removeClass: function( value ) { |
3161 | + var classNames, i, l, elem, className, c, cl; |
3162 | + |
3163 | + if ( jQuery.isFunction( value ) ) { |
3164 | + return this.each(function( j ) { |
3165 | + jQuery( this ).removeClass( value.call(this, j, this.className) ); |
3166 | + }); |
3167 | + } |
3168 | + |
3169 | + if ( (value && typeof value === "string") || value === undefined ) { |
3170 | + classNames = (value || "").split( rspace ); |
3171 | + |
3172 | + for ( i = 0, l = this.length; i < l; i++ ) { |
3173 | + elem = this[ i ]; |
3174 | + |
3175 | + if ( elem.nodeType === 1 && elem.className ) { |
3176 | + if ( value ) { |
3177 | + className = (" " + elem.className + " ").replace( rclass, " " ); |
3178 | + for ( c = 0, cl = classNames.length; c < cl; c++ ) { |
3179 | + className = className.replace(" " + classNames[ c ] + " ", " "); |
3180 | + } |
3181 | + elem.className = jQuery.trim( className ); |
3182 | + |
3183 | + } else { |
3184 | + elem.className = ""; |
3185 | + } |
3186 | + } |
3187 | + } |
3188 | + } |
3189 | + |
3190 | + return this; |
3191 | + }, |
3192 | + |
3193 | + toggleClass: function( value, stateVal ) { |
3194 | + var type = typeof value, |
3195 | + isBool = typeof stateVal === "boolean"; |
3196 | + |
3197 | + if ( jQuery.isFunction( value ) ) { |
3198 | + return this.each(function( i ) { |
3199 | + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); |
3200 | + }); |
3201 | + } |
3202 | + |
3203 | + return this.each(function() { |
3204 | + if ( type === "string" ) { |
3205 | + // toggle individual class names |
3206 | + var className, |
3207 | + i = 0, |
3208 | + self = jQuery( this ), |
3209 | + state = stateVal, |
3210 | + classNames = value.split( rspace ); |
3211 | + |
3212 | + while ( (className = classNames[ i++ ]) ) { |
3213 | + // check each className given, space seperated list |
3214 | + state = isBool ? state : !self.hasClass( className ); |
3215 | + self[ state ? "addClass" : "removeClass" ]( className ); |
3216 | + } |
3217 | + |
3218 | + } else if ( type === "undefined" || type === "boolean" ) { |
3219 | + if ( this.className ) { |
3220 | + // store className if set |
3221 | + jQuery._data( this, "__className__", this.className ); |
3222 | + } |
3223 | + |
3224 | + // toggle whole className |
3225 | + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; |
3226 | + } |
3227 | + }); |
3228 | + }, |
3229 | + |
3230 | + hasClass: function( selector ) { |
3231 | + var className = " " + selector + " "; |
3232 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
3233 | + if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { |
3234 | + return true; |
3235 | + } |
3236 | + } |
3237 | + |
3238 | + return false; |
3239 | + }, |
3240 | + |
3241 | + val: function( value ) { |
3242 | + var hooks, ret, |
3243 | + elem = this[0]; |
3244 | + |
3245 | + if ( !arguments.length ) { |
3246 | + if ( elem ) { |
3247 | + hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; |
3248 | + |
3249 | + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
3250 | + return ret; |
3251 | + } |
3252 | + |
3253 | + ret = elem.value; |
3254 | + |
3255 | + return typeof ret === "string" ? |
3256 | + // handle most common string cases |
3257 | + ret.replace(rreturn, "") : |
3258 | + // handle cases where value is null/undef or number |
3259 | + ret == null ? "" : ret; |
3260 | + } |
3261 | + |
3262 | + return undefined; |
3263 | + } |
3264 | + |
3265 | + var isFunction = jQuery.isFunction( value ); |
3266 | + |
3267 | + return this.each(function( i ) { |
3268 | + var self = jQuery(this), val; |
3269 | + |
3270 | + if ( this.nodeType !== 1 ) { |
3271 | + return; |
3272 | + } |
3273 | + |
3274 | + if ( isFunction ) { |
3275 | + val = value.call( this, i, self.val() ); |
3276 | + } else { |
3277 | + val = value; |
3278 | + } |
3279 | + |
3280 | + // Treat null/undefined as ""; convert numbers to string |
3281 | + if ( val == null ) { |
3282 | + val = ""; |
3283 | + } else if ( typeof val === "number" ) { |
3284 | + val += ""; |
3285 | + } else if ( jQuery.isArray( val ) ) { |
3286 | + val = jQuery.map(val, function ( value ) { |
3287 | + return value == null ? "" : value + ""; |
3288 | + }); |
3289 | + } |
3290 | + |
3291 | + hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; |
3292 | + |
3293 | + // If set returns undefined, fall back to normal setting |
3294 | + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { |
3295 | + this.value = val; |
3296 | + } |
3297 | + }); |
3298 | + } |
3299 | +}); |
3300 | + |
3301 | +jQuery.extend({ |
3302 | + valHooks: { |
3303 | + option: { |
3304 | + get: function( elem ) { |
3305 | + // attributes.value is undefined in Blackberry 4.7 but |
3306 | + // uses .value. See #6932 |
3307 | + var val = elem.attributes.value; |
3308 | + return !val || val.specified ? elem.value : elem.text; |
3309 | + } |
3310 | + }, |
3311 | + select: { |
3312 | + get: function( elem ) { |
3313 | + var value, |
3314 | + index = elem.selectedIndex, |
3315 | + values = [], |
3316 | + options = elem.options, |
3317 | + one = elem.type === "select-one"; |
3318 | + |
3319 | + // Nothing was selected |
3320 | + if ( index < 0 ) { |
3321 | + return null; |
3322 | + } |
3323 | + |
3324 | + // Loop through all the selected options |
3325 | + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
3326 | + var option = options[ i ]; |
3327 | + |
3328 | + // Don't return options that are disabled or in a disabled optgroup |
3329 | + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && |
3330 | + (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { |
3331 | + |
3332 | + // Get the specific value for the option |
3333 | + value = jQuery( option ).val(); |
3334 | + |
3335 | + // We don't need an array for one selects |
3336 | + if ( one ) { |
3337 | + return value; |
3338 | + } |
3339 | + |
3340 | + // Multi-Selects return an array |
3341 | + values.push( value ); |
3342 | + } |
3343 | + } |
3344 | + |
3345 | + // Fixes Bug #2551 -- select.val() broken in IE after form.reset() |
3346 | + if ( one && !values.length && options.length ) { |
3347 | + return jQuery( options[ index ] ).val(); |
3348 | + } |
3349 | + |
3350 | + return values; |
3351 | + }, |
3352 | + |
3353 | + set: function( elem, value ) { |
3354 | + var values = jQuery.makeArray( value ); |
3355 | + |
3356 | + jQuery(elem).find("option").each(function() { |
3357 | + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
3358 | + }); |
3359 | + |
3360 | + if ( !values.length ) { |
3361 | + elem.selectedIndex = -1; |
3362 | + } |
3363 | + return values; |
3364 | + } |
3365 | + } |
3366 | + }, |
3367 | + |
3368 | + attrFn: { |
3369 | + val: true, |
3370 | + css: true, |
3371 | + html: true, |
3372 | + text: true, |
3373 | + data: true, |
3374 | + width: true, |
3375 | + height: true, |
3376 | + offset: true |
3377 | + }, |
3378 | + |
3379 | + attrFix: { |
3380 | + // Always normalize to ensure hook usage |
3381 | + tabindex: "tabIndex" |
3382 | + }, |
3383 | + |
3384 | + attr: function( elem, name, value, pass ) { |
3385 | + var nType = elem.nodeType; |
3386 | + |
3387 | + // don't get/set attributes on text, comment and attribute nodes |
3388 | + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
3389 | + return undefined; |
3390 | + } |
3391 | + |
3392 | + if ( pass && name in jQuery.attrFn ) { |
3393 | + return jQuery( elem )[ name ]( value ); |
3394 | + } |
3395 | + |
3396 | + // Fallback to prop when attributes are not supported |
3397 | + if ( !("getAttribute" in elem) ) { |
3398 | + return jQuery.prop( elem, name, value ); |
3399 | + } |
3400 | + |
3401 | + var ret, hooks, |
3402 | + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
3403 | + |
3404 | + // Normalize the name if needed |
3405 | + if ( notxml ) { |
3406 | + name = jQuery.attrFix[ name ] || name; |
3407 | + |
3408 | + hooks = jQuery.attrHooks[ name ]; |
3409 | + |
3410 | + if ( !hooks ) { |
3411 | + // Use boolHook for boolean attributes |
3412 | + if ( rboolean.test( name ) ) { |
3413 | + |
3414 | + hooks = boolHook; |
3415 | + |
3416 | + // Use formHook for forms and if the name contains certain characters |
3417 | + } else if ( formHook && name !== "className" && |
3418 | + (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) { |
3419 | + |
3420 | + hooks = formHook; |
3421 | + } |
3422 | + } |
3423 | + } |
3424 | + |
3425 | + if ( value !== undefined ) { |
3426 | + |
3427 | + if ( value === null ) { |
3428 | + jQuery.removeAttr( elem, name ); |
3429 | + return undefined; |
3430 | + |
3431 | + } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { |
3432 | + return ret; |
3433 | + |
3434 | + } else { |
3435 | + elem.setAttribute( name, "" + value ); |
3436 | + return value; |
3437 | + } |
3438 | + |
3439 | + } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { |
3440 | + return ret; |
3441 | + |
3442 | + } else { |
3443 | + |
3444 | + ret = elem.getAttribute( name ); |
3445 | + |
3446 | + // Non-existent attributes return null, we normalize to undefined |
3447 | + return ret === null ? |
3448 | + undefined : |
3449 | + ret; |
3450 | + } |
3451 | + }, |
3452 | + |
3453 | + removeAttr: function( elem, name ) { |
3454 | + var propName; |
3455 | + if ( elem.nodeType === 1 ) { |
3456 | + name = jQuery.attrFix[ name ] || name; |
3457 | + |
3458 | + if ( jQuery.support.getSetAttribute ) { |
3459 | + // Use removeAttribute in browsers that support it |
3460 | + elem.removeAttribute( name ); |
3461 | + } else { |
3462 | + jQuery.attr( elem, name, "" ); |
3463 | + elem.removeAttributeNode( elem.getAttributeNode( name ) ); |
3464 | + } |
3465 | + |
3466 | + // Set corresponding property to false for boolean attributes |
3467 | + if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) { |
3468 | + elem[ propName ] = false; |
3469 | + } |
3470 | + } |
3471 | + }, |
3472 | + |
3473 | + attrHooks: { |
3474 | + type: { |
3475 | + set: function( elem, value ) { |
3476 | + // We can't allow the type property to be changed (since it causes problems in IE) |
3477 | + if ( rtype.test( elem.nodeName ) && elem.parentNode ) { |
3478 | + jQuery.error( "type property can't be changed" ); |
3479 | + } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { |
3480 | + // Setting the type on a radio button after the value resets the value in IE6-9 |
3481 | + // Reset value to it's default in case type is set after value |
3482 | + // This is for element creation |
3483 | + var val = elem.value; |
3484 | + elem.setAttribute( "type", value ); |
3485 | + if ( val ) { |
3486 | + elem.value = val; |
3487 | + } |
3488 | + return value; |
3489 | + } |
3490 | + } |
3491 | + }, |
3492 | + tabIndex: { |
3493 | + get: function( elem ) { |
3494 | + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
3495 | + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
3496 | + var attributeNode = elem.getAttributeNode("tabIndex"); |
3497 | + |
3498 | + return attributeNode && attributeNode.specified ? |
3499 | + parseInt( attributeNode.value, 10 ) : |
3500 | + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
3501 | + 0 : |
3502 | + undefined; |
3503 | + } |
3504 | + }, |
3505 | + // Use the value property for back compat |
3506 | + // Use the formHook for button elements in IE6/7 (#1954) |
3507 | + value: { |
3508 | + get: function( elem, name ) { |
3509 | + if ( formHook && jQuery.nodeName( elem, "button" ) ) { |
3510 | + return formHook.get( elem, name ); |
3511 | + } |
3512 | + return name in elem ? |
3513 | + elem.value : |
3514 | + null; |
3515 | + }, |
3516 | + set: function( elem, value, name ) { |
3517 | + if ( formHook && jQuery.nodeName( elem, "button" ) ) { |
3518 | + return formHook.set( elem, value, name ); |
3519 | + } |
3520 | + // Does not return so that setAttribute is also used |
3521 | + elem.value = value; |
3522 | + } |
3523 | + } |
3524 | + }, |
3525 | + |
3526 | + propFix: { |
3527 | + tabindex: "tabIndex", |
3528 | + readonly: "readOnly", |
3529 | + "for": "htmlFor", |
3530 | + "class": "className", |
3531 | + maxlength: "maxLength", |
3532 | + cellspacing: "cellSpacing", |
3533 | + cellpadding: "cellPadding", |
3534 | + rowspan: "rowSpan", |
3535 | + colspan: "colSpan", |
3536 | + usemap: "useMap", |
3537 | + frameborder: "frameBorder", |
3538 | + contenteditable: "contentEditable" |
3539 | + }, |
3540 | + |
3541 | + prop: function( elem, name, value ) { |
3542 | + var nType = elem.nodeType; |
3543 | + |
3544 | + // don't get/set properties on text, comment and attribute nodes |
3545 | + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
3546 | + return undefined; |
3547 | + } |
3548 | + |
3549 | + var ret, hooks, |
3550 | + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
3551 | + |
3552 | + if ( notxml ) { |
3553 | + // Fix name and attach hooks |
3554 | + name = jQuery.propFix[ name ] || name; |
3555 | + hooks = jQuery.propHooks[ name ]; |
3556 | + } |
3557 | + |
3558 | + if ( value !== undefined ) { |
3559 | + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
3560 | + return ret; |
3561 | + |
3562 | + } else { |
3563 | + return (elem[ name ] = value); |
3564 | + } |
3565 | + |
3566 | + } else { |
3567 | + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { |
3568 | + return ret; |
3569 | + |
3570 | + } else { |
3571 | + return elem[ name ]; |
3572 | + } |
3573 | + } |
3574 | + }, |
3575 | + |
3576 | + propHooks: {} |
3577 | +}); |
3578 | + |
3579 | +// Hook for boolean attributes |
3580 | +boolHook = { |
3581 | + get: function( elem, name ) { |
3582 | + // Align boolean attributes with corresponding properties |
3583 | + return jQuery.prop( elem, name ) ? |
3584 | + name.toLowerCase() : |
3585 | + undefined; |
3586 | + }, |
3587 | + set: function( elem, value, name ) { |
3588 | + var propName; |
3589 | + if ( value === false ) { |
3590 | + // Remove boolean attributes when set to false |
3591 | + jQuery.removeAttr( elem, name ); |
3592 | + } else { |
3593 | + // value is true since we know at this point it's type boolean and not false |
3594 | + // Set boolean attributes to the same name and set the DOM property |
3595 | + propName = jQuery.propFix[ name ] || name; |
3596 | + if ( propName in elem ) { |
3597 | + // Only set the IDL specifically if it already exists on the element |
3598 | + elem[ propName ] = true; |
3599 | + } |
3600 | + |
3601 | + elem.setAttribute( name, name.toLowerCase() ); |
3602 | + } |
3603 | + return name; |
3604 | + } |
3605 | +}; |
3606 | + |
3607 | +// IE6/7 do not support getting/setting some attributes with get/setAttribute |
3608 | +if ( !jQuery.support.getSetAttribute ) { |
3609 | + |
3610 | + // propFix is more comprehensive and contains all fixes |
3611 | + jQuery.attrFix = jQuery.propFix; |
3612 | + |
3613 | + // Use this for any attribute on a form in IE6/7 |
3614 | + formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { |
3615 | + get: function( elem, name ) { |
3616 | + var ret; |
3617 | + ret = elem.getAttributeNode( name ); |
3618 | + // Return undefined if nodeValue is empty string |
3619 | + return ret && ret.nodeValue !== "" ? |
3620 | + ret.nodeValue : |
3621 | + undefined; |
3622 | + }, |
3623 | + set: function( elem, value, name ) { |
3624 | + // Check form objects in IE (multiple bugs related) |
3625 | + // Only use nodeValue if the attribute node exists on the form |
3626 | + var ret = elem.getAttributeNode( name ); |
3627 | + if ( ret ) { |
3628 | + ret.nodeValue = value; |
3629 | + return value; |
3630 | + } |
3631 | + } |
3632 | + }; |
3633 | + |
3634 | + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) |
3635 | + // This is for removals |
3636 | + jQuery.each([ "width", "height" ], function( i, name ) { |
3637 | + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
3638 | + set: function( elem, value ) { |
3639 | + if ( value === "" ) { |
3640 | + elem.setAttribute( name, "auto" ); |
3641 | + return value; |
3642 | + } |
3643 | + } |
3644 | + }); |
3645 | + }); |
3646 | +} |
3647 | + |
3648 | + |
3649 | +// Some attributes require a special call on IE |
3650 | +if ( !jQuery.support.hrefNormalized ) { |
3651 | + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { |
3652 | + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
3653 | + get: function( elem ) { |
3654 | + var ret = elem.getAttribute( name, 2 ); |
3655 | + return ret === null ? undefined : ret; |
3656 | + } |
3657 | + }); |
3658 | + }); |
3659 | +} |
3660 | + |
3661 | +if ( !jQuery.support.style ) { |
3662 | + jQuery.attrHooks.style = { |
3663 | + get: function( elem ) { |
3664 | + // Return undefined in the case of empty string |
3665 | + // Normalize to lowercase since IE uppercases css property names |
3666 | + return elem.style.cssText.toLowerCase() || undefined; |
3667 | + }, |
3668 | + set: function( elem, value ) { |
3669 | + return (elem.style.cssText = "" + value); |
3670 | + } |
3671 | + }; |
3672 | +} |
3673 | + |
3674 | +// Safari mis-reports the default selected property of an option |
3675 | +// Accessing the parent's selectedIndex property fixes it |
3676 | +if ( !jQuery.support.optSelected ) { |
3677 | + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { |
3678 | + get: function( elem ) { |
3679 | + var parent = elem.parentNode; |
3680 | + |
3681 | + if ( parent ) { |
3682 | + parent.selectedIndex; |
3683 | + |
3684 | + // Make sure that it also works with optgroups, see #5701 |
3685 | + if ( parent.parentNode ) { |
3686 | + parent.parentNode.selectedIndex; |
3687 | + } |
3688 | + } |
3689 | + } |
3690 | + }); |
3691 | +} |
3692 | + |
3693 | +// Radios and checkboxes getter/setter |
3694 | +if ( !jQuery.support.checkOn ) { |
3695 | + jQuery.each([ "radio", "checkbox" ], function() { |
3696 | + jQuery.valHooks[ this ] = { |
3697 | + get: function( elem ) { |
3698 | + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
3699 | + return elem.getAttribute("value") === null ? "on" : elem.value; |
3700 | + } |
3701 | + }; |
3702 | + }); |
3703 | +} |
3704 | +jQuery.each([ "radio", "checkbox" ], function() { |
3705 | + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { |
3706 | + set: function( elem, value ) { |
3707 | + if ( jQuery.isArray( value ) ) { |
3708 | + return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); |
3709 | + } |
3710 | + } |
3711 | + }); |
3712 | +}); |
3713 | + |
3714 | + |
3715 | + |
3716 | + |
3717 | +var rnamespaces = /\.(.*)$/, |
3718 | + rformElems = /^(?:textarea|input|select)$/i, |
3719 | + rperiod = /\./g, |
3720 | + rspaces = / /g, |
3721 | + rescape = /[^\w\s.|`]/g, |
3722 | + fcleanup = function( nm ) { |
3723 | + return nm.replace(rescape, "\\$&"); |
3724 | + }; |
3725 | + |
3726 | +/* |
3727 | + * A number of helper functions used for managing events. |
3728 | + * Many of the ideas behind this code originated from |
3729 | + * Dean Edwards' addEvent library. |
3730 | + */ |
3731 | +jQuery.event = { |
3732 | + |
3733 | + // Bind an event to an element |
3734 | + // Original by Dean Edwards |
3735 | + add: function( elem, types, handler, data ) { |
3736 | + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
3737 | + return; |
3738 | + } |
3739 | + |
3740 | + if ( handler === false ) { |
3741 | + handler = returnFalse; |
3742 | + } else if ( !handler ) { |
3743 | + // Fixes bug #7229. Fix recommended by jdalton |
3744 | + return; |
3745 | + } |
3746 | + |
3747 | + var handleObjIn, handleObj; |
3748 | + |
3749 | + if ( handler.handler ) { |
3750 | + handleObjIn = handler; |
3751 | + handler = handleObjIn.handler; |
3752 | + } |
3753 | + |
3754 | + // Make sure that the function being executed has a unique ID |
3755 | + if ( !handler.guid ) { |
3756 | + handler.guid = jQuery.guid++; |
3757 | + } |
3758 | + |
3759 | + // Init the element's event structure |
3760 | + var elemData = jQuery._data( elem ); |
3761 | + |
3762 | + // If no elemData is found then we must be trying to bind to one of the |
3763 | + // banned noData elements |
3764 | + if ( !elemData ) { |
3765 | + return; |
3766 | + } |
3767 | + |
3768 | + var events = elemData.events, |
3769 | + eventHandle = elemData.handle; |
3770 | + |
3771 | + if ( !events ) { |
3772 | + elemData.events = events = {}; |
3773 | + } |
3774 | + |
3775 | + if ( !eventHandle ) { |
3776 | + elemData.handle = eventHandle = function( e ) { |
3777 | + // Discard the second event of a jQuery.event.trigger() and |
3778 | + // when an event is called after a page has unloaded |
3779 | + return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? |
3780 | + jQuery.event.handle.apply( eventHandle.elem, arguments ) : |
3781 | + undefined; |
3782 | + }; |
3783 | + } |
3784 | + |
3785 | + // Add elem as a property of the handle function |
3786 | + // This is to prevent a memory leak with non-native events in IE. |
3787 | + eventHandle.elem = elem; |
3788 | + |
3789 | + // Handle multiple events separated by a space |
3790 | + // jQuery(...).bind("mouseover mouseout", fn); |
3791 | + types = types.split(" "); |
3792 | + |
3793 | + var type, i = 0, namespaces; |
3794 | + |
3795 | + while ( (type = types[ i++ ]) ) { |
3796 | + handleObj = handleObjIn ? |
3797 | + jQuery.extend({}, handleObjIn) : |
3798 | + { handler: handler, data: data }; |
3799 | + |
3800 | + // Namespaced event handlers |
3801 | + if ( type.indexOf(".") > -1 ) { |
3802 | + namespaces = type.split("."); |
3803 | + type = namespaces.shift(); |
3804 | + handleObj.namespace = namespaces.slice(0).sort().join("."); |
3805 | + |
3806 | + } else { |
3807 | + namespaces = []; |
3808 | + handleObj.namespace = ""; |
3809 | + } |
3810 | + |
3811 | + handleObj.type = type; |
3812 | + if ( !handleObj.guid ) { |
3813 | + handleObj.guid = handler.guid; |
3814 | + } |
3815 | + |
3816 | + // Get the current list of functions bound to this event |
3817 | + var handlers = events[ type ], |
3818 | + special = jQuery.event.special[ type ] || {}; |
3819 | + |
3820 | + // Init the event handler queue |
3821 | + if ( !handlers ) { |
3822 | + handlers = events[ type ] = []; |
3823 | + |
3824 | + // Check for a special event handler |
3825 | + // Only use addEventListener/attachEvent if the special |
3826 | + // events handler returns false |
3827 | + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
3828 | + // Bind the global event handler to the element |
3829 | + if ( elem.addEventListener ) { |
3830 | + elem.addEventListener( type, eventHandle, false ); |
3831 | + |
3832 | + } else if ( elem.attachEvent ) { |
3833 | + elem.attachEvent( "on" + type, eventHandle ); |
3834 | + } |
3835 | + } |
3836 | + } |
3837 | + |
3838 | + if ( special.add ) { |
3839 | + special.add.call( elem, handleObj ); |
3840 | + |
3841 | + if ( !handleObj.handler.guid ) { |
3842 | + handleObj.handler.guid = handler.guid; |
3843 | + } |
3844 | + } |
3845 | + |
3846 | + // Add the function to the element's handler list |
3847 | + handlers.push( handleObj ); |
3848 | + |
3849 | + // Keep track of which events have been used, for event optimization |
3850 | + jQuery.event.global[ type ] = true; |
3851 | + } |
3852 | + |
3853 | + // Nullify elem to prevent memory leaks in IE |
3854 | + elem = null; |
3855 | + }, |
3856 | + |
3857 | + global: {}, |
3858 | + |
3859 | + // Detach an event or set of events from an element |
3860 | + remove: function( elem, types, handler, pos ) { |
3861 | + // don't do events on text and comment nodes |
3862 | + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
3863 | + return; |
3864 | + } |
3865 | + |
3866 | + if ( handler === false ) { |
3867 | + handler = returnFalse; |
3868 | + } |
3869 | + |
3870 | + var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, |
3871 | + elemData = jQuery.hasData( elem ) && jQuery._data( elem ), |
3872 | + events = elemData && elemData.events; |
3873 | + |
3874 | + if ( !elemData || !events ) { |
3875 | + return; |
3876 | + } |
3877 | + |
3878 | + // types is actually an event object here |
3879 | + if ( types && types.type ) { |
3880 | + handler = types.handler; |
3881 | + types = types.type; |
3882 | + } |
3883 | + |
3884 | + // Unbind all events for the element |
3885 | + if ( !types || typeof types === "string" && types.charAt(0) === "." ) { |
3886 | + types = types || ""; |
3887 | + |
3888 | + for ( type in events ) { |
3889 | + jQuery.event.remove( elem, type + types ); |
3890 | + } |
3891 | + |
3892 | + return; |
3893 | + } |
3894 | + |
3895 | + // Handle multiple events separated by a space |
3896 | + // jQuery(...).unbind("mouseover mouseout", fn); |
3897 | + types = types.split(" "); |
3898 | + |
3899 | + while ( (type = types[ i++ ]) ) { |
3900 | + origType = type; |
3901 | + handleObj = null; |
3902 | + all = type.indexOf(".") < 0; |
3903 | + namespaces = []; |
3904 | + |
3905 | + if ( !all ) { |
3906 | + // Namespaced event handlers |
3907 | + namespaces = type.split("."); |
3908 | + type = namespaces.shift(); |
3909 | + |
3910 | + namespace = new RegExp("(^|\\.)" + |
3911 | + jQuery.map( namespaces.slice(0).sort(), fcleanup ).join("\\.(?:.*\\.)?") + "(\\.|$)"); |
3912 | + } |
3913 | + |
3914 | + eventType = events[ type ]; |
3915 | + |
3916 | + if ( !eventType ) { |
3917 | + continue; |
3918 | + } |
3919 | + |
3920 | + if ( !handler ) { |
3921 | + for ( j = 0; j < eventType.length; j++ ) { |
3922 | + handleObj = eventType[ j ]; |
3923 | + |
3924 | + if ( all || namespace.test( handleObj.namespace ) ) { |
3925 | + jQuery.event.remove( elem, origType, handleObj.handler, j ); |
3926 | + eventType.splice( j--, 1 ); |
3927 | + } |
3928 | + } |
3929 | + |
3930 | + continue; |
3931 | + } |
3932 | + |
3933 | + special = jQuery.event.special[ type ] || {}; |
3934 | + |
3935 | + for ( j = pos || 0; j < eventType.length; j++ ) { |
3936 | + handleObj = eventType[ j ]; |
3937 | + |
3938 | + if ( handler.guid === handleObj.guid ) { |
3939 | + // remove the given handler for the given type |
3940 | + if ( all || namespace.test( handleObj.namespace ) ) { |
3941 | + if ( pos == null ) { |
3942 | + eventType.splice( j--, 1 ); |
3943 | + } |
3944 | + |
3945 | + if ( special.remove ) { |
3946 | + special.remove.call( elem, handleObj ); |
3947 | + } |
3948 | + } |
3949 | + |
3950 | + if ( pos != null ) { |
3951 | + break; |
3952 | + } |
3953 | + } |
3954 | + } |
3955 | + |
3956 | + // remove generic event handler if no more handlers exist |
3957 | + if ( eventType.length === 0 || pos != null && eventType.length === 1 ) { |
3958 | + if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { |
3959 | + jQuery.removeEvent( elem, type, elemData.handle ); |
3960 | + } |
3961 | + |
3962 | + ret = null; |
3963 | + delete events[ type ]; |
3964 | + } |
3965 | + } |
3966 | + |
3967 | + // Remove the expando if it's no longer used |
3968 | + if ( jQuery.isEmptyObject( events ) ) { |
3969 | + var handle = elemData.handle; |
3970 | + if ( handle ) { |
3971 | + handle.elem = null; |
3972 | + } |
3973 | + |
3974 | + delete elemData.events; |
3975 | + delete elemData.handle; |
3976 | + |
3977 | + if ( jQuery.isEmptyObject( elemData ) ) { |
3978 | + jQuery.removeData( elem, undefined, true ); |
3979 | + } |
3980 | + } |
3981 | + }, |
3982 | + |
3983 | + // Events that are safe to short-circuit if no handlers are attached. |
3984 | + // Native DOM events should not be added, they may have inline handlers. |
3985 | + customEvent: { |
3986 | + "getData": true, |
3987 | + "setData": true, |
3988 | + "changeData": true |
3989 | + }, |
3990 | + |
3991 | + trigger: function( event, data, elem, onlyHandlers ) { |
3992 | + // Event object or event type |
3993 | + var type = event.type || event, |
3994 | + namespaces = [], |
3995 | + exclusive; |
3996 | + |
3997 | + if ( type.indexOf("!") >= 0 ) { |
3998 | + // Exclusive events trigger only for the exact event (no namespaces) |
3999 | + type = type.slice(0, -1); |
4000 | + exclusive = true; |
4001 | + } |
4002 | + |
4003 | + if ( type.indexOf(".") >= 0 ) { |
4004 | + // Namespaced trigger; create a regexp to match event type in handle() |
4005 | + namespaces = type.split("."); |
4006 | + type = namespaces.shift(); |
4007 | + namespaces.sort(); |
4008 | + } |
4009 | + |
4010 | + if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { |
4011 | + // No jQuery handlers for this event type, and it can't have inline handlers |
4012 | + return; |
4013 | + } |
4014 | + |
4015 | + // Caller can pass in an Event, Object, or just an event type string |
4016 | + event = typeof event === "object" ? |
4017 | + // jQuery.Event object |
4018 | + event[ jQuery.expando ] ? event : |
4019 | + // Object literal |
4020 | + new jQuery.Event( type, event ) : |
4021 | + // Just the event type (string) |
4022 | + new jQuery.Event( type ); |
4023 | + |
4024 | + event.type = type; |
4025 | + event.exclusive = exclusive; |
4026 | + event.namespace = namespaces.join("."); |
4027 | + event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); |
4028 | + |
4029 | + // triggerHandler() and global events don't bubble or run the default action |
4030 | + if ( onlyHandlers || !elem ) { |
4031 | + event.preventDefault(); |
4032 | + event.stopPropagation(); |
4033 | + } |
4034 | + |
4035 | + // Handle a global trigger |
4036 | + if ( !elem ) { |
4037 | + // TODO: Stop taunting the data cache; remove global events and always attach to document |
4038 | + jQuery.each( jQuery.cache, function() { |
4039 | + // internalKey variable is just used to make it easier to find |
4040 | + // and potentially change this stuff later; currently it just |
4041 | + // points to jQuery.expando |
4042 | + var internalKey = jQuery.expando, |
4043 | + internalCache = this[ internalKey ]; |
4044 | + if ( internalCache && internalCache.events && internalCache.events[ type ] ) { |
4045 | + jQuery.event.trigger( event, data, internalCache.handle.elem ); |
4046 | + } |
4047 | + }); |
4048 | + return; |
4049 | + } |
4050 | + |
4051 | + // Don't do events on text and comment nodes |
4052 | + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
4053 | + return; |
4054 | + } |
4055 | + |
4056 | + // Clean up the event in case it is being reused |
4057 | + event.result = undefined; |
4058 | + event.target = elem; |
4059 | + |
4060 | + // Clone any incoming data and prepend the event, creating the handler arg list |
4061 | + data = data != null ? jQuery.makeArray( data ) : []; |
4062 | + data.unshift( event ); |
4063 | + |
4064 | + var cur = elem, |
4065 | + // IE doesn't like method names with a colon (#3533, #8272) |
4066 | + ontype = type.indexOf(":") < 0 ? "on" + type : ""; |
4067 | + |
4068 | + // Fire event on the current element, then bubble up the DOM tree |
4069 | + do { |
4070 | + var handle = jQuery._data( cur, "handle" ); |
4071 | + |
4072 | + event.currentTarget = cur; |
4073 | + if ( handle ) { |
4074 | + handle.apply( cur, data ); |
4075 | + } |
4076 | + |
4077 | + // Trigger an inline bound script |
4078 | + if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { |
4079 | + event.result = false; |
4080 | + event.preventDefault(); |
4081 | + } |
4082 | + |
4083 | + // Bubble up to document, then to window |
4084 | + cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; |
4085 | + } while ( cur && !event.isPropagationStopped() ); |
4086 | + |
4087 | + // If nobody prevented the default action, do it now |
4088 | + if ( !event.isDefaultPrevented() ) { |
4089 | + var old, |
4090 | + special = jQuery.event.special[ type ] || {}; |
4091 | + |
4092 | + if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && |
4093 | + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { |
4094 | + |
4095 | + // Call a native DOM method on the target with the same name name as the event. |
4096 | + // Can't use an .isFunction)() check here because IE6/7 fails that test. |
4097 | + // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. |
4098 | + try { |
4099 | + if ( ontype && elem[ type ] ) { |
4100 | + // Don't re-trigger an onFOO event when we call its FOO() method |
4101 | + old = elem[ ontype ]; |
4102 | + |
4103 | + if ( old ) { |
4104 | + elem[ ontype ] = null; |
4105 | + } |
4106 | + |
4107 | + jQuery.event.triggered = type; |
4108 | + elem[ type ](); |
4109 | + } |
4110 | + } catch ( ieError ) {} |
4111 | + |
4112 | + if ( old ) { |
4113 | + elem[ ontype ] = old; |
4114 | + } |
4115 | + |
4116 | + jQuery.event.triggered = undefined; |
4117 | + } |
4118 | + } |
4119 | + |
4120 | + return event.result; |
4121 | + }, |
4122 | + |
4123 | + handle: function( event ) { |
4124 | + event = jQuery.event.fix( event || window.event ); |
4125 | + // Snapshot the handlers list since a called handler may add/remove events. |
4126 | + var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), |
4127 | + run_all = !event.exclusive && !event.namespace, |
4128 | + args = Array.prototype.slice.call( arguments, 0 ); |
4129 | + |
4130 | + // Use the fix-ed Event rather than the (read-only) native event |
4131 | + args[0] = event; |
4132 | + event.currentTarget = this; |
4133 | + |
4134 | + for ( var j = 0, l = handlers.length; j < l; j++ ) { |
4135 | + var handleObj = handlers[ j ]; |
4136 | + |
4137 | + // Triggered event must 1) be non-exclusive and have no namespace, or |
4138 | + // 2) have namespace(s) a subset or equal to those in the bound event. |
4139 | + if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { |
4140 | + // Pass in a reference to the handler function itself |
4141 | + // So that we can later remove it |
4142 | + event.handler = handleObj.handler; |
4143 | + event.data = handleObj.data; |
4144 | + event.handleObj = handleObj; |
4145 | + |
4146 | + var ret = handleObj.handler.apply( this, args ); |
4147 | + |
4148 | + if ( ret !== undefined ) { |
4149 | + event.result = ret; |
4150 | + if ( ret === false ) { |
4151 | + event.preventDefault(); |
4152 | + event.stopPropagation(); |
4153 | + } |
4154 | + } |
4155 | + |
4156 | + if ( event.isImmediatePropagationStopped() ) { |
4157 | + break; |
4158 | + } |
4159 | + } |
4160 | + } |
4161 | + return event.result; |
4162 | + }, |
4163 | + |
4164 | + props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
4165 | + |
4166 | + fix: function( event ) { |
4167 | + if ( event[ jQuery.expando ] ) { |
4168 | + return event; |
4169 | + } |
4170 | + |
4171 | + // store a copy of the original event object |
4172 | + // and "clone" to set read-only properties |
4173 | + var originalEvent = event; |
4174 | + event = jQuery.Event( originalEvent ); |
4175 | + |
4176 | + for ( var i = this.props.length, prop; i; ) { |
4177 | + prop = this.props[ --i ]; |
4178 | + event[ prop ] = originalEvent[ prop ]; |
4179 | + } |
4180 | + |
4181 | + // Fix target property, if necessary |
4182 | + if ( !event.target ) { |
4183 | + // Fixes #1925 where srcElement might not be defined either |
4184 | + event.target = event.srcElement || document; |
4185 | + } |
4186 | + |
4187 | + // check if target is a textnode (safari) |
4188 | + if ( event.target.nodeType === 3 ) { |
4189 | + event.target = event.target.parentNode; |
4190 | + } |
4191 | + |
4192 | + // Add relatedTarget, if necessary |
4193 | + if ( !event.relatedTarget && event.fromElement ) { |
4194 | + event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
4195 | + } |
4196 | + |
4197 | + // Calculate pageX/Y if missing and clientX/Y available |
4198 | + if ( event.pageX == null && event.clientX != null ) { |
4199 | + var eventDocument = event.target.ownerDocument || document, |
4200 | + doc = eventDocument.documentElement, |
4201 | + body = eventDocument.body; |
4202 | + |
4203 | + event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
4204 | + event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
4205 | + } |
4206 | + |
4207 | + // Add which for key events |
4208 | + if ( event.which == null && (event.charCode != null || event.keyCode != null) ) { |
4209 | + event.which = event.charCode != null ? event.charCode : event.keyCode; |
4210 | + } |
4211 | + |
4212 | + // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) |
4213 | + if ( !event.metaKey && event.ctrlKey ) { |
4214 | + event.metaKey = event.ctrlKey; |
4215 | + } |
4216 | + |
4217 | + // Add which for click: 1 === left; 2 === middle; 3 === right |
4218 | + // Note: button is not normalized, so don't use it |
4219 | + if ( !event.which && event.button !== undefined ) { |
4220 | + event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); |
4221 | + } |
4222 | + |
4223 | + return event; |
4224 | + }, |
4225 | + |
4226 | + // Deprecated, use jQuery.guid instead |
4227 | + guid: 1E8, |
4228 | + |
4229 | + // Deprecated, use jQuery.proxy instead |
4230 | + proxy: jQuery.proxy, |
4231 | + |
4232 | + special: { |
4233 | + ready: { |
4234 | + // Make sure the ready event is setup |
4235 | + setup: jQuery.bindReady, |
4236 | + teardown: jQuery.noop |
4237 | + }, |
4238 | + |
4239 | + live: { |
4240 | + add: function( handleObj ) { |
4241 | + jQuery.event.add( this, |
4242 | + liveConvert( handleObj.origType, handleObj.selector ), |
4243 | + jQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) ); |
4244 | + }, |
4245 | + |
4246 | + remove: function( handleObj ) { |
4247 | + jQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj ); |
4248 | + } |
4249 | + }, |
4250 | + |
4251 | + beforeunload: { |
4252 | + setup: function( data, namespaces, eventHandle ) { |
4253 | + // We only want to do this special case on windows |
4254 | + if ( jQuery.isWindow( this ) ) { |
4255 | + this.onbeforeunload = eventHandle; |
4256 | + } |
4257 | + }, |
4258 | + |
4259 | + teardown: function( namespaces, eventHandle ) { |
4260 | + if ( this.onbeforeunload === eventHandle ) { |
4261 | + this.onbeforeunload = null; |
4262 | + } |
4263 | + } |
4264 | + } |
4265 | + } |
4266 | +}; |
4267 | + |
4268 | +jQuery.removeEvent = document.removeEventListener ? |
4269 | + function( elem, type, handle ) { |
4270 | + if ( elem.removeEventListener ) { |
4271 | + elem.removeEventListener( type, handle, false ); |
4272 | + } |
4273 | + } : |
4274 | + function( elem, type, handle ) { |
4275 | + if ( elem.detachEvent ) { |
4276 | + elem.detachEvent( "on" + type, handle ); |
4277 | + } |
4278 | + }; |
4279 | + |
4280 | +jQuery.Event = function( src, props ) { |
4281 | + // Allow instantiation without the 'new' keyword |
4282 | + if ( !this.preventDefault ) { |
4283 | + return new jQuery.Event( src, props ); |
4284 | + } |
4285 | + |
4286 | + // Event object |
4287 | + if ( src && src.type ) { |
4288 | + this.originalEvent = src; |
4289 | + this.type = src.type; |
4290 | + |
4291 | + // Events bubbling up the document may have been marked as prevented |
4292 | + // by a handler lower down the tree; reflect the correct value. |
4293 | + this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || |
4294 | + src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; |
4295 | + |
4296 | + // Event type |
4297 | + } else { |
4298 | + this.type = src; |
4299 | + } |
4300 | + |
4301 | + // Put explicitly provided properties onto the event object |
4302 | + if ( props ) { |
4303 | + jQuery.extend( this, props ); |
4304 | + } |
4305 | + |
4306 | + // timeStamp is buggy for some events on Firefox(#3843) |
4307 | + // So we won't rely on the native value |
4308 | + this.timeStamp = jQuery.now(); |
4309 | + |
4310 | + // Mark it as fixed |
4311 | + this[ jQuery.expando ] = true; |
4312 | +}; |
4313 | + |
4314 | +function returnFalse() { |
4315 | + return false; |
4316 | +} |
4317 | +function returnTrue() { |
4318 | + return true; |
4319 | +} |
4320 | + |
4321 | +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
4322 | +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
4323 | +jQuery.Event.prototype = { |
4324 | + preventDefault: function() { |
4325 | + this.isDefaultPrevented = returnTrue; |
4326 | + |
4327 | + var e = this.originalEvent; |
4328 | + if ( !e ) { |
4329 | + return; |
4330 | + } |
4331 | + |
4332 | + // if preventDefault exists run it on the original event |
4333 | + if ( e.preventDefault ) { |
4334 | + e.preventDefault(); |
4335 | + |
4336 | + // otherwise set the returnValue property of the original event to false (IE) |
4337 | + } else { |
4338 | + e.returnValue = false; |
4339 | + } |
4340 | + }, |
4341 | + stopPropagation: function() { |
4342 | + this.isPropagationStopped = returnTrue; |
4343 | + |
4344 | + var e = this.originalEvent; |
4345 | + if ( !e ) { |
4346 | + return; |
4347 | + } |
4348 | + // if stopPropagation exists run it on the original event |
4349 | + if ( e.stopPropagation ) { |
4350 | + e.stopPropagation(); |
4351 | + } |
4352 | + // otherwise set the cancelBubble property of the original event to true (IE) |
4353 | + e.cancelBubble = true; |
4354 | + }, |
4355 | + stopImmediatePropagation: function() { |
4356 | + this.isImmediatePropagationStopped = returnTrue; |
4357 | + this.stopPropagation(); |
4358 | + }, |
4359 | + isDefaultPrevented: returnFalse, |
4360 | + isPropagationStopped: returnFalse, |
4361 | + isImmediatePropagationStopped: returnFalse |
4362 | +}; |
4363 | + |
4364 | +// Checks if an event happened on an element within another element |
4365 | +// Used in jQuery.event.special.mouseenter and mouseleave handlers |
4366 | +var withinElement = function( event ) { |
4367 | + |
4368 | + // Check if mouse(over|out) are still within the same parent element |
4369 | + var related = event.relatedTarget, |
4370 | + inside = false, |
4371 | + eventType = event.type; |
4372 | + |
4373 | + event.type = event.data; |
4374 | + |
4375 | + if ( related !== this ) { |
4376 | + |
4377 | + if ( related ) { |
4378 | + inside = jQuery.contains( this, related ); |
4379 | + } |
4380 | + |
4381 | + if ( !inside ) { |
4382 | + |
4383 | + jQuery.event.handle.apply( this, arguments ); |
4384 | + |
4385 | + event.type = eventType; |
4386 | + } |
4387 | + } |
4388 | +}, |
4389 | + |
4390 | +// In case of event delegation, we only need to rename the event.type, |
4391 | +// liveHandler will take care of the rest. |
4392 | +delegate = function( event ) { |
4393 | + event.type = event.data; |
4394 | + jQuery.event.handle.apply( this, arguments ); |
4395 | +}; |
4396 | + |
4397 | +// Create mouseenter and mouseleave events |
4398 | +jQuery.each({ |
4399 | + mouseenter: "mouseover", |
4400 | + mouseleave: "mouseout" |
4401 | +}, function( orig, fix ) { |
4402 | + jQuery.event.special[ orig ] = { |
4403 | + setup: function( data ) { |
4404 | + jQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig ); |
4405 | + }, |
4406 | + teardown: function( data ) { |
4407 | + jQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement ); |
4408 | + } |
4409 | + }; |
4410 | +}); |
4411 | + |
4412 | +// submit delegation |
4413 | +if ( !jQuery.support.submitBubbles ) { |
4414 | + |
4415 | + jQuery.event.special.submit = { |
4416 | + setup: function( data, namespaces ) { |
4417 | + if ( !jQuery.nodeName( this, "form" ) ) { |
4418 | + jQuery.event.add(this, "click.specialSubmit", function( e ) { |
4419 | + var elem = e.target, |
4420 | + type = elem.type; |
4421 | + |
4422 | + if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
4423 | + trigger( "submit", this, arguments ); |
4424 | + } |
4425 | + }); |
4426 | + |
4427 | + jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
4428 | + var elem = e.target, |
4429 | + type = elem.type; |
4430 | + |
4431 | + if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
4432 | + trigger( "submit", this, arguments ); |
4433 | + } |
4434 | + }); |
4435 | + |
4436 | + } else { |
4437 | + return false; |
4438 | + } |
4439 | + }, |
4440 | + |
4441 | + teardown: function( namespaces ) { |
4442 | + jQuery.event.remove( this, ".specialSubmit" ); |
4443 | + } |
4444 | + }; |
4445 | + |
4446 | +} |
4447 | + |
4448 | +// change delegation, happens here so we have bind. |
4449 | +if ( !jQuery.support.changeBubbles ) { |
4450 | + |
4451 | + var changeFilters, |
4452 | + |
4453 | + getVal = function( elem ) { |
4454 | + var type = elem.type, val = elem.value; |
4455 | + |
4456 | + if ( type === "radio" || type === "checkbox" ) { |
4457 | + val = elem.checked; |
4458 | + |
4459 | + } else if ( type === "select-multiple" ) { |
4460 | + val = elem.selectedIndex > -1 ? |
4461 | + jQuery.map( elem.options, function( elem ) { |
4462 | + return elem.selected; |
4463 | + }).join("-") : |
4464 | + ""; |
4465 | + |
4466 | + } else if ( jQuery.nodeName( elem, "select" ) ) { |
4467 | + val = elem.selectedIndex; |
4468 | + } |
4469 | + |
4470 | + return val; |
4471 | + }, |
4472 | + |
4473 | + testChange = function testChange( e ) { |
4474 | + var elem = e.target, data, val; |
4475 | + |
4476 | + if ( !rformElems.test( elem.nodeName ) || elem.readOnly ) { |
4477 | + return; |
4478 | + } |
4479 | + |
4480 | + data = jQuery._data( elem, "_change_data" ); |
4481 | + val = getVal(elem); |
4482 | + |
4483 | + // the current data will be also retrieved by beforeactivate |
4484 | + if ( e.type !== "focusout" || elem.type !== "radio" ) { |
4485 | + jQuery._data( elem, "_change_data", val ); |
4486 | + } |
4487 | + |
4488 | + if ( data === undefined || val === data ) { |
4489 | + return; |
4490 | + } |
4491 | + |
4492 | + if ( data != null || val ) { |
4493 | + e.type = "change"; |
4494 | + e.liveFired = undefined; |
4495 | + jQuery.event.trigger( e, arguments[1], elem ); |
4496 | + } |
4497 | + }; |
4498 | + |
4499 | + jQuery.event.special.change = { |
4500 | + filters: { |
4501 | + focusout: testChange, |
4502 | + |
4503 | + beforedeactivate: testChange, |
4504 | + |
4505 | + click: function( e ) { |
4506 | + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; |
4507 | + |
4508 | + if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { |
4509 | + testChange.call( this, e ); |
4510 | + } |
4511 | + }, |
4512 | + |
4513 | + // Change has to be called before submit |
4514 | + // Keydown will be called before keypress, which is used in submit-event delegation |
4515 | + keydown: function( e ) { |
4516 | + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; |
4517 | + |
4518 | + if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || |
4519 | + (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || |
4520 | + type === "select-multiple" ) { |
4521 | + testChange.call( this, e ); |
4522 | + } |
4523 | + }, |
4524 | + |
4525 | + // Beforeactivate happens also before the previous element is blurred |
4526 | + // with this event you can't trigger a change event, but you can store |
4527 | + // information |
4528 | + beforeactivate: function( e ) { |
4529 | + var elem = e.target; |
4530 | + jQuery._data( elem, "_change_data", getVal(elem) ); |
4531 | + } |
4532 | + }, |
4533 | + |
4534 | + setup: function( data, namespaces ) { |
4535 | + if ( this.type === "file" ) { |
4536 | + return false; |
4537 | + } |
4538 | + |
4539 | + for ( var type in changeFilters ) { |
4540 | + jQuery.event.add( this, type + ".specialChange", changeFilters[type] ); |
4541 | + } |
4542 | + |
4543 | + return rformElems.test( this.nodeName ); |
4544 | + }, |
4545 | + |
4546 | + teardown: function( namespaces ) { |
4547 | + jQuery.event.remove( this, ".specialChange" ); |
4548 | + |
4549 | + return rformElems.test( this.nodeName ); |
4550 | + } |
4551 | + }; |
4552 | + |
4553 | + changeFilters = jQuery.event.special.change.filters; |
4554 | + |
4555 | + // Handle when the input is .focus()'d |
4556 | + changeFilters.focus = changeFilters.beforeactivate; |
4557 | +} |
4558 | + |
4559 | +function trigger( type, elem, args ) { |
4560 | + // Piggyback on a donor event to simulate a different one. |
4561 | + // Fake originalEvent to avoid donor's stopPropagation, but if the |
4562 | + // simulated event prevents default then we do the same on the donor. |
4563 | + // Don't pass args or remember liveFired; they apply to the donor event. |
4564 | + var event = jQuery.extend( {}, args[ 0 ] ); |
4565 | + event.type = type; |
4566 | + event.originalEvent = {}; |
4567 | + event.liveFired = undefined; |
4568 | + jQuery.event.handle.call( elem, event ); |
4569 | + if ( event.isDefaultPrevented() ) { |
4570 | + args[ 0 ].preventDefault(); |
4571 | + } |
4572 | +} |
4573 | + |
4574 | +// Create "bubbling" focus and blur events |
4575 | +if ( !jQuery.support.focusinBubbles ) { |
4576 | + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
4577 | + |
4578 | + // Attach a single capturing handler while someone wants focusin/focusout |
4579 | + var attaches = 0; |
4580 | + |
4581 | + jQuery.event.special[ fix ] = { |
4582 | + setup: function() { |
4583 | + if ( attaches++ === 0 ) { |
4584 | + document.addEventListener( orig, handler, true ); |
4585 | + } |
4586 | + }, |
4587 | + teardown: function() { |
4588 | + if ( --attaches === 0 ) { |
4589 | + document.removeEventListener( orig, handler, true ); |
4590 | + } |
4591 | + } |
4592 | + }; |
4593 | + |
4594 | + function handler( donor ) { |
4595 | + // Donor event is always a native one; fix it and switch its type. |
4596 | + // Let focusin/out handler cancel the donor focus/blur event. |
4597 | + var e = jQuery.event.fix( donor ); |
4598 | + e.type = fix; |
4599 | + e.originalEvent = {}; |
4600 | + jQuery.event.trigger( e, null, e.target ); |
4601 | + if ( e.isDefaultPrevented() ) { |
4602 | + donor.preventDefault(); |
4603 | + } |
4604 | + } |
4605 | + }); |
4606 | +} |
4607 | + |
4608 | +jQuery.each(["bind", "one"], function( i, name ) { |
4609 | + jQuery.fn[ name ] = function( type, data, fn ) { |
4610 | + var handler; |
4611 | + |
4612 | + // Handle object literals |
4613 | + if ( typeof type === "object" ) { |
4614 | + for ( var key in type ) { |
4615 | + this[ name ](key, data, type[key], fn); |
4616 | + } |
4617 | + return this; |
4618 | + } |
4619 | + |
4620 | + if ( arguments.length === 2 || data === false ) { |
4621 | + fn = data; |
4622 | + data = undefined; |
4623 | + } |
4624 | + |
4625 | + if ( name === "one" ) { |
4626 | + handler = function( event ) { |
4627 | + jQuery( this ).unbind( event, handler ); |
4628 | + return fn.apply( this, arguments ); |
4629 | + }; |
4630 | + handler.guid = fn.guid || jQuery.guid++; |
4631 | + } else { |
4632 | + handler = fn; |
4633 | + } |
4634 | + |
4635 | + if ( type === "unload" && name !== "one" ) { |
4636 | + this.one( type, data, fn ); |
4637 | + |
4638 | + } else { |
4639 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
4640 | + jQuery.event.add( this[i], type, handler, data ); |
4641 | + } |
4642 | + } |
4643 | + |
4644 | + return this; |
4645 | + }; |
4646 | +}); |
4647 | + |
4648 | +jQuery.fn.extend({ |
4649 | + unbind: function( type, fn ) { |
4650 | + // Handle object literals |
4651 | + if ( typeof type === "object" && !type.preventDefault ) { |
4652 | + for ( var key in type ) { |
4653 | + this.unbind(key, type[key]); |
4654 | + } |
4655 | + |
4656 | + } else { |
4657 | + for ( var i = 0, l = this.length; i < l; i++ ) { |
4658 | + jQuery.event.remove( this[i], type, fn ); |
4659 | + } |
4660 | + } |
4661 | + |
4662 | + return this; |
4663 | + }, |
4664 | + |
4665 | + delegate: function( selector, types, data, fn ) { |
4666 | + return this.live( types, data, fn, selector ); |
4667 | + }, |
4668 | + |
4669 | + undelegate: function( selector, types, fn ) { |
4670 | + if ( arguments.length === 0 ) { |
4671 | + return this.unbind( "live" ); |
4672 | + |
4673 | + } else { |
4674 | + return this.die( types, null, fn, selector ); |
4675 | + } |
4676 | + }, |
4677 | + |
4678 | + trigger: function( type, data ) { |
4679 | + return this.each(function() { |
4680 | + jQuery.event.trigger( type, data, this ); |
4681 | + }); |
4682 | + }, |
4683 | + |
4684 | + triggerHandler: function( type, data ) { |
4685 | + if ( this[0] ) { |
4686 | + return jQuery.event.trigger( type, data, this[0], true ); |
4687 | + } |
4688 | + }, |
4689 | + |
4690 | + toggle: function( fn ) { |
4691 | + // Save reference to arguments for access in closure |
4692 | + var args = arguments, |
4693 | + guid = fn.guid || jQuery.guid++, |
4694 | + i = 0, |
4695 | + toggler = function( event ) { |
4696 | + // Figure out which function to execute |
4697 | + var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
4698 | + jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
4699 | + |
4700 | + // Make sure that clicks stop |
4701 | + event.preventDefault(); |
4702 | + |
4703 | + // and execute the function |
4704 | + return args[ lastToggle ].apply( this, arguments ) || false; |
4705 | + }; |
4706 | + |
4707 | + // link all the functions, so any of them can unbind this click handler |
4708 | + toggler.guid = guid; |
4709 | + while ( i < args.length ) { |
4710 | + args[ i++ ].guid = guid; |
4711 | + } |
4712 | + |
4713 | + return this.click( toggler ); |
4714 | + }, |
4715 | + |
4716 | + hover: function( fnOver, fnOut ) { |
4717 | + return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
4718 | + } |
4719 | +}); |
4720 | + |
4721 | +var liveMap = { |
4722 | + focus: "focusin", |
4723 | + blur: "focusout", |
4724 | + mouseenter: "mouseover", |
4725 | + mouseleave: "mouseout" |
4726 | +}; |
4727 | + |
4728 | +jQuery.each(["live", "die"], function( i, name ) { |
4729 | + jQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) { |
4730 | + var type, i = 0, match, namespaces, preType, |
4731 | + selector = origSelector || this.selector, |
4732 | + context = origSelector ? this : jQuery( this.context ); |
4733 | + |
4734 | + if ( typeof types === "object" && !types.preventDefault ) { |
4735 | + for ( var key in types ) { |
4736 | + context[ name ]( key, data, types[key], selector ); |
4737 | + } |
4738 | + |
4739 | + return this; |
4740 | + } |
4741 | + |
4742 | + if ( name === "die" && !types && |
4743 | + origSelector && origSelector.charAt(0) === "." ) { |
4744 | + |
4745 | + context.unbind( origSelector ); |
4746 | + |
4747 | + return this; |
4748 | + } |
4749 | + |
4750 | + if ( data === false || jQuery.isFunction( data ) ) { |
4751 | + fn = data || returnFalse; |
4752 | + data = undefined; |
4753 | + } |
4754 | + |
4755 | + types = (types || "").split(" "); |
4756 | + |
4757 | + while ( (type = types[ i++ ]) != null ) { |
4758 | + match = rnamespaces.exec( type ); |
4759 | + namespaces = ""; |
4760 | + |
4761 | + if ( match ) { |
4762 | + namespaces = match[0]; |
4763 | + type = type.replace( rnamespaces, "" ); |
4764 | + } |
4765 | + |
4766 | + if ( type === "hover" ) { |
4767 | + types.push( "mouseenter" + namespaces, "mouseleave" + namespaces ); |
4768 | + continue; |
4769 | + } |
4770 | + |
4771 | + preType = type; |
4772 | + |
4773 | + if ( liveMap[ type ] ) { |
4774 | + types.push( liveMap[ type ] + namespaces ); |
4775 | + type = type + namespaces; |
4776 | + |
4777 | + } else { |
4778 | + type = (liveMap[ type ] || type) + namespaces; |
4779 | + } |
4780 | + |
4781 | + if ( name === "live" ) { |
4782 | + // bind live handler |
4783 | + for ( var j = 0, l = context.length; j < l; j++ ) { |
4784 | + jQuery.event.add( context[j], "live." + liveConvert( type, selector ), |
4785 | + { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } ); |
4786 | + } |
4787 | + |
4788 | + } else { |
4789 | + // unbind live handler |
4790 | + context.unbind( "live." + liveConvert( type, selector ), fn ); |
4791 | + } |
4792 | + } |
4793 | + |
4794 | + return this; |
4795 | + }; |
4796 | +}); |
4797 | + |
4798 | +function liveHandler( event ) { |
4799 | + var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, |
4800 | + elems = [], |
4801 | + selectors = [], |
4802 | + events = jQuery._data( this, "events" ); |
4803 | + |
4804 | + // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) |
4805 | + if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { |
4806 | + return; |
4807 | + } |
4808 | + |
4809 | + if ( event.namespace ) { |
4810 | + namespace = new RegExp("(^|\\.)" + event.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)"); |
4811 | + } |
4812 | + |
4813 | + event.liveFired = this; |
4814 | + |
4815 | + var live = events.live.slice(0); |
4816 | + |
4817 | + for ( j = 0; j < live.length; j++ ) { |
4818 | + handleObj = live[j]; |
4819 | + |
4820 | + if ( handleObj.origType.replace( rnamespaces, "" ) === event.type ) { |
4821 | + selectors.push( handleObj.selector ); |
4822 | + |
4823 | + } else { |
4824 | + live.splice( j--, 1 ); |
4825 | + } |
4826 | + } |
4827 | + |
4828 | + match = jQuery( event.target ).closest( selectors, event.currentTarget ); |
4829 | + |
4830 | + for ( i = 0, l = match.length; i < l; i++ ) { |
4831 | + close = match[i]; |
4832 | + |
4833 | + for ( j = 0; j < live.length; j++ ) { |
4834 | + handleObj = live[j]; |
4835 | + |
4836 | + if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { |
4837 | + elem = close.elem; |
4838 | + related = null; |
4839 | + |
4840 | + // Those two events require additional checking |
4841 | + if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { |
4842 | + event.type = handleObj.preType; |
4843 | + related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; |
4844 | + |
4845 | + // Make sure not to accidentally match a child element with the same selector |
4846 | + if ( related && jQuery.contains( elem, related ) ) { |
4847 | + related = elem; |
4848 | + } |
4849 | + } |
4850 | + |
4851 | + if ( !related || related !== elem ) { |
4852 | + elems.push({ elem: elem, handleObj: handleObj, level: close.level }); |
4853 | + } |
4854 | + } |
4855 | + } |
4856 | + } |
4857 | + |
4858 | + for ( i = 0, l = elems.length; i < l; i++ ) { |
4859 | + match = elems[i]; |
4860 | + |
4861 | + if ( maxLevel && match.level > maxLevel ) { |
4862 | + break; |
4863 | + } |
4864 | + |
4865 | + event.currentTarget = match.elem; |
4866 | + event.data = match.handleObj.data; |
4867 | + event.handleObj = match.handleObj; |
4868 | + |
4869 | + ret = match.handleObj.origHandler.apply( match.elem, arguments ); |
4870 | + |
4871 | + if ( ret === false || event.isPropagationStopped() ) { |
4872 | + maxLevel = match.level; |
4873 | + |
4874 | + if ( ret === false ) { |
4875 | + stop = false; |
4876 | + } |
4877 | + if ( event.isImmediatePropagationStopped() ) { |
4878 | + break; |
4879 | + } |
4880 | + } |
4881 | + } |
4882 | + |
4883 | + return stop; |
4884 | +} |
4885 | + |
4886 | +function liveConvert( type, selector ) { |
4887 | + return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&"); |
4888 | +} |
4889 | + |
4890 | +jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
4891 | + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
4892 | + "change select submit keydown keypress keyup error").split(" "), function( i, name ) { |
4893 | + |
4894 | + // Handle event binding |
4895 | + jQuery.fn[ name ] = function( data, fn ) { |
4896 | + if ( fn == null ) { |
4897 | + fn = data; |
4898 | + data = null; |
4899 | + } |
4900 | + |
4901 | + return arguments.length > 0 ? |
4902 | + this.bind( name, data, fn ) : |
4903 | + this.trigger( name ); |
4904 | + }; |
4905 | + |
4906 | + if ( jQuery.attrFn ) { |
4907 | + jQuery.attrFn[ name ] = true; |
4908 | + } |
4909 | +}); |
4910 | + |
4911 | + |
4912 | + |
4913 | +/*! |
4914 | + * Sizzle CSS Selector Engine |
4915 | + * Copyright 2011, The Dojo Foundation |
4916 | * Released under the MIT, BSD, and GPL Licenses. |
4917 | * More information: http://sizzlejs.com/ |
4918 | */ |
4919 | (function(){ |
4920 | |
4921 | -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g, |
4922 | +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, |
4923 | done = 0, |
4924 | - toString = Object.prototype.toString; |
4925 | - |
4926 | -var Sizzle = function(selector, context, results, seed) { |
4927 | + toString = Object.prototype.toString, |
4928 | + hasDuplicate = false, |
4929 | + baseHasDuplicate = true, |
4930 | + rBackslash = /\\/g, |
4931 | + rNonWord = /\W/; |
4932 | + |
4933 | +// Here we check if the JavaScript engine is using some sort of |
4934 | +// optimization where it does not always call our comparision |
4935 | +// function. If that is the case, discard the hasDuplicate value. |
4936 | +// Thus far that includes Google Chrome. |
4937 | +[0, 0].sort(function() { |
4938 | + baseHasDuplicate = false; |
4939 | + return 0; |
4940 | +}); |
4941 | + |
4942 | +var Sizzle = function( selector, context, results, seed ) { |
4943 | results = results || []; |
4944 | context = context || document; |
4945 | |
4946 | - if ( context.nodeType !== 1 && context.nodeType !== 9 ) |
4947 | + var origContext = context; |
4948 | + |
4949 | + if ( context.nodeType !== 1 && context.nodeType !== 9 ) { |
4950 | return []; |
4951 | + } |
4952 | |
4953 | if ( !selector || typeof selector !== "string" ) { |
4954 | return results; |
4955 | } |
4956 | |
4957 | - var parts = [], m, set, checkSet, check, mode, extra, prune = true; |
4958 | + var m, set, checkSet, extra, ret, cur, pop, i, |
4959 | + prune = true, |
4960 | + contextXML = Sizzle.isXML( context ), |
4961 | + parts = [], |
4962 | + soFar = selector; |
4963 | |
4964 | // Reset the position of the chunker regexp (start from head) |
4965 | - chunker.lastIndex = 0; |
4966 | - |
4967 | - while ( (m = chunker.exec(selector)) !== null ) { |
4968 | - parts.push( m[1] ); |
4969 | - |
4970 | - if ( m[2] ) { |
4971 | - extra = RegExp.rightContext; |
4972 | - break; |
4973 | + do { |
4974 | + chunker.exec( "" ); |
4975 | + m = chunker.exec( soFar ); |
4976 | + |
4977 | + if ( m ) { |
4978 | + soFar = m[3]; |
4979 | + |
4980 | + parts.push( m[1] ); |
4981 | + |
4982 | + if ( m[2] ) { |
4983 | + extra = m[3]; |
4984 | + break; |
4985 | + } |
4986 | } |
4987 | - } |
4988 | + } while ( m ); |
4989 | |
4990 | if ( parts.length > 1 && origPOS.exec( selector ) ) { |
4991 | + |
4992 | if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { |
4993 | set = posProcess( parts[0] + parts[1], context ); |
4994 | + |
4995 | } else { |
4996 | set = Expr.relative[ parts[0] ] ? |
4997 | [ context ] : |
4998 | @@ -1458,38 +3804,61 @@ |
4999 | while ( parts.length ) { |
5000 | selector = parts.shift(); |
Well, I didn't review any code because you just updated jQuery stuff -- the app seems to run fine.