Pelzini

This is the code documentation for the Pelzini project

source of /coverage/jquery.min.js

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