/MvcMusicStore/Scripts/jquery-1.5.1-vsdoc.js
JavaScript | 2224 lines | 1064 code | 411 blank | 749 comment | 344 complexity | a3809609ec504c75f6e0fec656b39783 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
1/* 2 * This file has been commented to support Visual Studio Intellisense. 3 * You should not use this file at runtime inside the browser--it is only 4 * intended to be used only for design-time IntelliSense. Please use the 5 * standard jQuery library for all production use. 6 * 7 * Comment version: 1.5.1 8 */ 9 10/*! 11 * Note: While Microsoft is not the author of this file, Microsoft is 12 * offering you a license subject to the terms of the Microsoft Software 13 * License Terms for Microsoft ASP.NET Model View Controller 3. 14 * Microsoft reserves all other rights. The notices below are provided 15 * for informational purposes only and are not the license terms under 16 * which Microsoft distributed this file. 17 * 18 * jQuery JavaScript Library v1.5.1 19 * http://jquery.com/ 20 * 21 * Copyright 2010, John Resig 22 * 23 * Includes Sizzle.js 24 * http://sizzlejs.com/ 25 * Copyright 2010, The Dojo Foundation 26 * 27 */ 28(function( window, undefined ) { 29 30// Use the correct document accordingly with window argument (sandbox) 31var document = window.document; 32var jQuery = (function() { 33 34// Define a local copy of jQuery 35var jQuery = function( selector, context ) { 36 /// <summary> 37 /// 1: $(expression, context) - This function accepts a string containing a CSS selector which is then used to match a set of elements. 38 /// 2: $(html) - Create DOM elements on-the-fly from the provided String of raw HTML. 39 /// 3: $(elements) - Wrap jQuery functionality around a single or multiple DOM Element(s). 40 /// 4: $(callback) - A shorthand for $(document).ready(). 41 /// 5: $() - As of jQuery 1.4, if you pass no arguments in to the jQuery() method, an empty jQuery set will be returned. 42 /// </summary> 43 /// <param name="selector" type="String"> 44 /// 1: expression - An expression to search with. 45 /// 2: html - A string of HTML to create on the fly. 46 /// 3: elements - DOM element(s) to be encapsulated by a jQuery object. 47 /// 4: callback - The function to execute when the DOM is ready. 48 /// </param> 49 /// <param name="context" type="jQuery"> 50 /// 1: context - A DOM Element, Document or jQuery to use as context. 51 /// </param> 52 /// <returns type="jQuery" /> 53 54 // The jQuery object is actually just the init constructor 'enhanced' 55 return new jQuery.fn.init( selector, context ); 56 }, 57 58 // Map over jQuery in case of overwrite 59 _jQuery = window.jQuery, 60 61 // Map over the $ in case of overwrite 62 _$ = window.$, 63 64 // A central reference to the root jQuery(document) 65 rootjQuery, 66 67 // A simple way to check for HTML strings or ID strings 68 // (both of which we optimize for) 69 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, 70 71 // Is it a simple selector 72 isSimple = /^.[^:#\[\.,]*$/, 73 74 // Check if a string has a non-whitespace character in it 75 rnotwhite = /\S/, 76 rwhite = /\s/, 77 78 // Used for trimming whitespace 79 trimLeft = /^\s+/, 80 trimRight = /\s+$/, 81 82 // Check for non-word characters 83 rnonword = /\W/, 84 85 // Check for digits 86 rdigit = /\d/, 87 88 // Match a standalone tag 89 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 90 91 // JSON RegExp 92 rvalidchars = /^[\],:{}\s]*$/, 93 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, 94 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, 95 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, 96 97 // Useragent RegExp 98 rwebkit = /(webkit)[ \/]([\w.]+)/, 99 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, 100 rmsie = /(msie) ([\w.]+)/, 101 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, 102 103 // Keep a UserAgent string for use with jQuery.browser 104 userAgent = navigator.userAgent, 105 106 // For matching the engine and version of the browser 107 browserMatch, 108 109 // Has the ready events already been bound? 110 readyBound = false, 111 112 // The functions to execute on DOM ready 113 readyList = [], 114 115 // The ready event handler 116 DOMContentLoaded, 117 118 // Save a reference to some core methods 119 toString = Object.prototype.toString, 120 hasOwn = Object.prototype.hasOwnProperty, 121 push = Array.prototype.push, 122 slice = Array.prototype.slice, 123 trim = String.prototype.trim, 124 indexOf = Array.prototype.indexOf, 125 126 // [[Class]] -> type pairs 127 class2type = {}; 128 129jQuery.fn = jQuery.prototype = { 130 init: function( selector, context ) { 131 var match, elem, ret, doc; 132 133 // Handle $(""), $(null), or $(undefined) 134 if ( !selector ) { 135 return this; 136 } 137 138 // Handle $(DOMElement) 139 if ( selector.nodeType ) { 140 this.context = this[0] = selector; 141 this.length = 1; 142 return this; 143 } 144 145 // The body element only exists once, optimize finding it 146 if ( selector === "body" && !context && document.body ) { 147 this.context = document; 148 this[0] = document.body; 149 this.selector = "body"; 150 this.length = 1; 151 return this; 152 } 153 154 // Handle HTML strings 155 if ( typeof selector === "string" ) { 156 // Are we dealing with HTML string or an ID? 157 match = quickExpr.exec( selector ); 158 159 // Verify a match, and that no context was specified for #id 160 if ( match && (match[1] || !context) ) { 161 162 // HANDLE: $(html) -> $(array) 163 if ( match[1] ) { 164 doc = (context ? context.ownerDocument || context : document); 165 166 // If a single string is passed in and it's a single tag 167 // just do a createElement and skip the rest 168 ret = rsingleTag.exec( selector ); 169 170 if ( ret ) { 171 if ( jQuery.isPlainObject( context ) ) { 172 selector = [ document.createElement( ret[1] ) ]; 173 jQuery.fn.attr.call( selector, context, true ); 174 175 } else { 176 selector = [ doc.createElement( ret[1] ) ]; 177 } 178 179 } else { 180 ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); 181 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; 182 } 183 184 return jQuery.merge( this, selector ); 185 186 // HANDLE: $("#id") 187 } else { 188 elem = document.getElementById( match[2] ); 189 190 // Check parentNode to catch when Blackberry 4.6 returns 191 // nodes that are no longer in the document #6963 192 if ( elem && elem.parentNode ) { 193 // Handle the case where IE and Opera return items 194 // by name instead of ID 195 if ( elem.id !== match[2] ) { 196 return rootjQuery.find( selector ); 197 } 198 199 // Otherwise, we inject the element directly into the jQuery object 200 this.length = 1; 201 this[0] = elem; 202 } 203 204 this.context = document; 205 this.selector = selector; 206 return this; 207 } 208 209 // HANDLE: $("TAG") 210 } else if ( !context && !rnonword.test( selector ) ) { 211 this.selector = selector; 212 this.context = document; 213 selector = document.getElementsByTagName( selector ); 214 return jQuery.merge( this, selector ); 215 216 // HANDLE: $(expr, $(...)) 217 } else if ( !context || context.jquery ) { 218 return (context || rootjQuery).find( selector ); 219 220 // HANDLE: $(expr, context) 221 // (which is just equivalent to: $(context).find(expr) 222 } else { 223 return jQuery( context ).find( selector ); 224 } 225 226 // HANDLE: $(function) 227 // Shortcut for document ready 228 } else if ( jQuery.isFunction( selector ) ) { 229 return rootjQuery.ready( selector ); 230 } 231 232 if (selector.selector !== undefined) { 233 this.selector = selector.selector; 234 this.context = selector.context; 235 } 236 237 return jQuery.makeArray( selector, this ); 238 }, 239 240 // Start with an empty selector 241 selector: "", 242 243 // The current version of jQuery being used 244 jquery: "1.4.4", 245 246 // The default length of a jQuery object is 0 247 length: 0, 248 249 // The number of elements contained in the matched element set 250 size: function() { 251 /// <summary> 252 /// The number of elements currently matched. 253 /// Part of Core 254 /// </summary> 255 /// <returns type="Number" /> 256 257 return this.length; 258 }, 259 260 toArray: function() { 261 /// <summary> 262 /// Retrieve all the DOM elements contained in the jQuery set, as an array. 263 /// </summary> 264 /// <returns type="Array" /> 265 return slice.call( this, 0 ); 266 }, 267 268 // Get the Nth element in the matched element set OR 269 // Get the whole matched element set as a clean array 270 get: function( num ) { 271 /// <summary> 272 /// Access a single matched element. num is used to access the 273 /// Nth element matched. 274 /// Part of Core 275 /// </summary> 276 /// <returns type="Element" /> 277 /// <param name="num" type="Number"> 278 /// Access the element in the Nth position. 279 /// </param> 280 281 return num == null ? 282 283 // Return a 'clean' array 284 this.toArray() : 285 286 // Return just the object 287 ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); 288 }, 289 290 // Take an array of elements and push it onto the stack 291 // (returning the new matched element set) 292 pushStack: function( elems, name, selector ) { 293 /// <summary> 294 /// Set the jQuery object to an array of elements, while maintaining 295 /// the stack. 296 /// Part of Core 297 /// </summary> 298 /// <returns type="jQuery" /> 299 /// <param name="elems" type="Elements"> 300 /// An array of elements 301 /// </param> 302 303 // Build a new jQuery matched element set 304 var ret = jQuery(); 305 306 if ( jQuery.isArray( elems ) ) { 307 push.apply( ret, elems ); 308 309 } else { 310 jQuery.merge( ret, elems ); 311 } 312 313 // Add the old object onto the stack (as a reference) 314 ret.prevObject = this; 315 316 ret.context = this.context; 317 318 if ( name === "find" ) { 319 ret.selector = this.selector + (this.selector ? " " : "") + selector; 320 } else if ( name ) { 321 ret.selector = this.selector + "." + name + "(" + selector + ")"; 322 } 323 324 // Return the newly-formed element set 325 return ret; 326 }, 327 328 // Execute a callback for every element in the matched set. 329 // (You can seed the arguments with an array of args, but this is 330 // only used internally.) 331 each: function( callback, args ) { 332 /// <summary> 333 /// Execute a function within the context of every matched element. 334 /// This means that every time the passed-in function is executed 335 /// (which is once for every element matched) the 'this' keyword 336 /// points to the specific element. 337 /// Additionally, the function, when executed, is passed a single 338 /// argument representing the position of the element in the matched 339 /// set. 340 /// Part of Core 341 /// </summary> 342 /// <returns type="jQuery" /> 343 /// <param name="callback" type="Function"> 344 /// A function to execute 345 /// </param> 346 347 return jQuery.each( this, callback, args ); 348 }, 349 350 ready: function( fn ) { 351 /// <summary> 352 /// Binds a function to be executed whenever the DOM is ready to be traversed and manipulated. 353 /// </summary> 354 /// <param name="fn" type="Function">The function to be executed when the DOM is ready.</param> 355 356 // Attach the listeners 357 jQuery.bindReady(); 358 359 // If the DOM is already ready 360 if ( jQuery.isReady ) { 361 // Execute the function immediately 362 fn.call( document, jQuery ); 363 364 // Otherwise, remember the function for later 365 } else if ( readyList ) { 366 // Add the function to the wait list 367 readyList.push( fn ); 368 } 369 370 return this; 371 }, 372 373 eq: function( i ) { 374 /// <summary> 375 /// Reduce the set of matched elements to a single element. 376 /// The position of the element in the set of matched elements 377 /// starts at 0 and goes to length - 1. 378 /// Part of Core 379 /// </summary> 380 /// <returns type="jQuery" /> 381 /// <param name="num" type="Number"> 382 /// pos The index of the element that you wish to limit to. 383 /// </param> 384 385 return i === -1 ? 386 this.slice( i ) : 387 this.slice( i, +i + 1 ); 388 }, 389 390 first: function() { 391 /// <summary> 392 /// Reduce the set of matched elements to the first in the set. 393 /// </summary> 394 /// <returns type="jQuery" /> 395 396 return this.eq( 0 ); 397 }, 398 399 last: function() { 400 /// <summary> 401 /// Reduce the set of matched elements to the final one in the set. 402 /// </summary> 403 /// <returns type="jQuery" /> 404 405 return this.eq( -1 ); 406 }, 407 408 slice: function() { 409 /// <summary> 410 /// Selects a subset of the matched elements. Behaves exactly like the built-in Array slice method. 411 /// </summary> 412 /// <param name="start" type="Number" integer="true">Where to start the subset (0-based).</param> 413 /// <param name="end" optional="true" type="Number" integer="true">Where to end the subset (not including the end element itself). 414 /// If omitted, ends at the end of the selection</param> 415 /// <returns type="jQuery">The sliced elements</returns> 416 417 return this.pushStack( slice.apply( this, arguments ), 418 "slice", slice.call(arguments).join(",") ); 419 }, 420 421 map: function( callback ) { 422 /// <summary> 423 /// This member is internal. 424 /// </summary> 425 /// <private /> 426 /// <returns type="jQuery" /> 427 428 return this.pushStack( jQuery.map(this, function( elem, i ) { 429 return callback.call( elem, i, elem ); 430 })); 431 }, 432 433 end: function() { 434 /// <summary> 435 /// End the most recent 'destructive' operation, reverting the list of matched elements 436 /// back to its previous state. After an end operation, the list of matched elements will 437 /// revert to the last state of matched elements. 438 /// If there was no destructive operation before, an empty set is returned. 439 /// Part of DOM/Traversing 440 /// </summary> 441 /// <returns type="jQuery" /> 442 443 return this.prevObject || jQuery(null); 444 }, 445 446 // For internal use only. 447 // Behaves like an Array's method, not like a jQuery method. 448 push: push, 449 sort: [].sort, 450 splice: [].splice 451}; 452 453// Give the init function the jQuery prototype for later instantiation 454jQuery.fn.init.prototype = jQuery.fn; 455 456jQuery.extend = jQuery.fn.extend = function() { 457 /// <summary> 458 /// Extend one object with one or more others, returning the original, 459 /// modified, object. This is a great utility for simple inheritance. 460 /// jQuery.extend(settings, options); 461 /// var settings = jQuery.extend({}, defaults, options); 462 /// Part of JavaScript 463 /// </summary> 464 /// <param name="target" type="Object"> 465 /// The object to extend 466 /// </param> 467 /// <param name="prop1" type="Object"> 468 /// The object that will be merged into the first. 469 /// </param> 470 /// <param name="propN" type="Object" optional="true" parameterArray="true"> 471 /// (optional) More objects to merge into the first 472 /// </param> 473 /// <returns type="Object" /> 474 475 var options, name, src, copy, copyIsArray, clone, 476 target = arguments[0] || {}, 477 i = 1, 478 length = arguments.length, 479 deep = false; 480 481 // Handle a deep copy situation 482 if ( typeof target === "boolean" ) { 483 deep = target; 484 target = arguments[1] || {}; 485 // skip the boolean and the target 486 i = 2; 487 } 488 489 // Handle case when target is a string or something (possible in deep copy) 490 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 491 target = {}; 492 } 493 494 // extend jQuery itself if only one argument is passed 495 if ( length === i ) { 496 target = this; 497 --i; 498 } 499 500 for ( ; i < length; i++ ) { 501 // Only deal with non-null/undefined values 502 if ( (options = arguments[ i ]) != null ) { 503 // Extend the base object 504 for ( name in options ) { 505 src = target[ name ]; 506 copy = options[ name ]; 507 508 // Prevent never-ending loop 509 if ( target === copy ) { 510 continue; 511 } 512 513 // Recurse if we're merging plain objects or arrays 514 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { 515 if ( copyIsArray ) { 516 copyIsArray = false; 517 clone = src && jQuery.isArray(src) ? src : []; 518 519 } else { 520 clone = src && jQuery.isPlainObject(src) ? src : {}; 521 } 522 523 // Never move original objects, clone them 524 target[ name ] = jQuery.extend( deep, clone, copy ); 525 526 // Don't bring in undefined values 527 } else if ( copy !== undefined ) { 528 target[ name ] = copy; 529 } 530 } 531 } 532 } 533 534 // Return the modified object 535 return target; 536}; 537 538jQuery.extend({ 539 noConflict: function( deep ) { 540 /// <summary> 541 /// Run this function to give control of the $ variable back 542 /// to whichever library first implemented it. This helps to make 543 /// sure that jQuery doesn't conflict with the $ object 544 /// of other libraries. 545 /// By using this function, you will only be able to access jQuery 546 /// using the 'jQuery' variable. For example, where you used to do 547 /// $("div p"), you now must do jQuery("div p"). 548 /// Part of Core 549 /// </summary> 550 /// <returns type="undefined" /> 551 552 window.$ = _$; 553 554 if ( deep ) { 555 window.jQuery = _jQuery; 556 } 557 558 return jQuery; 559 }, 560 561 // Is the DOM ready to be used? Set to true once it occurs. 562 isReady: false, 563 564 // A counter to track how many items to wait for before 565 // the ready event fires. See #6781 566 readyWait: 1, 567 568 // Handle when the DOM is ready 569 ready: function( wait ) { 570 /// <summary> 571 /// This method is internal. 572 /// </summary> 573 /// <private /> 574 575 // A third-party is pushing the ready event forwards 576 if ( wait === true ) { 577 jQuery.readyWait--; 578 } 579 580 // Make sure that the DOM is not already loaded 581 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { 582 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 583 if ( !document.body ) { 584 return setTimeout( jQuery.ready, 1 ); 585 } 586 587 // Remember that the DOM is ready 588 jQuery.isReady = true; 589 590 // If a normal DOM Ready event fired, decrement, and wait if need be 591 if ( wait !== true && --jQuery.readyWait > 0 ) { 592 return; 593 } 594 595 // If there are functions bound, to execute 596 if ( readyList ) { 597 // Execute all of them 598 var fn, 599 i = 0, 600 ready = readyList; 601 602 // Reset the list of functions 603 readyList = null; 604 605 while ( (fn = ready[ i++ ]) ) { 606 fn.call( document, jQuery ); 607 } 608 609 // Trigger any bound ready events 610 if ( jQuery.fn.trigger ) { 611 jQuery( document ).trigger( "ready" ).unbind( "ready" ); 612 } 613 } 614 } 615 }, 616 617 bindReady: function() { 618 if ( readyBound ) { 619 return; 620 } 621 622 readyBound = true; 623 624 // Catch cases where $(document).ready() is called after the 625 // browser event has already occurred. 626 if ( document.readyState === "complete" ) { 627 // Handle it asynchronously to allow scripts the opportunity to delay ready 628 return setTimeout( jQuery.ready, 1 ); 629 } 630 631 // Mozilla, Opera and webkit nightlies currently support this event 632 if ( document.addEventListener ) { 633 // Use the handy event callback 634 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 635 636 // A fallback to window.onload, that will always work 637 window.addEventListener( "load", jQuery.ready, false ); 638 639 // If IE event model is used 640 } else if ( document.attachEvent ) { 641 // ensure firing before onload, 642 // maybe late but safe also for iframes 643 document.attachEvent("onreadystatechange", DOMContentLoaded); 644 645 // A fallback to window.onload, that will always work 646 window.attachEvent( "onload", jQuery.ready ); 647 648 // If IE and not a frame 649 // continually check to see if the document is ready 650 var toplevel = false; 651 652 try { 653 toplevel = window.frameElement == null; 654 } catch(e) {} 655 656 if ( document.documentElement.doScroll && toplevel ) { 657 doScrollCheck(); 658 } 659 } 660 }, 661 662 // See test/unit/core.js for details concerning isFunction. 663 // Since version 1.3, DOM methods and functions like alert 664 // aren't supported. They return false on IE (#2968). 665 isFunction: function( obj ) { 666 /// <summary> 667 /// Determines if the parameter passed is a function. 668 /// </summary> 669 /// <param name="obj" type="Object">The object to check</param> 670 /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns> 671 672 return jQuery.type(obj) === "function"; 673 }, 674 675 isArray: Array.isArray || function( obj ) { 676 /// <summary> 677 /// Determine if the parameter passed is an array. 678 /// </summary> 679 /// <param name="obj" type="Object">Object to test whether or not it is an array.</param> 680 /// <returns type="Boolean">True if the parameter is a function; otherwise false.</returns> 681 682 return jQuery.type(obj) === "array"; 683 }, 684 685 // A crude way of determining if an object is a window 686 isWindow: function( obj ) { 687 return obj && typeof obj === "object" && "setInterval" in obj; 688 }, 689 690 isNaN: function( obj ) { 691 return obj == null || !rdigit.test( obj ) || isNaN( obj ); 692 }, 693 694 type: function( obj ) { 695 return obj == null ? 696 String( obj ) : 697 class2type[ toString.call(obj) ] || "object"; 698 }, 699 700 isPlainObject: function( obj ) { 701 /// <summary> 702 /// Check to see if an object is a plain object (created using "{}" or "new Object"). 703 /// </summary> 704 /// <param name="obj" type="Object"> 705 /// The object that will be checked to see if it's a plain object. 706 /// </param> 707 /// <returns type="Boolean" /> 708 709 // Must be an Object. 710 // Because of IE, we also have to check the presence of the constructor property. 711 // Make sure that DOM nodes and window objects don't pass through, as well 712 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 713 return false; 714 } 715 716 // Not own constructor property must be Object 717 if ( obj.constructor && 718 !hasOwn.call(obj, "constructor") && 719 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 720 return false; 721 } 722 723 // Own properties are enumerated firstly, so to speed up, 724 // if last one is own, then all properties are own. 725 726 var key; 727 for ( key in obj ) {} 728 729 return key === undefined || hasOwn.call( obj, key ); 730 }, 731 732 isEmptyObject: function( obj ) { 733 /// <summary> 734 /// Check to see if an object is empty (contains no properties). 735 /// </summary> 736 /// <param name="obj" type="Object"> 737 /// The object that will be checked to see if it's empty. 738 /// </param> 739 /// <returns type="Boolean" /> 740 741 for ( var name in obj ) { 742 return false; 743 } 744 return true; 745 }, 746 747 error: function( msg ) { 748 throw msg; 749 }, 750 751 parseJSON: function( data ) { 752 if ( typeof data !== "string" || !data ) { 753 return null; 754 } 755 756 // Make sure leading/trailing whitespace is removed (IE can't handle it) 757 data = jQuery.trim( data ); 758 759 // Make sure the incoming data is actual JSON 760 // Logic borrowed from http://json.org/json2.js 761 if ( rvalidchars.test(data.replace(rvalidescape, "@") 762 .replace(rvalidtokens, "]") 763 .replace(rvalidbraces, "")) ) { 764 765 // Try to use the native JSON parser first 766 return window.JSON && window.JSON.parse ? 767 window.JSON.parse( data ) : 768 (new Function("return " + data))(); 769 770 } else { 771 jQuery.error( "Invalid JSON: " + data ); 772 } 773 }, 774 775 noop: function() { 776 /// <summary> 777 /// An empty function. 778 /// </summary> 779 /// <returns type="Function" /> 780 }, 781 782 // Evalulates a script in a global context 783 globalEval: function( data ) { 784 /// <summary> 785 /// Internally evaluates a script in a global context. 786 /// </summary> 787 /// <private /> 788 789 if ( data && rnotwhite.test(data) ) { 790 // Inspired by code by Andrea Giammarchi 791 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html 792 var head = document.getElementsByTagName("head")[0] || document.documentElement, 793 script = document.createElement("script"); 794 795 script.type = "text/javascript"; 796 797 if ( jQuery.support.scriptEval ) { 798 script.appendChild( document.createTextNode( data ) ); 799 } else { 800 script.text = data; 801 } 802 803 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 804 // This arises when a base node is used (#2709). 805 head.insertBefore( script, head.firstChild ); 806 head.removeChild( script ); 807 } 808 }, 809 810 nodeName: function( elem, name ) { 811 /// <summary> 812 /// Checks whether the specified element has the specified DOM node name. 813 /// </summary> 814 /// <param name="elem" type="Element">The element to examine</param> 815 /// <param name="name" type="String">The node name to check</param> 816 /// <returns type="Boolean">True if the specified node name matches the node's DOM node name; otherwise false</returns> 817 818 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 819 }, 820 821 // args is for internal usage only 822 each: function( object, callback, args ) { 823 /// <summary> 824 /// A generic iterator function, which can be used to seemlessly 825 /// iterate over both objects and arrays. This function is not the same 826 /// as $().each() - which is used to iterate, exclusively, over a jQuery 827 /// object. This function can be used to iterate over anything. 828 /// The callback has two arguments:the key (objects) or index (arrays) as first 829 /// the first, and the value as the second. 830 /// Part of JavaScript 831 /// </summary> 832 /// <param name="obj" type="Object"> 833 /// The object, or array, to iterate over. 834 /// </param> 835 /// <param name="fn" type="Function"> 836 /// The function that will be executed on every object. 837 /// </param> 838 /// <returns type="Object" /> 839 840 var name, i = 0, 841 length = object.length, 842 isObj = length === undefined || jQuery.isFunction(object); 843 844 if ( args ) { 845 if ( isObj ) { 846 for ( name in object ) { 847 if ( callback.apply( object[ name ], args ) === false ) { 848 break; 849 } 850 } 851 } else { 852 for ( ; i < length; ) { 853 if ( callback.apply( object[ i++ ], args ) === false ) { 854 break; 855 } 856 } 857 } 858 859 // A special, fast, case for the most common use of each 860 } else { 861 if ( isObj ) { 862 for ( name in object ) { 863 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { 864 break; 865 } 866 } 867 } else { 868 for ( var value = object[0]; 869 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} 870 } 871 } 872 873 return object; 874 }, 875 876 // Use native String.trim function wherever possible 877 trim: trim ? 878 function( text ) { 879 return text == null ? 880 "" : 881 trim.call( text ); 882 } : 883 884 // Otherwise use our own trimming functionality 885 function( text ) { 886 return text == null ? 887 "" : 888 text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); 889 }, 890 891 // results is for internal usage only 892 makeArray: function( array, results ) { 893 /// <summary> 894 /// Turns anything into a true array. This is an internal method. 895 /// </summary> 896 /// <param name="array" type="Object">Anything to turn into an actual Array</param> 897 /// <returns type="Array" /> 898 /// <private /> 899 900 var ret = results || []; 901 902 if ( array != null ) { 903 // The window, strings (and functions) also have 'length' 904 // The extra typeof function check is to prevent crashes 905 // in Safari 2 (See: #3039) 906 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 907 var type = jQuery.type(array); 908 909 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { 910 push.call( ret, array ); 911 } else { 912 jQuery.merge( ret, array ); 913 } 914 } 915 916 return ret; 917 }, 918 919 inArray: function( elem, array ) { 920 if ( array.indexOf ) { 921 return array.indexOf( elem ); 922 } 923 924 for ( var i = 0, length = array.length; i < length; i++ ) { 925 if ( array[ i ] === elem ) { 926 return i; 927 } 928 } 929 930 return -1; 931 }, 932 933 merge: function( first, second ) { 934 /// <summary> 935 /// Merge two arrays together, removing all duplicates. 936 /// The new array is: All the results from the first array, followed 937 /// by the unique results from the second array. 938 /// Part of JavaScript 939 /// </summary> 940 /// <returns type="Array" /> 941 /// <param name="first" type="Array"> 942 /// The first array to merge. 943 /// </param> 944 /// <param name="second" type="Array"> 945 /// The second array to merge. 946 /// </param> 947 948 var i = first.length, 949 j = 0; 950 951 if ( typeof second.length === "number" ) { 952 for ( var l = second.length; j < l; j++ ) { 953 first[ i++ ] = second[ j ]; 954 } 955 956 } else { 957 while ( second[j] !== undefined ) { 958 first[ i++ ] = second[ j++ ]; 959 } 960 } 961 962 first.length = i; 963 964 return first; 965 }, 966 967 grep: function( elems, callback, inv ) { 968 /// <summary> 969 /// Filter items out of an array, by using a filter function. 970 /// The specified function will be passed two arguments: The 971 /// current array item and the index of the item in the array. The 972 /// function must return 'true' to keep the item in the array, 973 /// false to remove it. 974 /// }); 975 /// Part of JavaScript 976 /// </summary> 977 /// <returns type="Array" /> 978 /// <param name="elems" type="Array"> 979 /// array The Array to find items in. 980 /// </param> 981 /// <param name="fn" type="Function"> 982 /// The function to process each item against. 983 /// </param> 984 /// <param name="inv" type="Boolean"> 985 /// Invert the selection - select the opposite of the function. 986 /// </param> 987 988 var ret = [], retVal; 989 inv = !!inv; 990 991 // Go through the array, only saving the items 992 // that pass the validator function 993 for ( var i = 0, length = elems.length; i < length; i++ ) { 994 retVal = !!callback( elems[ i ], i ); 995 if ( inv !== retVal ) { 996 ret.push( elems[ i ] ); 997 } 998 } 999 1000 return ret; 1001 }, 1002 1003 // arg is for internal usage only 1004 map: function( elems, callback, arg ) { 1005 /// <summary> 1006 /// Translate all items in an array to another array of items. 1007 /// The translation function that is provided to this method is 1008 /// called for each item in the array and is passed one argument: 1009 /// The item to be translated. 1010 /// The function can then return the translated value, 'null' 1011 /// (to remove the item), or an array of values - which will 1012 /// be flattened into the full array. 1013 /// Part of JavaScript 1014 /// </summary> 1015 /// <returns type="Array" /> 1016 /// <param name="elems" type="Array"> 1017 /// array The Array to translate. 1018 /// </param> 1019 /// <param name="fn" type="Function"> 1020 /// The function to process each item against. 1021 /// </param> 1022 1023 var ret = [], value; 1024 1025 // Go through the array, translating each of the items to their 1026 // new value (or values). 1027 for ( var i = 0, length = elems.length; i < length; i++ ) { 1028 value = callback( elems[ i ], i, arg ); 1029 1030 if ( value != null ) { 1031 ret[ ret.length ] = value; 1032 } 1033 } 1034 1035 return ret.concat.apply( [], ret ); 1036 }, 1037 1038 // A global GUID counter for objects 1039 guid: 1, 1040 1041 proxy: function( fn, proxy, thisObject ) { 1042 /// <summary> 1043 /// Takes a function and returns a new one that will always have a particular scope. 1044 /// </summary> 1045 /// <param name="fn" type="Function"> 1046 /// The function whose scope will be changed. 1047 /// </param> 1048 /// <param name="proxy" type="Object"> 1049 /// The object to which the scope of the function should be set. 1050 /// </param> 1051 /// <returns type="Function" /> 1052 1053 if ( arguments.length === 2 ) { 1054 if ( typeof proxy === "string" ) { 1055 thisObject = fn; 1056 fn = thisObject[ proxy ]; 1057 proxy = undefined; 1058 1059 } else if ( proxy && !jQuery.isFunction( proxy ) ) { 1060 thisObject = proxy; 1061 proxy = undefined; 1062 } 1063 } 1064 1065 if ( !proxy && fn ) { 1066 proxy = function() { 1067 return fn.apply( thisObject || this, arguments ); 1068 }; 1069 } 1070 1071 // Set the guid of unique handler to the same of original handler, so it can be removed 1072 if ( fn ) { 1073 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 1074 } 1075 1076 // So proxy can be declared as an argument 1077 return proxy; 1078 }, 1079 1080 // Mutifunctional method to get and set values to a collection 1081 // The value/s can be optionally by executed if its a function 1082 access: function( elems, key, value, exec, fn, pass ) { 1083 var length = elems.length; 1084 1085 // Setting many attributes 1086 if ( typeof key === "object" ) { 1087 for ( var k in key ) { 1088 jQuery.access( elems, k, key[k], exec, fn, value ); 1089 } 1090 return elems; 1091 } 1092 1093 // Setting one attribute 1094 if ( value !== undefined ) { 1095 // Optionally, function values get executed if exec is true 1096 exec = !pass && exec && jQuery.isFunction(value); 1097 1098 for ( var i = 0; i < length; i++ ) { 1099 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); 1100 } 1101 1102 return elems; 1103 } 1104 1105 // Getting an attribute 1106 return length ? fn( elems[0], key ) : undefined; 1107 }, 1108 1109 now: function() { 1110 return (new Date()).getTime(); 1111 }, 1112 1113 // Use of jQuery.browser is frowned upon. 1114 // More details: http://docs.jquery.com/Utilities/jQuery.browser 1115 uaMatch: function( ua ) { 1116 ua = ua.toLowerCase(); 1117 1118 var match = rwebkit.exec( ua ) || 1119 ropera.exec( ua ) || 1120 rmsie.exec( ua ) || 1121 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || 1122 []; 1123 1124 return { browser: match[1] || "", version: match[2] || "0" }; 1125 }, 1126 1127 browser: {} 1128}); 1129 1130// Populate the class2type map 1131jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { 1132 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 1133}); 1134 1135browserMatch = jQuery.uaMatch( userAgent ); 1136if ( browserMatch.browser ) { 1137 jQuery.browser[ browserMatch.browser ] = true; 1138 jQuery.browser.version = browserMatch.version; 1139} 1140 1141// Deprecated, use jQuery.browser.webkit instead 1142if ( jQuery.browser.webkit ) { 1143 jQuery.browser.safari = true; 1144} 1145 1146if ( indexOf ) { 1147 jQuery.inArray = function( elem, array ) { 1148 /// <summary> 1149 /// Determines the index of the first parameter in the array. 1150 /// </summary> 1151 /// <param name="elem">The value to see if it exists in the array.</param> 1152 /// <param name="array" type="Array">The array to look through for the value</param> 1153 /// <returns type="Number" integer="true">The 0-based index of the item if it was found, otherwise -1.</returns> 1154 1155 return indexOf.call( array, elem ); 1156 }; 1157} 1158 1159// Verify that \s matches non-breaking spaces 1160// (IE fails on this test) 1161if ( !rwhite.test( "\xA0" ) ) { 1162 trimLeft = /^[\s\xA0]+/; 1163 trimRight = /[\s\xA0]+$/; 1164} 1165 1166// All jQuery objects should point back to these 1167rootjQuery = jQuery(document); 1168 1169// Cleanup functions for the document ready method 1170if ( document.addEventListener ) { 1171 DOMContentLoaded = function() { 1172 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 1173 jQuery.ready(); 1174 }; 1175 1176} else if ( document.attachEvent ) { 1177 DOMContentLoaded = function() { 1178 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 1179 if ( document.readyState === "complete" ) { 1180 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 1181 jQuery.ready(); 1182 } 1183 }; 1184} 1185 1186// The DOM ready check for Internet Explorer 1187function doScrollCheck() { 1188 if ( jQuery.isReady ) { 1189 return; 1190 } 1191 1192 try { 1193 // If IE is used, use the trick by Diego Perini 1194 // http://javascript.nwbox.com/IEContentLoaded/ 1195 document.documentElement.doScroll("left"); 1196 } catch(e) { 1197 setTimeout( doScrollCheck, 1 ); 1198 return; 1199 } 1200 1201 // and execute any waiting functions 1202 jQuery.ready(); 1203} 1204 1205// Expose jQuery to the global object 1206return (window.jQuery = window.$ = jQuery); 1207 1208})(); 1209 1210 1211 1212// [vsdoc] The following function has been modified for IntelliSense. 1213// [vsdoc] Stubbing support properties to "false" for IntelliSense compat. 1214(function() { 1215 1216 jQuery.support = {}; 1217 1218 // var root = document.documentElement, 1219 // script = document.createElement("script"), 1220 // div = document.createElement("div"), 1221 // id = "script" + jQuery.now(); 1222 1223 // div.style.display = "none"; 1224 // div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; 1225 1226 // var all = div.getElementsByTagName("*"), 1227 // a = div.getElementsByTagName("a")[0], 1228 // select = document.createElement("select"), 1229 // opt = select.appendChild( document.createElement("option") ); 1230 1231 // // Can't get basic test support 1232 // if ( !all || !all.length || !a ) { 1233 // return; 1234 // } 1235 1236 jQuery.support = { 1237 // IE strips leading whitespace when .innerHTML is used 1238 leadingWhitespace: false, 1239 1240 // Make sure that tbody elements aren't automatically inserted 1241 // IE will insert them into empty tables 1242 tbody: false, 1243 1244 // Make sure that link elements get serialized correctly by innerHTML 1245 // This requires a wrapper element in IE 1246 htmlSerialize: false, 1247 1248 // Get the style information from getAttribute 1249 // (IE uses .cssText insted) 1250 style: false, 1251 1252 // Make sure that URLs aren't manipulated 1253 // (IE normalizes it by default) 1254 hrefNormalized: false, 1255 1256 // Make sure that element opacity exists 1257 // (IE uses filter instead) 1258 // Use a regex to work around a WebKit issue. See #5145 1259 opacity: false, 1260 1261 // Verify style float existence 1262 // (IE uses styleFloat instead of cssFloat) 1263 cssFloat: false, 1264 1265 // Make sure that if no value is specified for a checkbox 1266 // that it defaults to "on". 1267 // (WebKit defaults to "" instead) 1268 checkOn: false, 1269 1270 // Make sure that a selected-by-default option has a working selected property. 1271 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 1272 optSelected: false, 1273 1274 // Will be defined later 1275 deleteExpando: false, 1276 optDisabled: false, 1277 checkClone: false, 1278 scriptEval: false, 1279 noCloneEvent: false, 1280 boxModel: false, 1281 inlineBlockNeedsLayout: false, 1282 shrinkWrapBlocks: false, 1283 reliableHiddenOffsets: true 1284 }; 1285 1286 // // Make sure that the options inside disabled selects aren't marked as disabled 1287 // // (WebKit marks them as diabled) 1288 // select.disabled = true; 1289 // jQuery.support.optDisabled = !opt.disabled; 1290 1291 // script.type = "text/javascript"; 1292 // try { 1293 // script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); 1294 // } catch(e) {} 1295 1296 // root.insertBefore( script, root.firstChild ); 1297 1298 // // Make sure that the execution of code works by injecting a script 1299 // // tag with appendChild/createTextNode 1300 // // (IE doesn't support this, fails, and uses .text instead) 1301 // if ( window[ id ] ) { 1302 // jQuery.support.scriptEval = true; 1303 // delete window[ id ]; 1304 // } 1305 1306 // // Test to see if it's possible to delete an expando from an element 1307 // // Fails in Internet Explorer 1308 // try { 1309 // delete script.test; 1310 1311 // } catch(e) { 1312 // jQuery.support.deleteExpando = false; 1313 // } 1314 1315 // root.removeChild( script ); 1316 1317 // if ( div.attachEvent && div.fireEvent ) { 1318 // div.attachEvent("onclick", function click() { 1319 // // Cloning a node shouldn't copy over any 1320 // // bound event handlers (IE does this) 1321 // jQuery.support.noCloneEvent = false; 1322 // div.detachEvent("onclick", click); 1323 // }); 1324 // div.cloneNode(true).fireEvent("onclick"); 1325 // } 1326 1327 // div = document.createElement("div"); 1328 // div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; 1329 1330 // var fragment = document.createDocumentFragment(); 1331 // fragment.appendChild( div.firstChild ); 1332 1333 // // WebKit doesn't clone checked state correctly in fragments 1334 // jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; 1335 1336 // // Figure out if the W3C box model works as expected 1337 // // document.body must exist before we can do this 1338 // jQuery(function() { 1339 // var div = document.createElement("div"); 1340 // div.style.width = div.style.paddingLeft = "1px"; 1341 1342 // document.body.appendChild( div ); 1343 // jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; 1344 1345 // if ( "zoom" in div.style ) { 1346 // // Check if natively block-level elements act like inline-block 1347 // // elements when setting their display to 'inline' and giving 1348 // // them layout 1349 // // (IE < 8 does this) 1350 // div.style.display = "inline"; 1351 // div.style.zoom = 1; 1352 // jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; 1353 1354 // // Check if elements with layout shrink-wrap their children 1355 // // (IE 6 does this) 1356 // div.style.display = ""; 1357 // div.innerHTML = "<div style='width:4px;'></div>"; 1358 // jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; 1359 // } 1360 1361 // div.innerHTML = "<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>"; 1362 // var tds = div.getElementsByTagName("td"); 1363 1364 // // Check if table cells still have offsetWidth/Height when they are set 1365 // // to display:none and there are still other visible table cells in a 1366 // // table row; if so, offsetWidth/Height are not reliable for use when 1367 // // determining if an element has been hidden directly using 1368 // // display:none (it is still safe to use offsets if a parent element is 1369 // // hidden; don safety goggles and see bug #4512 for more information). 1370 // // (only IE 8 fails this test) 1371 // jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; 1372 1373 // tds[0].style.display = ""; 1374 // tds[1].style.display = "none"; 1375 1376 // // Check if empty table cells still have offsetWidth/Height 1377 // // (IE < 8 fail this test) 1378 // jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; 1379 // div.innerHTML = ""; 1380 1381 // document.body.removeChild( div ).style.display = "none"; 1382 // div = tds = null; 1383 // }); 1384 1385 // // Technique from Juriy Zaytsev 1386 // // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ 1387 // var eventSupported = function( eventName ) { 1388 // var el = document.createElement("div"); 1389 // eventName = "on" + eventName; 1390 1391 // var isSupported = (eventName in el); 1392 // if ( !isSupported ) { 1393 // el.setAttribute(eventName, "return;"); 1394 // isSupported = typeof el[eventName] === "function"; 1395 // } 1396 // el = null; 1397 1398 // return isSupported; 1399 // }; 1400 1401 jQuery.support.submitBubbles = false; 1402 jQuery.support.changeBubbles = false; 1403 1404 // // release memory in IE 1405 // root = script = div = all = a = null; 1406})(); 1407 1408 1409 1410var windowData = {}, 1411 rbrace = /^(?:\{.*\}|\[.*\])$/; 1412 1413jQuery.extend({ 1414 cache: {}, 1415 1416 // Please use with caution 1417 uuid: 0, 1418 1419 // Unique for each copy of jQuery on the page 1420 expando: "jQuery" + jQuery.now(), 1421 1422 // The following elements throw uncatchable exceptions if you 1423 // attempt to add expando properties to them. 1424 noData: { 1425 "embed": true, 1426 // Ban all objects except for Flash (which handle expandos) 1427 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", 1428 "applet": true 1429 }, 1430 1431 data: function( elem, name, data ) { 1432 /// <summary> 1433 /// Store arbitrary data associated with the specified element. 1434 /// </summary> 1435 /// <param name="elem" type="Element"> 1436 /// The DOM element to associate with the data. 1437 /// </param> 1438 /// <param name="name" type="String"> 1439 /// A string naming the piece of data to set. 1440 /// </param> 1441 /// <param name="value" type="Object"> 1442 /// The new data value. 1443 /// </param> 1444 /// <returns type="jQuery" /> 1445 1446 if ( !jQuery.acceptData( elem ) ) { 1447 return; 1448 } 1449 1450 elem = elem == window ? 1451 windowData : 1452 elem; 1453 1454 var isNode = elem.nodeType, 1455 id = isNode ? elem[ jQuery.expando ] : null, 1456 cache = jQuery.cache, thisCache; 1457 1458 if ( isNode && !id && typeof name === "string" && data === undefined ) { 1459 return; 1460 } 1461 1462 // Get the data from the object directly 1463 if ( !isNode ) { 1464 cache = elem; 1465 1466 // Compute a unique ID for the element 1467 } else if ( !id ) { 1468 elem[ jQuery.expando ] = id = ++jQuery.uuid; 1469 } 1470 1471 // Avoid generating a new cache unless none exists and we 1472 // want to manipulate it. 1473 if ( typeof name === "object" ) { 1474 if ( isNode ) { 1475 cache[ id ] = jQuery.extend(cache[ id ], name); 1476 1477 } else { 1478 jQuery.extend( cache, name ); 1479 } 1480 1481 } else if ( isNode && !cache[ id ] ) { 1482 cache[ id ] = {}; 1483 } 1484 1485 thisCache = isNode ? cache[ id ] : cache; 1486 1487 // Prevent overriding the named cache with undefined values 1488 if ( data !== undefined ) { 1489 thisCache[ name ] = data; 1490 } 1491 1492 return typeof name === "string" ? thisCache[ name ] : thisCache; 1493 }, 1494 1495 removeData: function( elem, name ) { 1496 if ( !jQuery.acceptData( elem ) ) { 1497 return; 1498 } 1499 1500 elem = elem == window ? 1501 windowData : 1502 elem; 1503 1504 var isNode = elem.nodeType, 1505 id = isNode ? elem[ jQuery.expando ] : elem, 1506 cache = jQuery.cache, 1507 thisCache = isNode ? cache[ id ] : id; 1508 1509 // If we want to remove a specific section of the element's data 1510 if ( name ) { 1511 if ( thisCache ) { 1512 // Remove the section of cache data 1513 delete thisCache[ name ]; 1514 1515 // If we've removed all the data, remove the element's cache 1516 if ( isNode && jQuery.isEmptyObject(thisCache) ) { 1517 jQuery.removeData( elem ); 1518 } 1519 } 1520 1521 // Otherwise, we want to remove all of the element's data 1522 } else { 1523 if ( isNode && jQuery.support.deleteExpando ) { 1524 delete elem[ jQuery.expando ]; 1525 1526 } else if ( elem.removeAttribute ) { 1527 elem.removeAttribute( jQuery.expando ); 1528 1529 // Completely remove the data cache 1530 } else if ( isNode ) { 1531 delete cache[ id ]; 1532 1533 // Remove all fields from the object 1534 } else { 1535 for ( var n in elem ) { 1536 delete elem[ n ]; 1537 } 1538 } 1539 } 1540 }, 1541 1542 // A method for determining if a DOM node can handle the data expando 1543 acceptData: function( elem ) { 1544 if ( elem.nodeName ) { 1545 var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; 1546 1547 if ( match ) { 1548 return !(match === true || elem.getAttribute("classid") !== match); 1549 } 1550 } 1551 1552 return true; 1553 } 1554}); 1555 1556jQuery.fn.extend({ 1557 data: function( key, value ) { 1558 /// <summary> 1559 /// Store arbitrary data associated with the matched elements. 1560 /// </summary> 1561 /// <param name="key" type="String"> 1562 /// A string naming the piece of data to set. 1563 /// </param> 1564 /// <param name="value" type="Object"> 1565 /// The new data value. 1566 /// </param> 1567 /// <returns type="jQuery" /> 1568 1569 var data = null; 1570 1571 if ( typeof key === "undefined" ) { 1572 if ( this.length ) { 1573 var attr = this[0].attributes, name; 1574 data = jQuery.data( this[0] ); 1575 1576 for ( var i = 0, l = attr.length; i < l; i++ ) { 1577 name = attr[i].name; 1578 1579 if ( name.indexOf( "data-" ) === 0 ) { 1580 name = name.substr( 5 ); 1581 dataAttr( this[0], name, data[ name ] ); 1582 } 1583 } 1584 } 1585 1586 return data; 1587 1588 } else if ( typeof key === "object" ) { 1589 return this.each(function() { 1590 jQuery.data( this, key ); 1591 }); 1592 } 1593 1594 var parts = key.split("."); 1595 parts[1] = parts[1] ? "." + parts[1] : ""; 1596 1597 if ( value === undefined ) { 1598 data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 1599 1600 // Try to fetch any internally stored data first 1601 if ( data === undefined && this.length ) { 1602 data = jQuery.data( this[0], key ); 1603 data = dataAttr( this[0], key, data ); 1604 } 1605 1606 return data === undefined && parts[1] ? 1607 this.data( parts[0] ) : 1608 data; 1609 1610 } else { 1611 return this.each(function() { 1612 var $this = jQuery( this ), 1613 args = [ parts[0], value ]; 1614 1615 $this.triggerHandler( "setData" + parts[1] + "!", args ); 1616 jQuery.data( this, key, value ); 1617 $this.triggerHandler( "changeData" + parts[1] + "!", args ); 1618 }); 1619 } 1620 }, 1621 1622 removeData: function( key ) { 1623 return this.each(function() { 1624 jQuery.removeData( this, key ); 1625 }); 1626 } 1627}); 1628 1629function dataAttr( elem, key, data ) { 1630 // If nothing was found internally, try to fetch any 1631 // data from the HTML5 data-* attribute 1632 if ( data === undefined && elem.nodeType === 1 ) { 1633 data = elem.getAttribute( "data-" + key ); 1634 1635 if ( typeof data === "string" ) { 1636 try { 1637 data = data === "true" ? true : 1638 data === "false" ? false : 1639 data === "null" ? null : 1640 !jQuery.isNaN( data ) ? parseFloat( data ) : 1641 rbrace.test( data ) ? jQuery.parseJSON( data ) : 1642 data; 1643 } catch( e ) {} 1644 1645 // Make sure we set the data so it isn't changed later 1646 jQuery.data( elem, key, data ); 1647 1648 } else { 1649 data = undefined; 1650 } 1651 } 1652 1653 return data; 1654} 1655 1656 1657 1658 1659jQuery.extend({ 1660 queue: function( elem, type, data ) { 1661 if ( !elem ) { 1662 return; 1663 } 1664 1665 type = (type || "fx") + "queue"; 1666 var q = jQuery.data( elem, type ); 1667 1668 // Speed up dequeue by getting out quickly if this is just a lookup 1669 if ( !data ) { 1670 return q || []; 1671 } 1672 1673 if ( !q || jQuery.isArray(data) ) { 1674 q = jQuery.data( elem, type, jQuery.makeArray(data) ); 1675 1676 } else { 1677 q.push( data ); 1678 } 1679 1680 return q; 1681 }, 1682 1683 dequeue: function( elem, type ) { 1684 type = type || "fx"; 1685 1686 var queue = jQuery.queue( elem, type ), 1687 fn = queue.shift(); 1688 1689 // If the fx queue is dequeued, always remove the progress sentinel 1690 if ( fn === "inprogress" ) { 1691 fn = queue.shift(); 1692 } 1693 1694 if ( fn ) { 1695 // Add a progress sentinel to prevent the fx queue from being 1696 // automatically dequeued 1697 if ( type === "fx" ) { 1698 queue.unshift("inprogress"); 1699 } 1700 1701 fn.call(elem, function() { 1702 jQuery.dequeue(elem, type); 1703…
Large files files are truncated, but you can click here to view the full file