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