Редакция 109 | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 109 | Редакция 175 | ||
---|---|---|---|
Строка 4... | Строка 4... | ||
4 | *
|
4 | *
|
5 | * Copyright (c) 2009 John Resig
|
5 | * Copyright (c) 2009 John Resig
|
6 | * Dual licensed under the MIT and GPL licenses.
|
6 | * Dual licensed under the MIT and GPL licenses.
|
7 | * http://docs.jquery.com/License
|
7 | * http://docs.jquery.com/License
|
8 | *
|
8 | *
|
9 | * Date: 2009-03-28 00:20:57 +0600 (Сбт, 28 Мар 2009)
|
9 | * Date: 2009-04-01 00:35:20 +0700 (Срд, 01 Апр 2009)
|
10 | * Revision: 6301
|
10 | * Revision: 6303
|
11 | */
|
11 | */
|
12 | (function(){ |
12 | (function(){ |
13 | 13 | ||
14 | var
|
- | |
15 | // Will speed up references to window, and allows munging its name.
|
14 | // Will speed up references to window, and allows munging its name.
|
16 | window = this, |
15 | var window = this, |
- | 16 | ||
17 | // Will speed up references to undefined, and allows munging its name.
|
17 | // Will speed up references to undefined, and allows munging its name.
|
18 | undefined, |
18 | undefined, |
- | 19 | ||
19 | // Map over jQuery in case of overwrite
|
20 | // Map over jQuery in case of overwrite
|
20 | _jQuery = window.jQuery, |
21 | _jQuery = window.jQuery, |
- | 22 | ||
21 | // Map over the $ in case of overwrite
|
23 | // Map over the $ in case of overwrite
|
22 | _$ = window.$, |
24 | _$ = window.$, |
23 | 25 | ||
- | 26 | // Define a local copy of jQuery
|
|
- | 27 | jQuery,
|
|
- | 28 | ||
- | 29 | // A central reference to the root jQuery(document)
|
|
- | 30 | rootjQuery,
|
|
- | 31 | ||
24 | jQuery = window.jQuery = window.$ = function( selector, context ) { |
32 | jQuery = window.jQuery = window.$ = function( selector, context ) { |
25 | // The jQuery object is actually just the init constructor 'enhanced'
|
33 | // The jQuery object is actually just the init constructor 'enhanced'
|
26 | return selector === undefined ? |
34 | return selector === undefined ? |
27 | rootjQuery :
|
35 | rootjQuery :
|
28 | new jQuery.fn.init( selector, context ); |
36 | new jQuery.fn.init( selector, context ); |
29 | }, |
37 | }, |
30 | 38 | ||
31 | // A simple way to check for HTML strings or ID strings
|
39 | // A simple way to check for HTML strings or ID strings
|
32 | // (both of which we optimize for)
|
40 | // (both of which we optimize for)
|
33 | quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
41 | quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, |
- | 42 | ||
34 | // Is it a simple selector
|
43 | // Is it a simple selector
|
35 | isSimple = /^.[^:#\[\.,]*$/; |
44 | isSimple = /^.[^:#\[\.,]*$/, |
- | 45 | ||
- | 46 | // Keep a UserAgent string for use with jQuery.browser
|
|
- | 47 | userAgent = navigator.userAgent.toLowerCase(), |
|
- | 48 | ||
- | 49 | // Save a reference to the core toString method
|
|
- | 50 | toString = Object.prototype.toString; |
|
- | 51 | ||
- | 52 | // Define the main jQuery method
|
|
- | 53 | jQuery = window.jQuery = window.$ = function( selector, context ) { |
|
- | 54 | // The jQuery object is actually just the init constructor 'enhanced'
|
|
- | 55 | return new jQuery.fn.init( selector, context ); |
|
- | 56 | }; |
|
36 | 57 | ||
37 | jQuery.fn = jQuery.prototype = { |
58 | jQuery.fn = jQuery.prototype = { |
38 | init: function( selector, context ) { |
59 | init: function( selector, context ) { |
- | 60 | var match, elem, ret; |
|
- | 61 | ||
39 | // Handle $("") or $(null)
|
62 | // Handle $(""), $(null), or $(undefined)
|
40 | if ( !selector ) { |
63 | if ( !selector ) { |
41 | this.length = 0; |
64 | this.length = 0; |
42 | return this; |
65 | return this; |
43 | }
|
66 | }
|
44 | 67 | ||
Строка 51... | Строка 74... | ||
51 | }
|
74 | }
|
52 | 75 | ||
53 | // Handle HTML strings
|
76 | // Handle HTML strings
|
54 | if ( typeof selector === "string" ) { |
77 | if ( typeof selector === "string" ) { |
55 | // Are we dealing with HTML string or an ID?
|
78 | // Are we dealing with HTML string or an ID?
|
56 | var match = quickExpr.exec( selector ); |
79 | match = quickExpr.exec( selector ); |
57 | 80 | ||
58 | // Verify a match, and that no context was specified for #id
|
81 | // Verify a match, and that no context was specified for #id
|
59 | if ( match && (match[1] || !context) ) { |
82 | if ( match && (match[1] || !context) ) { |
60 | 83 | ||
61 | // HANDLE: $(html) -> $(array)
|
84 | // HANDLE: $(html) -> $(array)
|
62 | if ( match[1] ) { |
85 | if ( match[1] ) { |
63 | selector = jQuery.clean( [ match[1] ], context ); |
86 | selector = jQuery.clean( [ match[1] ], context ); |
64 | 87 | ||
65 | // HANDLE: $("#id")
|
88 | // HANDLE: $("#id")
|
66 | } else { |
89 | } else { |
67 | var elem = document.getElementById( match[3] ); |
90 | elem = document.getElementById( match[3] ); |
68 | 91 | ||
69 | // Handle the case where IE and Opera return items
|
92 | // Handle the case where IE and Opera return items
|
70 | // by name instead of ID
|
93 | // by name instead of ID
|
71 | if ( elem && elem.id != match[3] ) { |
94 | if ( elem && elem.id !== match[3] ) { |
72 | return rootjQuery.find( selector ); |
95 | return rootjQuery.find( selector ); |
73 | }
|
96 | }
|
74 | 97 | ||
75 | // Otherwise, we inject the element directly into the jQuery object
|
98 | // Otherwise, we inject the element directly into the jQuery object
|
76 | var ret = jQuery( elem || null ); |
99 | ret = jQuery( elem || null ); |
77 | ret.context = document; |
100 | ret.context = document; |
78 | ret.selector = selector; |
101 | ret.selector = selector; |
79 | return ret; |
102 | return ret; |
80 | }
|
103 | }
|
81 | 104 | ||
Строка 118... | Строка 141... | ||
118 | }, |
141 | }, |
119 | 142 | ||
120 | // Get the Nth element in the matched element set OR
|
143 | // Get the Nth element in the matched element set OR
|
121 | // Get the whole matched element set as a clean array
|
144 | // Get the whole matched element set as a clean array
|
122 | get: function( num ) { |
145 | get: function( num ) { |
123 | return num === undefined ? |
146 | return num == null ? |
124 | 147 | ||
125 | // Return a 'clean' array
|
148 | // Return a 'clean' array
|
126 | Array.prototype.slice.call( this ) : |
149 | Array.prototype.slice.call( this ) : |
127 | 150 | ||
128 | // Return just the object
|
151 | // Return just the object
|
Строка 138... | Строка 161... | ||
138 | // Add the old object onto the stack (as a reference)
|
161 | // Add the old object onto the stack (as a reference)
|
139 | ret.prevObject = this; |
162 | ret.prevObject = this; |
140 | 163 | ||
141 | ret.context = this.context; |
164 | ret.context = this.context; |
142 | 165 | ||
143 | if ( name === "find" ) |
166 | if ( name === "find" ) { |
144 | ret.selector = this.selector + (this.selector ? " " : "") + selector; |
167 | ret.selector = this.selector + (this.selector ? " " : "") + selector; |
145 | else if ( name ) |
168 | } else if ( name ) { |
146 | ret.selector = this.selector + "." + name + "(" + selector + ")"; |
169 | ret.selector = this.selector + "." + name + "(" + selector + ")"; |
- | 170 | }
|
|
147 | 171 | ||
148 | // Return the newly-formed element set
|
172 | // Return the newly-formed element set
|
149 | return ret; |
173 | return ret; |
150 | }, |
174 | }, |
151 | 175 | ||
Строка 172... | Строка 196... | ||
172 | // the matched set of elements
|
196 | // the matched set of elements
|
173 | index: function( elem ) { |
197 | index: function( elem ) { |
174 | // Locate the position of the desired element
|
198 | // Locate the position of the desired element
|
175 | return jQuery.inArray( |
199 | return jQuery.inArray( |
176 | // If it receives a jQuery object, the first element is used
|
200 | // If it receives a jQuery object, the first element is used
|
177 | elem && elem.jquery ? elem[0] : elem |
201 | elem && elem.jquery ? elem[0] : elem, this ); |
178 | , this ); |
- | |
179 | }, |
202 | }, |
180 | 203 | ||
181 | is: function( selector ) { |
204 | is: function( selector ) { |
182 | return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
205 | return !!selector && jQuery.multiFilter( selector, this ).length > 0; |
183 | }, |
206 | }, |
Строка 190... | Строка 213... | ||
190 | }; |
213 | }; |
191 | 214 | ||
192 | // Give the init function the jQuery prototype for later instantiation
|
215 | // Give the init function the jQuery prototype for later instantiation
|
193 | jQuery.fn.init.prototype = jQuery.fn; |
216 | jQuery.fn.init.prototype = jQuery.fn; |
194 | 217 | ||
195 | function evalScript( i, elem ) { |
- | |
196 | if ( elem.src ) |
- | |
197 | jQuery.ajax({ |
- | |
198 | url: elem.src, |
- | |
199 | async: false, |
- | |
200 | dataType: "script" |
- | |
201 | }); |
- | |
202 | - | ||
203 | else
|
- | |
204 | jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
- | |
205 | - | ||
206 | if ( elem.parentNode ) |
- | |
207 | elem.parentNode.removeChild( elem ); |
- | |
208 | }
|
- | |
209 | - | ||
210 | function now(){ |
- | |
211 | return +new Date; |
- | |
212 | }
|
- | |
213 | - | ||
214 | jQuery.extend = jQuery.fn.extend = function() { |
218 | jQuery.extend = jQuery.fn.extend = function() { |
215 | // copy reference to target object
|
219 | // copy reference to target object
|
216 | var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; |
220 | var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; |
217 | 221 | ||
218 | // Handle a deep copy situation
|
222 | // Handle a deep copy situation
|
219 | if ( typeof target === "boolean" ) { |
223 | if ( typeof target === "boolean" ) { |
220 | deep = target; |
224 | deep = target; |
221 | target = arguments[1] || {}; |
225 | target = arguments[1] || {}; |
222 | // skip the boolean and the target
|
226 | // skip the boolean and the target
|
223 | i = 2; |
227 | i = 2; |
224 | }
|
228 | }
|
225 | 229 | ||
226 | // Handle case when target is a string or something (possible in deep copy)
|
230 | // Handle case when target is a string or something (possible in deep copy)
|
227 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) |
231 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
228 | target = {}; |
232 | target = {}; |
- | 233 | }
|
|
229 | 234 | ||
230 | // extend jQuery itself if only one argument is passed
|
235 | // extend jQuery itself if only one argument is passed
|
231 | if ( length == i ) { |
236 | if ( length === i ) { |
232 | target = this; |
237 | target = this; |
233 | --i; |
238 | --i; |
234 | }
|
239 | }
|
235 | 240 | ||
236 | for ( ; i < length; i++ ) |
241 | for ( ; i < length; i++ ) { |
237 | // Only deal with non-null/undefined values
|
242 | // Only deal with non-null/undefined values
|
238 | if ( (options = arguments[ i ]) != null ) |
243 | if ( (options = arguments[ i ]) != null ) { |
239 | // Extend the base object
|
244 | // Extend the base object
|
240 | for ( var name in options ) { |
245 | for ( name in options ) { |
- | 246 | src = target[ name ]; |
|
241 | var src = target[ name ], copy = options[ name ]; |
247 | copy = options[ name ]; |
242 | 248 | ||
243 | // Prevent never-ending loop
|
249 | // Prevent never-ending loop
|
244 | if ( target === copy ) |
250 | if ( target === copy ) { |
245 | continue; |
251 | continue; |
- | 252 | }
|
|
246 | 253 | ||
247 | // Recurse if we're merging object values
|
254 | // Recurse if we're merging object values
|
248 | if ( deep && copy && typeof copy === "object" && !copy.nodeType ) |
255 | if ( deep && copy && typeof copy === "object" && !copy.nodeType ) { |
249 | target[ name ] = jQuery.extend( deep, |
256 | target[ name ] = jQuery.extend( deep, |
250 | // Never move original objects, clone them
|
257 | // Never move original objects, clone them
|
251 | src || ( copy.length != null ? [ ] : { } ) |
258 | src || ( copy.length != null ? [ ] : { } ), copy ); |
252 | , copy ); |
- | |
253 | 259 | ||
254 | // Don't bring in undefined values
|
260 | // Don't bring in undefined values
|
255 | else if ( copy !== undefined ) |
261 | } else if ( copy !== undefined ) { |
256 | target[ name ] = copy; |
262 | target[ name ] = copy; |
257 | 263 | }
|
|
258 | }
|
264 | }
|
- | 265 | }
|
|
- | 266 | }
|
|
259 | 267 | ||
260 | // Return the modified object
|
268 | // Return the modified object
|
261 | return target; |
269 | return target; |
262 | }; |
270 | }; |
263 | 271 | ||
264 | var toString = Object.prototype.toString; |
- | |
265 | - | ||
266 | jQuery.extend({ |
272 | jQuery.extend({ |
267 | noConflict: function( deep ) { |
273 | noConflict: function( deep ) { |
268 | window.$ = _$; |
274 | window.$ = _$; |
269 | 275 | ||
270 | if ( deep ) |
276 | if ( deep ) { |
271 | window.jQuery = _jQuery; |
277 | window.jQuery = _jQuery; |
- | 278 | }
|
|
272 | 279 | ||
273 | return jQuery; |
280 | return jQuery; |
274 | }, |
281 | }, |
275 | 282 | ||
276 | // See test/unit/core.js for details concerning isFunction.
|
283 | // See test/unit/core.js for details concerning isFunction.
|
Строка 297... | Строка 304... | ||
297 | // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
304 | // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
|
298 | var head = document.getElementsByTagName("head")[0] || document.documentElement, |
305 | var head = document.getElementsByTagName("head")[0] || document.documentElement, |
299 | script = document.createElement("script"); |
306 | script = document.createElement("script"); |
300 | 307 | ||
301 | script.type = "text/javascript"; |
308 | script.type = "text/javascript"; |
302 | if ( jQuery.support.scriptEval ) |
309 | if ( jQuery.support.scriptEval ) { |
303 | script.appendChild( document.createTextNode( data ) ); |
310 | script.appendChild( document.createTextNode( data ) ); |
304 | else
|
311 | } else { |
305 | script.text = data; |
312 | script.text = data; |
- | 313 | }
|
|
306 | 314 | ||
307 | // Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
315 | // Use insertBefore instead of appendChild to circumvent an IE6 bug.
|
308 | // This arises when a base node is used (#2709).
|
316 | // This arises when a base node is used (#2709).
|
309 | head.insertBefore( script, head.firstChild ); |
317 | head.insertBefore( script, head.firstChild ); |
310 | head.removeChild( script ); |
318 | head.removeChild( script ); |
311 | }
|
319 | }
|
312 | }, |
320 | }, |
313 | 321 | ||
314 | nodeName: function( elem, name ) { |
322 | nodeName: function( elem, name ) { |
315 | return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); |
323 | return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
316 | }, |
324 | }, |
317 | 325 | ||
318 | // args is for internal usage only
|
326 | // args is for internal usage only
|
319 | each: function( object, callback, args ) { |
327 | each: function( object, callback, args ) { |
320 | var name, i = 0, length = object.length; |
328 | var name, i = 0, length = object.length; |
321 | 329 | ||
322 | if ( args ) { |
330 | if ( args ) { |
323 | if ( length === undefined ) { |
331 | if ( length === undefined ) { |
324 | for ( name in object ) |
332 | for ( name in object ) { |
325 | if ( callback.apply( object[ name ], args ) === false ) |
333 | if ( callback.apply( object[ name ], args ) === false ) { |
326 | break; |
334 | break; |
- | 335 | }
|
|
- | 336 | }
|
|
327 | } else |
337 | } else { |
328 | for ( ; i < length; ) |
338 | for ( ; i < length; ) { |
329 | if ( callback.apply( object[ i++ ], args ) === false ) |
339 | if ( callback.apply( object[ i++ ], args ) === false ) { |
330 | break; |
340 | break; |
- | 341 | }
|
|
- | 342 | }
|
|
- | 343 | }
|
|
331 | 344 | ||
332 | // A special, fast, case for the most common use of each
|
345 | // A special, fast, case for the most common use of each
|
333 | } else { |
346 | } else { |
334 | if ( length === undefined ) { |
347 | if ( length === undefined ) { |
335 | for ( name in object ) |
348 | for ( name in object ) { |
336 | if ( callback.call( object[ name ], name, object[ name ] ) === false ) |
349 | if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
337 | break; |
350 | break; |
- | 351 | }
|
|
- | 352 | }
|
|
338 | } else |
353 | } else { |
339 | for ( var value = object[0]; |
354 | for ( var value = object[0]; |
340 | i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} |
355 | i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} |
- | 356 | }
|
|
341 | }
|
357 | }
|
342 | 358 | ||
343 | return object; |
359 | return object; |
344 | }, |
360 | }, |
345 | 361 | ||
346 | trim: function( text ) { |
362 | trim: function( text ) { |
347 | return (text || "").replace( /^\s+|\s+$/g, "" ); |
363 | return (text || "").replace( /^\s+|\s+$/g, "" ); |
348 | }, |
364 | }, |
349 | 365 | ||
350 | makeArray: function( array ) { |
366 | makeArray: function( array ) { |
351 | var ret = []; |
367 | var ret = [], i; |
352 | 368 | ||
353 | if( array != null ){ |
369 | if ( array != null ) { |
354 | var i = array.length; |
370 | i = array.length; |
- | 371 | ||
355 | // The window, strings (and functions) also have 'length'
|
372 | // The window, strings (and functions) also have 'length'
|
356 | if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) |
373 | if ( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval ) { |
357 | ret[0] = array; |
374 | ret[0] = array; |
358 | else
|
375 | } else { |
359 | while( i ) |
376 | while ( i ) { |
360 | ret[--i] = array[i]; |
377 | ret[--i] = array[i]; |
- | 378 | }
|
|
- | 379 | }
|
|
361 | }
|
380 | }
|
362 | 381 | ||
363 | return ret; |
382 | return ret; |
364 | }, |
383 | }, |
365 | 384 | ||
366 | inArray: function( elem, array ) { |
385 | inArray: function( elem, array ) { |
367 | for ( var i = 0, length = array.length; i < length; i++ ) |
386 | for ( var i = 0, length = array.length; i < length; i++ ) { |
368 | // Use === because on IE, window == document
|
- | |
369 | if ( array[ i ] === elem ) |
387 | if ( array[ i ] === elem ) { |
370 | return i; |
388 | return i; |
- | 389 | }
|
|
- | 390 | }
|
|
371 | 391 | ||
372 | return -1; |
392 | return -1; |
373 | }, |
393 | }, |
374 | 394 | ||
375 | merge: function( first, second ) { |
395 | merge: function( first, second ) { |
376 | // We have to loop this way because IE & Opera overwrite the length
|
396 | // We have to loop this way because IE & Opera overwrite the length
|
377 | // expando of getElementsByTagName
|
397 | // expando of getElementsByTagName
|
378 | var i = 0, elem, pos = first.length; |
398 | var i = 0, elem, pos = first.length; |
- | 399 | ||
379 | // Also, we need to make sure that the correct elements are being returned
|
400 | // Also, we need to make sure that the correct elements are being returned
|
380 | // (IE returns comment nodes in a '*' query)
|
401 | // (IE returns comment nodes in a '*' query)
|
381 | if ( !jQuery.support.getAll ) { |
402 | if ( !jQuery.support.getAll ) { |
382 | while ( (elem = second[ i++ ]) != null ) |
403 | while ( (elem = second[ i++ ]) != null ) { |
383 | if ( elem.nodeType != 8 ) |
404 | if ( elem.nodeType !== 8 ) { |
384 | first[ pos++ ] = elem; |
405 | first[ pos++ ] = elem; |
- | 406 | }
|
|
- | 407 | }
|
|
385 | 408 | ||
386 | } else |
409 | } else { |
387 | while ( (elem = second[ i++ ]) != null ) |
410 | while ( (elem = second[ i++ ]) != null ) { |
388 | first[ pos++ ] = elem; |
411 | first[ pos++ ] = elem; |
- | 412 | }
|
|
- | 413 | }
|
|
389 | 414 | ||
390 | return first; |
415 | return first; |
391 | }, |
416 | }, |
392 | 417 | ||
393 | unique: function( array ) { |
418 | unique: function( array ) { |
394 | var ret = [], done = {}; |
419 | var ret = [], done = {}, id; |
395 | 420 | ||
396 | try { |
421 | try { |
397 | - | ||
398 | for ( var i = 0, length = array.length; i < length; i++ ) { |
422 | for ( var i = 0, length = array.length; i < length; i++ ) { |
399 | var id = jQuery.data( array[ i ] ); |
423 | id = jQuery.data( array[ i ] ); |
400 | 424 | ||
401 | if ( !done[ id ] ) { |
425 | if ( !done[ id ] ) { |
402 | done[ id ] = true; |
426 | done[ id ] = true; |
403 | ret.push( array[ i ] ); |
427 | ret.push( array[ i ] ); |
404 | }
|
428 | }
|
405 | }
|
429 | }
|
406 | - | ||
407 | } catch( e ) { |
430 | } catch( e ) { |
408 | ret = array; |
431 | ret = array; |
409 | }
|
432 | }
|
410 | 433 | ||
411 | return ret; |
434 | return ret; |
Строка 414... | Строка 437... | ||
414 | grep: function( elems, callback, inv ) { |
437 | grep: function( elems, callback, inv ) { |
415 | var ret = []; |
438 | var ret = []; |
416 | 439 | ||
417 | // Go through the array, only saving the items
|
440 | // Go through the array, only saving the items
|
418 | // that pass the validator function
|
441 | // that pass the validator function
|
419 | for ( var i = 0, length = elems.length; i < length; i++ ) |
442 | for ( var i = 0, length = elems.length; i < length; i++ ) { |
420 | if ( !inv != !callback( elems[ i ], i ) ) |
443 | if ( !inv !== !callback( elems[ i ], i ) ) { |
421 | ret.push( elems[ i ] ); |
444 | ret.push( elems[ i ] ); |
- | 445 | }
|
|
- | 446 | }
|
|
422 | 447 | ||
423 | return ret; |
448 | return ret; |
424 | }, |
449 | }, |
425 | 450 | ||
426 | map: function( elems, callback ) { |
451 | map: function( elems, callback ) { |
427 | var ret = []; |
452 | var ret = [], value; |
428 | 453 | ||
429 | // Go through the array, translating each of the items to their
|
454 | // Go through the array, translating each of the items to their
|
430 | // new value (or values).
|
455 | // new value (or values).
|
431 | for ( var i = 0, length = elems.length; i < length; i++ ) { |
456 | for ( var i = 0, length = elems.length; i < length; i++ ) { |
432 | var value = callback( elems[ i ], i ); |
457 | value = callback( elems[ i ], i ); |
433 | 458 | ||
434 | if ( value != null ) |
459 | if ( value != null ) { |
435 | ret[ ret.length ] = value; |
460 | ret[ ret.length ] = value; |
- | 461 | }
|
|
436 | }
|
462 | }
|
437 | 463 | ||
438 | return ret.concat.apply( [], ret ); |
464 | return ret.concat.apply( [], ret ); |
- | 465 | }, |
|
- | 466 | ||
- | 467 | // Use of jQuery.browser is deprecated.
|
|
- | 468 | // It's included for backwards compatibility and plugins,
|
|
- | 469 | // although they should work to migrate away.
|
|
- | 470 | browser: { |
|
- | 471 | version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
|
- | 472 | safari: /webkit/.test( userAgent ), |
|
- | 473 | opera: /opera/.test( userAgent ), |
|
- | 474 | msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
|
- | 475 | mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
|
439 | }
|
476 | }
|
440 | }); |
477 | }); |
441 | 478 | ||
442 | // All jQuery objects should point back to these
|
479 | // All jQuery objects should point back to these
|
443 | var rootjQuery = jQuery(document); |
480 | rootjQuery = jQuery(document); |
444 | 481 | ||
445 | // Use of jQuery.browser is deprecated.
|
482 | function evalScript( i, elem ) { |
- | 483 | if ( elem.src ) { |
|
- | 484 | jQuery.ajax({ |
|
- | 485 | url: elem.src, |
|
- | 486 | async: false, |
|
446 | // It's included for backwards compatibility and plugins,
|
487 | dataType: "script" |
- | 488 | }); |
|
- | 489 | } else { |
|
447 | // although they should work to migrate away.
|
490 | jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); |
- | 491 | }
|
|
448 | 492 | ||
- | 493 | if ( elem.parentNode ) { |
|
449 | var userAgent = navigator.userAgent.toLowerCase(); |
494 | elem.parentNode.removeChild( elem ); |
- | 495 | }
|
|
- | 496 | }
|
|
450 | 497 | ||
451 | // Figure out what browser is being used
|
- | |
452 | jQuery.browser = { |
498 | function now() { |
453 | version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], |
- | |
454 | safari: /webkit/.test( userAgent ), |
- | |
455 | opera: /opera/.test( userAgent ), |
499 | return (new Date).getTime(); |
456 | msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), |
- | |
457 | mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) |
- | |
- | 500 | }
|
|
458 | };var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
501 | var expando = "jQuery" + now(), uuid = 0, windowData = {}; |
459 | 502 | ||
460 | jQuery.extend({ |
503 | jQuery.extend({ |
461 | cache: {}, |
504 | cache: {}, |
462 | 505 | ||
463 | data: function( elem, name, data ) { |
506 | data: function( elem, name, data ) { |
Строка 4334... | Строка 4377... | ||
4334 | return { top: top, left: left }; |
4377 | return { top: top, left: left }; |
4335 | }; |
4378 | }; |
4336 | 4379 | ||
4337 | jQuery.offset = { |
4380 | jQuery.offset = { |
4338 | initialize: function() { |
4381 | initialize: function() { |
4339 | var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, prop, bodyMarginTop = body.style.marginTop, |
4382 | var body = document.body, container = document.createElement('div'), innerDiv, checkDiv, table, td, prop, bodyMarginTop = parseFloat(jQuery.curCSS(body, 'marginTop', true), 10) || 0, |
4340 | html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>'; |
4383 | html = '<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>'; |
4341 | 4384 | ||
4342 | jQuery.extend( container.style, { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' } ); |
4385 | jQuery.extend( container.style, { position: 'absolute', top: 0, left: 0, margin: 0, border: 0, width: '1px', height: '1px', visibility: 'hidden' } ); |
4343 | 4386 | ||
4344 | container.innerHTML = html; |
4387 | container.innerHTML = html; |
Строка 4353... | Строка 4396... | ||
4353 | checkDiv.style.position = '', checkDiv.style.top = ''; |
4396 | checkDiv.style.position = '', checkDiv.style.top = ''; |
4354 | 4397 | ||
4355 | innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; |
4398 | innerDiv.style.overflow = 'hidden', innerDiv.style.position = 'relative'; |
4356 | this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
4399 | this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
4357 | 4400 | ||
4358 | body.style.marginTop = '1px'; |
- | |
4359 | this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0); |
4401 | this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
4360 | body.style.marginTop = bodyMarginTop; |
- | |
4361 | 4402 | ||
4362 | body.removeChild(container); |
4403 | body.removeChild(container); |
4363 | jQuery.offset.initialize = function(){}; |
4404 | jQuery.offset.initialize = function(){}; |
4364 | }, |
4405 | }, |
4365 | 4406 |