PageRenderTime 42ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/jquery/1.3.1/jquery.js

https://gitlab.com/Mirros/libs
JavaScript | 1860 lines | 1347 code | 308 blank | 205 comment | 379 complexity | 46c566807d368a2052e3d65f7249525e MD5 | raw file
  1. /*!
  2. * jQuery JavaScript Library v1.3.1
  3. * http://jquery.com/
  4. *
  5. * Copyright (c) 2009 John Resig
  6. * Dual licensed under the MIT and GPL licenses.
  7. * http://docs.jquery.com/License
  8. *
  9. * Date: 2009-01-21 20:42:16 -0500 (Wed, 21 Jan 2009)
  10. * Revision: 6158
  11. */
  12. (function(){
  13. var
  14. // Will speed up references to window, and allows munging its name.
  15. window = this,
  16. // Will speed up references to undefined, and allows munging its name.
  17. undefined,
  18. // Map over jQuery in case of overwrite
  19. _jQuery = window.jQuery,
  20. // Map over the $ in case of overwrite
  21. _$ = window.$,
  22. jQuery = window.jQuery = window.$ = function( selector, context ) {
  23. // The jQuery object is actually just the init constructor 'enhanced'
  24. return new jQuery.fn.init( selector, context );
  25. },
  26. // A simple way to check for HTML strings or ID strings
  27. // (both of which we optimize for)
  28. quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
  29. // Is it a simple selector
  30. isSimple = /^.[^:#\[\.,]*$/;
  31. jQuery.fn = jQuery.prototype = {
  32. init: function( selector, context ) {
  33. // Make sure that a selection was provided
  34. selector = selector || document;
  35. // Handle $(DOMElement)
  36. if ( selector.nodeType ) {
  37. this[0] = selector;
  38. this.length = 1;
  39. this.context = selector;
  40. return this;
  41. }
  42. // Handle HTML strings
  43. if ( typeof selector === "string" ) {
  44. // Are we dealing with HTML string or an ID?
  45. var match = quickExpr.exec( selector );
  46. // Verify a match, and that no context was specified for #id
  47. if ( match && (match[1] || !context) ) {
  48. // HANDLE: $(html) -> $(array)
  49. if ( match[1] )
  50. selector = jQuery.clean( [ match[1] ], context );
  51. // HANDLE: $("#id")
  52. else {
  53. var elem = document.getElementById( match[3] );
  54. // Handle the case where IE and Opera return items
  55. // by name instead of ID
  56. if ( elem && elem.id != match[3] )
  57. return jQuery().find( selector );
  58. // Otherwise, we inject the element directly into the jQuery object
  59. var ret = jQuery( elem || [] );
  60. ret.context = document;
  61. ret.selector = selector;
  62. return ret;
  63. }
  64. // HANDLE: $(expr, [context])
  65. // (which is just equivalent to: $(content).find(expr)
  66. } else
  67. return jQuery( context ).find( selector );
  68. // HANDLE: $(function)
  69. // Shortcut for document ready
  70. } else if ( jQuery.isFunction( selector ) )
  71. return jQuery( document ).ready( selector );
  72. // Make sure that old selector state is passed along
  73. if ( selector.selector && selector.context ) {
  74. this.selector = selector.selector;
  75. this.context = selector.context;
  76. }
  77. return this.setArray(jQuery.makeArray(selector));
  78. },
  79. // Start with an empty selector
  80. selector: "",
  81. // The current version of jQuery being used
  82. jquery: "1.3.1",
  83. // The number of elements contained in the matched element set
  84. size: function() {
  85. return this.length;
  86. },
  87. // Get the Nth element in the matched element set OR
  88. // Get the whole matched element set as a clean array
  89. get: function( num ) {
  90. return num === undefined ?
  91. // Return a 'clean' array
  92. jQuery.makeArray( this ) :
  93. // Return just the object
  94. this[ num ];
  95. },
  96. // Take an array of elements and push it onto the stack
  97. // (returning the new matched element set)
  98. pushStack: function( elems, name, selector ) {
  99. // Build a new jQuery matched element set
  100. var ret = jQuery( elems );
  101. // Add the old object onto the stack (as a reference)
  102. ret.prevObject = this;
  103. ret.context = this.context;
  104. if ( name === "find" )
  105. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  106. else if ( name )
  107. ret.selector = this.selector + "." + name + "(" + selector + ")";
  108. // Return the newly-formed element set
  109. return ret;
  110. },
  111. // Force the current matched set of elements to become
  112. // the specified array of elements (destroying the stack in the process)
  113. // You should use pushStack() in order to do this, but maintain the stack
  114. setArray: function( elems ) {
  115. // Resetting the length to 0, then using the native Array push
  116. // is a super-fast way to populate an object with array-like properties
  117. this.length = 0;
  118. Array.prototype.push.apply( this, elems );
  119. return this;
  120. },
  121. // Execute a callback for every element in the matched set.
  122. // (You can seed the arguments with an array of args, but this is
  123. // only used internally.)
  124. each: function( callback, args ) {
  125. return jQuery.each( this, callback, args );
  126. },
  127. // Determine the position of an element within
  128. // the matched set of elements
  129. index: function( elem ) {
  130. // Locate the position of the desired element
  131. return jQuery.inArray(
  132. // If it receives a jQuery object, the first element is used
  133. elem && elem.jquery ? elem[0] : elem
  134. , this );
  135. },
  136. attr: function( name, value, type ) {
  137. var options = name;
  138. // Look for the case where we're accessing a style value
  139. if ( typeof name === "string" )
  140. if ( value === undefined )
  141. return this[0] && jQuery[ type || "attr" ]( this[0], name );
  142. else {
  143. options = {};
  144. options[ name ] = value;
  145. }
  146. // Check to see if we're setting style values
  147. return this.each(function(i){
  148. // Set all the styles
  149. for ( name in options )
  150. jQuery.attr(
  151. type ?
  152. this.style :
  153. this,
  154. name, jQuery.prop( this, options[ name ], type, i, name )
  155. );
  156. });
  157. },
  158. css: function( key, value ) {
  159. // ignore negative width and height values
  160. if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
  161. value = undefined;
  162. return this.attr( key, value, "curCSS" );
  163. },
  164. text: function( text ) {
  165. if ( typeof text !== "object" && text != null )
  166. return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
  167. var ret = "";
  168. jQuery.each( text || this, function(){
  169. jQuery.each( this.childNodes, function(){
  170. if ( this.nodeType != 8 )
  171. ret += this.nodeType != 1 ?
  172. this.nodeValue :
  173. jQuery.fn.text( [ this ] );
  174. });
  175. });
  176. return ret;
  177. },
  178. wrapAll: function( html ) {
  179. if ( this[0] ) {
  180. // The elements to wrap the target around
  181. var wrap = jQuery( html, this[0].ownerDocument ).clone();
  182. if ( this[0].parentNode )
  183. wrap.insertBefore( this[0] );
  184. wrap.map(function(){
  185. var elem = this;
  186. while ( elem.firstChild )
  187. elem = elem.firstChild;
  188. return elem;
  189. }).append(this);
  190. }
  191. return this;
  192. },
  193. wrapInner: function( html ) {
  194. return this.each(function(){
  195. jQuery( this ).contents().wrapAll( html );
  196. });
  197. },
  198. wrap: function( html ) {
  199. return this.each(function(){
  200. jQuery( this ).wrapAll( html );
  201. });
  202. },
  203. append: function() {
  204. return this.domManip(arguments, true, function(elem){
  205. if (this.nodeType == 1)
  206. this.appendChild( elem );
  207. });
  208. },
  209. prepend: function() {
  210. return this.domManip(arguments, true, function(elem){
  211. if (this.nodeType == 1)
  212. this.insertBefore( elem, this.firstChild );
  213. });
  214. },
  215. before: function() {
  216. return this.domManip(arguments, false, function(elem){
  217. this.parentNode.insertBefore( elem, this );
  218. });
  219. },
  220. after: function() {
  221. return this.domManip(arguments, false, function(elem){
  222. this.parentNode.insertBefore( elem, this.nextSibling );
  223. });
  224. },
  225. end: function() {
  226. return this.prevObject || jQuery( [] );
  227. },
  228. // For internal use only.
  229. // Behaves like an Array's .push method, not like a jQuery method.
  230. push: [].push,
  231. find: function( selector ) {
  232. if ( this.length === 1 && !/,/.test(selector) ) {
  233. var ret = this.pushStack( [], "find", selector );
  234. ret.length = 0;
  235. jQuery.find( selector, this[0], ret );
  236. return ret;
  237. } else {
  238. var elems = jQuery.map(this, function(elem){
  239. return jQuery.find( selector, elem );
  240. });
  241. return this.pushStack( /[^+>] [^+>]/.test( selector ) ?
  242. jQuery.unique( elems ) :
  243. elems, "find", selector );
  244. }
  245. },
  246. clone: function( events ) {
  247. // Do the clone
  248. var ret = this.map(function(){
  249. if ( !jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this) ) {
  250. // IE copies events bound via attachEvent when
  251. // using cloneNode. Calling detachEvent on the
  252. // clone will also remove the events from the orignal
  253. // In order to get around this, we use innerHTML.
  254. // Unfortunately, this means some modifications to
  255. // attributes in IE that are actually only stored
  256. // as properties will not be copied (such as the
  257. // the name attribute on an input).
  258. var clone = this.cloneNode(true),
  259. container = document.createElement("div");
  260. container.appendChild(clone);
  261. return jQuery.clean([container.innerHTML])[0];
  262. } else
  263. return this.cloneNode(true);
  264. });
  265. // Need to set the expando to null on the cloned set if it exists
  266. // removeData doesn't work here, IE removes it from the original as well
  267. // this is primarily for IE but the data expando shouldn't be copied over in any browser
  268. var clone = ret.find("*").andSelf().each(function(){
  269. if ( this[ expando ] !== undefined )
  270. this[ expando ] = null;
  271. });
  272. // Copy the events from the original to the clone
  273. if ( events === true )
  274. this.find("*").andSelf().each(function(i){
  275. if (this.nodeType == 3)
  276. return;
  277. var events = jQuery.data( this, "events" );
  278. for ( var type in events )
  279. for ( var handler in events[ type ] )
  280. jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
  281. });
  282. // Return the cloned set
  283. return ret;
  284. },
  285. filter: function( selector ) {
  286. return this.pushStack(
  287. jQuery.isFunction( selector ) &&
  288. jQuery.grep(this, function(elem, i){
  289. return selector.call( elem, i );
  290. }) ||
  291. jQuery.multiFilter( selector, jQuery.grep(this, function(elem){
  292. return elem.nodeType === 1;
  293. }) ), "filter", selector );
  294. },
  295. closest: function( selector ) {
  296. var pos = jQuery.expr.match.POS.test( selector ) ? jQuery(selector) : null;
  297. return this.map(function(){
  298. var cur = this;
  299. while ( cur && cur.ownerDocument ) {
  300. if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) )
  301. return cur;
  302. cur = cur.parentNode;
  303. }
  304. });
  305. },
  306. not: function( selector ) {
  307. if ( typeof selector === "string" )
  308. // test special case where just one selector is passed in
  309. if ( isSimple.test( selector ) )
  310. return this.pushStack( jQuery.multiFilter( selector, this, true ), "not", selector );
  311. else
  312. selector = jQuery.multiFilter( selector, this );
  313. var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
  314. return this.filter(function() {
  315. return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
  316. });
  317. },
  318. add: function( selector ) {
  319. return this.pushStack( jQuery.unique( jQuery.merge(
  320. this.get(),
  321. typeof selector === "string" ?
  322. jQuery( selector ) :
  323. jQuery.makeArray( selector )
  324. )));
  325. },
  326. is: function( selector ) {
  327. return !!selector && jQuery.multiFilter( selector, this ).length > 0;
  328. },
  329. hasClass: function( selector ) {
  330. return !!selector && this.is( "." + selector );
  331. },
  332. val: function( value ) {
  333. if ( value === undefined ) {
  334. var elem = this[0];
  335. if ( elem ) {
  336. if( jQuery.nodeName( elem, 'option' ) )
  337. return (elem.attributes.value || {}).specified ? elem.value : elem.text;
  338. // We need to handle select boxes special
  339. if ( jQuery.nodeName( elem, "select" ) ) {
  340. var index = elem.selectedIndex,
  341. values = [],
  342. options = elem.options,
  343. one = elem.type == "select-one";
  344. // Nothing was selected
  345. if ( index < 0 )
  346. return null;
  347. // Loop through all the selected options
  348. for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
  349. var option = options[ i ];
  350. if ( option.selected ) {
  351. // Get the specifc value for the option
  352. value = jQuery(option).val();
  353. // We don't need an array for one selects
  354. if ( one )
  355. return value;
  356. // Multi-Selects return an array
  357. values.push( value );
  358. }
  359. }
  360. return values;
  361. }
  362. // Everything else, we just grab the value
  363. return (elem.value || "").replace(/\r/g, "");
  364. }
  365. return undefined;
  366. }
  367. if ( typeof value === "number" )
  368. value += '';
  369. return this.each(function(){
  370. if ( this.nodeType != 1 )
  371. return;
  372. if ( jQuery.isArray(value) && /radio|checkbox/.test( this.type ) )
  373. this.checked = (jQuery.inArray(this.value, value) >= 0 ||
  374. jQuery.inArray(this.name, value) >= 0);
  375. else if ( jQuery.nodeName( this, "select" ) ) {
  376. var values = jQuery.makeArray(value);
  377. jQuery( "option", this ).each(function(){
  378. this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
  379. jQuery.inArray( this.text, values ) >= 0);
  380. });
  381. if ( !values.length )
  382. this.selectedIndex = -1;
  383. } else
  384. this.value = value;
  385. });
  386. },
  387. html: function( value ) {
  388. return value === undefined ?
  389. (this[0] ?
  390. this[0].innerHTML :
  391. null) :
  392. this.empty().append( value );
  393. },
  394. replaceWith: function( value ) {
  395. return this.after( value ).remove();
  396. },
  397. eq: function( i ) {
  398. return this.slice( i, +i + 1 );
  399. },
  400. slice: function() {
  401. return this.pushStack( Array.prototype.slice.apply( this, arguments ),
  402. "slice", Array.prototype.slice.call(arguments).join(",") );
  403. },
  404. map: function( callback ) {
  405. return this.pushStack( jQuery.map(this, function(elem, i){
  406. return callback.call( elem, i, elem );
  407. }));
  408. },
  409. andSelf: function() {
  410. return this.add( this.prevObject );
  411. },
  412. domManip: function( args, table, callback ) {
  413. if ( this[0] ) {
  414. var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
  415. scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
  416. first = fragment.firstChild,
  417. extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
  418. if ( first )
  419. for ( var i = 0, l = this.length; i < l; i++ )
  420. callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
  421. if ( scripts )
  422. jQuery.each( scripts, evalScript );
  423. }
  424. return this;
  425. function root( elem, cur ) {
  426. return table && jQuery.nodeName(elem, "table") && jQuery.nodeName(cur, "tr") ?
  427. (elem.getElementsByTagName("tbody")[0] ||
  428. elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
  429. elem;
  430. }
  431. }
  432. };
  433. // Give the init function the jQuery prototype for later instantiation
  434. jQuery.fn.init.prototype = jQuery.fn;
  435. function evalScript( i, elem ) {
  436. if ( elem.src )
  437. jQuery.ajax({
  438. url: elem.src,
  439. async: false,
  440. dataType: "script"
  441. });
  442. else
  443. jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
  444. if ( elem.parentNode )
  445. elem.parentNode.removeChild( elem );
  446. }
  447. function now(){
  448. return +new Date;
  449. }
  450. jQuery.extend = jQuery.fn.extend = function() {
  451. // copy reference to target object
  452. var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
  453. // Handle a deep copy situation
  454. if ( typeof target === "boolean" ) {
  455. deep = target;
  456. target = arguments[1] || {};
  457. // skip the boolean and the target
  458. i = 2;
  459. }
  460. // Handle case when target is a string or something (possible in deep copy)
  461. if ( typeof target !== "object" && !jQuery.isFunction(target) )
  462. target = {};
  463. // extend jQuery itself if only one argument is passed
  464. if ( length == i ) {
  465. target = this;
  466. --i;
  467. }
  468. for ( ; i < length; i++ )
  469. // Only deal with non-null/undefined values
  470. if ( (options = arguments[ i ]) != null )
  471. // Extend the base object
  472. for ( var name in options ) {
  473. var src = target[ name ], copy = options[ name ];
  474. // Prevent never-ending loop
  475. if ( target === copy )
  476. continue;
  477. // Recurse if we're merging object values
  478. if ( deep && copy && typeof copy === "object" && !copy.nodeType )
  479. target[ name ] = jQuery.extend( deep,
  480. // Never move original objects, clone them
  481. src || ( copy.length != null ? [ ] : { } )
  482. , copy );
  483. // Don't bring in undefined values
  484. else if ( copy !== undefined )
  485. target[ name ] = copy;
  486. }
  487. // Return the modified object
  488. return target;
  489. };
  490. // exclude the following css properties to add px
  491. var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
  492. // cache defaultView
  493. defaultView = document.defaultView || {},
  494. toString = Object.prototype.toString;
  495. jQuery.extend({
  496. noConflict: function( deep ) {
  497. window.$ = _$;
  498. if ( deep )
  499. window.jQuery = _jQuery;
  500. return jQuery;
  501. },
  502. // See test/unit/core.js for details concerning isFunction.
  503. // Since version 1.3, DOM methods and functions like alert
  504. // aren't supported. They return false on IE (#2968).
  505. isFunction: function( obj ) {
  506. return toString.call(obj) === "[object Function]";
  507. },
  508. isArray: function( obj ) {
  509. return toString.call(obj) === "[object Array]";
  510. },
  511. // check if an element is in a (or is an) XML document
  512. isXMLDoc: function( elem ) {
  513. return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
  514. !!elem.ownerDocument && jQuery.isXMLDoc( elem.ownerDocument );
  515. },
  516. // Evalulates a script in a global context
  517. globalEval: function( data ) {
  518. data = jQuery.trim( data );
  519. if ( data ) {
  520. // Inspired by code by Andrea Giammarchi
  521. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  522. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  523. script = document.createElement("script");
  524. script.type = "text/javascript";
  525. if ( jQuery.support.scriptEval )
  526. script.appendChild( document.createTextNode( data ) );
  527. else
  528. script.text = data;
  529. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  530. // This arises when a base node is used (#2709).
  531. head.insertBefore( script, head.firstChild );
  532. head.removeChild( script );
  533. }
  534. },
  535. nodeName: function( elem, name ) {
  536. return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
  537. },
  538. // args is for internal usage only
  539. each: function( object, callback, args ) {
  540. var name, i = 0, length = object.length;
  541. if ( args ) {
  542. if ( length === undefined ) {
  543. for ( name in object )
  544. if ( callback.apply( object[ name ], args ) === false )
  545. break;
  546. } else
  547. for ( ; i < length; )
  548. if ( callback.apply( object[ i++ ], args ) === false )
  549. break;
  550. // A special, fast, case for the most common use of each
  551. } else {
  552. if ( length === undefined ) {
  553. for ( name in object )
  554. if ( callback.call( object[ name ], name, object[ name ] ) === false )
  555. break;
  556. } else
  557. for ( var value = object[0];
  558. i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
  559. }
  560. return object;
  561. },
  562. prop: function( elem, value, type, i, name ) {
  563. // Handle executable functions
  564. if ( jQuery.isFunction( value ) )
  565. value = value.call( elem, i );
  566. // Handle passing in a number to a CSS property
  567. return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ?
  568. value + "px" :
  569. value;
  570. },
  571. className: {
  572. // internal only, use addClass("class")
  573. add: function( elem, classNames ) {
  574. jQuery.each((classNames || "").split(/\s+/), function(i, className){
  575. if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
  576. elem.className += (elem.className ? " " : "") + className;
  577. });
  578. },
  579. // internal only, use removeClass("class")
  580. remove: function( elem, classNames ) {
  581. if (elem.nodeType == 1)
  582. elem.className = classNames !== undefined ?
  583. jQuery.grep(elem.className.split(/\s+/), function(className){
  584. return !jQuery.className.has( classNames, className );
  585. }).join(" ") :
  586. "";
  587. },
  588. // internal only, use hasClass("class")
  589. has: function( elem, className ) {
  590. return elem && jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
  591. }
  592. },
  593. // A method for quickly swapping in/out CSS properties to get correct calculations
  594. swap: function( elem, options, callback ) {
  595. var old = {};
  596. // Remember the old values, and insert the new ones
  597. for ( var name in options ) {
  598. old[ name ] = elem.style[ name ];
  599. elem.style[ name ] = options[ name ];
  600. }
  601. callback.call( elem );
  602. // Revert the old values
  603. for ( var name in options )
  604. elem.style[ name ] = old[ name ];
  605. },
  606. css: function( elem, name, force ) {
  607. if ( name == "width" || name == "height" ) {
  608. var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
  609. function getWH() {
  610. val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
  611. var padding = 0, border = 0;
  612. jQuery.each( which, function() {
  613. padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
  614. border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
  615. });
  616. val -= Math.round(padding + border);
  617. }
  618. if ( jQuery(elem).is(":visible") )
  619. getWH();
  620. else
  621. jQuery.swap( elem, props, getWH );
  622. return Math.max(0, val);
  623. }
  624. return jQuery.curCSS( elem, name, force );
  625. },
  626. curCSS: function( elem, name, force ) {
  627. var ret, style = elem.style;
  628. // We need to handle opacity special in IE
  629. if ( name == "opacity" && !jQuery.support.opacity ) {
  630. ret = jQuery.attr( style, "opacity" );
  631. return ret == "" ?
  632. "1" :
  633. ret;
  634. }
  635. // Make sure we're using the right name for getting the float value
  636. if ( name.match( /float/i ) )
  637. name = styleFloat;
  638. if ( !force && style && style[ name ] )
  639. ret = style[ name ];
  640. else if ( defaultView.getComputedStyle ) {
  641. // Only "float" is needed here
  642. if ( name.match( /float/i ) )
  643. name = "float";
  644. name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
  645. var computedStyle = defaultView.getComputedStyle( elem, null );
  646. if ( computedStyle )
  647. ret = computedStyle.getPropertyValue( name );
  648. // We should always get a number back from opacity
  649. if ( name == "opacity" && ret == "" )
  650. ret = "1";
  651. } else if ( elem.currentStyle ) {
  652. var camelCase = name.replace(/\-(\w)/g, function(all, letter){
  653. return letter.toUpperCase();
  654. });
  655. ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
  656. // From the awesome hack by Dean Edwards
  657. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  658. // If we're not dealing with a regular pixel number
  659. // but a number that has a weird ending, we need to convert it to pixels
  660. if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
  661. // Remember the original values
  662. var left = style.left, rsLeft = elem.runtimeStyle.left;
  663. // Put in the new values to get a computed value out
  664. elem.runtimeStyle.left = elem.currentStyle.left;
  665. style.left = ret || 0;
  666. ret = style.pixelLeft + "px";
  667. // Revert the changed values
  668. style.left = left;
  669. elem.runtimeStyle.left = rsLeft;
  670. }
  671. }
  672. return ret;
  673. },
  674. clean: function( elems, context, fragment ) {
  675. context = context || document;
  676. // !context.createElement fails in IE with an error but returns typeof 'object'
  677. if ( typeof context.createElement === "undefined" )
  678. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  679. // If a single string is passed in and it's a single tag
  680. // just do a createElement and skip the rest
  681. if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
  682. var match = /^<(\w+)\s*\/?>$/.exec(elems[0]);
  683. if ( match )
  684. return [ context.createElement( match[1] ) ];
  685. }
  686. var ret = [], scripts = [], div = context.createElement("div");
  687. jQuery.each(elems, function(i, elem){
  688. if ( typeof elem === "number" )
  689. elem += '';
  690. if ( !elem )
  691. return;
  692. // Convert html string into DOM nodes
  693. if ( typeof elem === "string" ) {
  694. // Fix "XHTML"-style tags in all browsers
  695. elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
  696. return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
  697. all :
  698. front + "></" + tag + ">";
  699. });
  700. // Trim whitespace, otherwise indexOf won't work as expected
  701. var tags = jQuery.trim( elem ).toLowerCase();
  702. var wrap =
  703. // option or optgroup
  704. !tags.indexOf("<opt") &&
  705. [ 1, "<select multiple='multiple'>", "</select>" ] ||
  706. !tags.indexOf("<leg") &&
  707. [ 1, "<fieldset>", "</fieldset>" ] ||
  708. tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
  709. [ 1, "<table>", "</table>" ] ||
  710. !tags.indexOf("<tr") &&
  711. [ 2, "<table><tbody>", "</tbody></table>" ] ||
  712. // <thead> matched above
  713. (!tags.indexOf("<td") || !tags.indexOf("<th")) &&
  714. [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ] ||
  715. !tags.indexOf("<col") &&
  716. [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ] ||
  717. // IE can't serialize <link> and <script> tags normally
  718. !jQuery.support.htmlSerialize &&
  719. [ 1, "div<div>", "</div>" ] ||
  720. [ 0, "", "" ];
  721. // Go to html and back, then peel off extra wrappers
  722. div.innerHTML = wrap[1] + elem + wrap[2];
  723. // Move to the right depth
  724. while ( wrap[0]-- )
  725. div = div.lastChild;
  726. // Remove IE's autoinserted <tbody> from table fragments
  727. if ( !jQuery.support.tbody ) {
  728. // String was a <table>, *may* have spurious <tbody>
  729. var tbody = !tags.indexOf("<table") && tags.indexOf("<tbody") < 0 ?
  730. div.firstChild && div.firstChild.childNodes :
  731. // String was a bare <thead> or <tfoot>
  732. wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ?
  733. div.childNodes :
  734. [];
  735. for ( var j = tbody.length - 1; j >= 0 ; --j )
  736. if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length )
  737. tbody[ j ].parentNode.removeChild( tbody[ j ] );
  738. }
  739. // IE completely kills leading whitespace when innerHTML is used
  740. if ( !jQuery.support.leadingWhitespace && /^\s/.test( elem ) )
  741. div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild );
  742. elem = jQuery.makeArray( div.childNodes );
  743. }
  744. if ( elem.nodeType )
  745. ret.push( elem );
  746. else
  747. ret = jQuery.merge( ret, elem );
  748. });
  749. if ( fragment ) {
  750. for ( var i = 0; ret[i]; i++ ) {
  751. if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
  752. scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
  753. } else {
  754. if ( ret[i].nodeType === 1 )
  755. ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
  756. fragment.appendChild( ret[i] );
  757. }
  758. }
  759. return scripts;
  760. }
  761. return ret;
  762. },
  763. attr: function( elem, name, value ) {
  764. // don't set attributes on text and comment nodes
  765. if (!elem || elem.nodeType == 3 || elem.nodeType == 8)
  766. return undefined;
  767. var notxml = !jQuery.isXMLDoc( elem ),
  768. // Whether we are setting (or getting)
  769. set = value !== undefined;
  770. // Try to normalize/fix the name
  771. name = notxml && jQuery.props[ name ] || name;
  772. // Only do all the following if this is a node (faster for style)
  773. // IE elem.getAttribute passes even for style
  774. if ( elem.tagName ) {
  775. // These attributes require special treatment
  776. var special = /href|src|style/.test( name );
  777. // Safari mis-reports the default selected property of a hidden option
  778. // Accessing the parent's selectedIndex property fixes it
  779. if ( name == "selected" && elem.parentNode )
  780. elem.parentNode.selectedIndex;
  781. // If applicable, access the attribute via the DOM 0 way
  782. if ( name in elem && notxml && !special ) {
  783. if ( set ){
  784. // We can't allow the type property to be changed (since it causes problems in IE)
  785. if ( name == "type" && jQuery.nodeName( elem, "input" ) && elem.parentNode )
  786. throw "type property can't be changed";
  787. elem[ name ] = value;
  788. }
  789. // browsers index elements by id/name on forms, give priority to attributes.
  790. if( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) )
  791. return elem.getAttributeNode( name ).nodeValue;
  792. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  793. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  794. if ( name == "tabIndex" ) {
  795. var attributeNode = elem.getAttributeNode( "tabIndex" );
  796. return attributeNode && attributeNode.specified
  797. ? attributeNode.value
  798. : elem.nodeName.match(/(button|input|object|select|textarea)/i)
  799. ? 0
  800. : elem.nodeName.match(/^(a|area)$/i) && elem.href
  801. ? 0
  802. : undefined;
  803. }
  804. return elem[ name ];
  805. }
  806. if ( !jQuery.support.style && notxml && name == "style" )
  807. return jQuery.attr( elem.style, "cssText", value );
  808. if ( set )
  809. // convert the value to a string (all browsers do this but IE) see #1070
  810. elem.setAttribute( name, "" + value );
  811. var attr = !jQuery.support.hrefNormalized && notxml && special
  812. // Some attributes require a special call on IE
  813. ? elem.getAttribute( name, 2 )
  814. : elem.getAttribute( name );
  815. // Non-existent attributes return null, we normalize to undefined
  816. return attr === null ? undefined : attr;
  817. }
  818. // elem is actually elem.style ... set the style
  819. // IE uses filters for opacity
  820. if ( !jQuery.support.opacity && name == "opacity" ) {
  821. if ( set ) {
  822. // IE has trouble with opacity if it does not have layout
  823. // Force it by setting the zoom level
  824. elem.zoom = 1;
  825. // Set the alpha filter to set the opacity
  826. elem.filter = (elem.filter || "").replace( /alpha\([^)]*\)/, "" ) +
  827. (parseInt( value ) + '' == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
  828. }
  829. return elem.filter && elem.filter.indexOf("opacity=") >= 0 ?
  830. (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100) + '':
  831. "";
  832. }
  833. name = name.replace(/-([a-z])/ig, function(all, letter){
  834. return letter.toUpperCase();
  835. });
  836. if ( set )
  837. elem[ name ] = value;
  838. return elem[ name ];
  839. },
  840. trim: function( text ) {
  841. return (text || "").replace( /^\s+|\s+$/g, "" );
  842. },
  843. makeArray: function( array ) {
  844. var ret = [];
  845. if( array != null ){
  846. var i = array.length;
  847. // The window, strings (and functions) also have 'length'
  848. if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
  849. ret[0] = array;
  850. else
  851. while( i )
  852. ret[--i] = array[i];
  853. }
  854. return ret;
  855. },
  856. inArray: function( elem, array ) {
  857. for ( var i = 0, length = array.length; i < length; i++ )
  858. // Use === because on IE, window == document
  859. if ( array[ i ] === elem )
  860. return i;
  861. return -1;
  862. },
  863. merge: function( first, second ) {
  864. // We have to loop this way because IE & Opera overwrite the length
  865. // expando of getElementsByTagName
  866. var i = 0, elem, pos = first.length;
  867. // Also, we need to make sure that the correct elements are being returned
  868. // (IE returns comment nodes in a '*' query)
  869. if ( !jQuery.support.getAll ) {
  870. while ( (elem = second[ i++ ]) != null )
  871. if ( elem.nodeType != 8 )
  872. first[ pos++ ] = elem;
  873. } else
  874. while ( (elem = second[ i++ ]) != null )
  875. first[ pos++ ] = elem;
  876. return first;
  877. },
  878. unique: function( array ) {
  879. var ret = [], done = {};
  880. try {
  881. for ( var i = 0, length = array.length; i < length; i++ ) {
  882. var id = jQuery.data( array[ i ] );
  883. if ( !done[ id ] ) {
  884. done[ id ] = true;
  885. ret.push( array[ i ] );
  886. }
  887. }
  888. } catch( e ) {
  889. ret = array;
  890. }
  891. return ret;
  892. },
  893. grep: function( elems, callback, inv ) {
  894. var ret = [];
  895. // Go through the array, only saving the items
  896. // that pass the validator function
  897. for ( var i = 0, length = elems.length; i < length; i++ )
  898. if ( !inv != !callback( elems[ i ], i ) )
  899. ret.push( elems[ i ] );
  900. return ret;
  901. },
  902. map: function( elems, callback ) {
  903. var ret = [];
  904. // Go through the array, translating each of the items to their
  905. // new value (or values).
  906. for ( var i = 0, length = elems.length; i < length; i++ ) {
  907. var value = callback( elems[ i ], i );
  908. if ( value != null )
  909. ret[ ret.length ] = value;
  910. }
  911. return ret.concat.apply( [], ret );
  912. }
  913. });
  914. // Use of jQuery.browser is deprecated.
  915. // It's included for backwards compatibility and plugins,
  916. // although they should work to migrate away.
  917. var userAgent = navigator.userAgent.toLowerCase();
  918. // Figure out what browser is being used
  919. jQuery.browser = {
  920. version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
  921. safari: /webkit/.test( userAgent ),
  922. opera: /opera/.test( userAgent ),
  923. msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
  924. mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  925. };
  926. jQuery.each({
  927. parent: function(elem){return elem.parentNode;},
  928. parents: function(elem){return jQuery.dir(elem,"parentNode");},
  929. next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
  930. prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
  931. nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
  932. prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
  933. siblings: function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},
  934. children: function(elem){return jQuery.sibling(elem.firstChild);},
  935. contents: function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
  936. }, function(name, fn){
  937. jQuery.fn[ name ] = function( selector ) {
  938. var ret = jQuery.map( this, fn );
  939. if ( selector && typeof selector == "string" )
  940. ret = jQuery.multiFilter( selector, ret );
  941. return this.pushStack( jQuery.unique( ret ), name, selector );
  942. };
  943. });
  944. jQuery.each({
  945. appendTo: "append",
  946. prependTo: "prepend",
  947. insertBefore: "before",
  948. insertAfter: "after",
  949. replaceAll: "replaceWith"
  950. }, function(name, original){
  951. jQuery.fn[ name ] = function() {
  952. var args = arguments;
  953. return this.each(function(){
  954. for ( var i = 0, length = args.length; i < length; i++ )
  955. jQuery( args[ i ] )[ original ]( this );
  956. });
  957. };
  958. });
  959. jQuery.each({
  960. removeAttr: function( name ) {
  961. jQuery.attr( this, name, "" );
  962. if (this.nodeType == 1)
  963. this.removeAttribute( name );
  964. },
  965. addClass: function( classNames ) {
  966. jQuery.className.add( this, classNames );
  967. },
  968. removeClass: function( classNames ) {
  969. jQuery.className.remove( this, classNames );
  970. },
  971. toggleClass: function( classNames, state ) {
  972. if( typeof state !== "boolean" )
  973. state = !jQuery.className.has( this, classNames );
  974. jQuery.className[ state ? "add" : "remove" ]( this, classNames );
  975. },
  976. remove: function( selector ) {
  977. if ( !selector || jQuery.filter( selector, [ this ] ).length ) {
  978. // Prevent memory leaks
  979. jQuery( "*", this ).add([this]).each(function(){
  980. jQuery.event.remove(this);
  981. jQuery.removeData(this);
  982. });
  983. if (this.parentNode)
  984. this.parentNode.removeChild( this );
  985. }
  986. },
  987. empty: function() {
  988. // Remove element nodes and prevent memory leaks
  989. jQuery( ">*", this ).remove();
  990. // Remove any remaining nodes
  991. while ( this.firstChild )
  992. this.removeChild( this.firstChild );
  993. }
  994. }, function(name, fn){
  995. jQuery.fn[ name ] = function(){
  996. return this.each( fn, arguments );
  997. };
  998. });
  999. // Helper function used by the dimensions and offset modules
  1000. function num(elem, prop) {
  1001. return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0;
  1002. }
  1003. var expando = "jQuery" + now(), uuid = 0, windowData = {};
  1004. jQuery.extend({
  1005. cache: {},
  1006. data: function( elem, name, data ) {
  1007. elem = elem == window ?
  1008. windowData :
  1009. elem;
  1010. var id = elem[ expando ];
  1011. // Compute a unique ID for the element
  1012. if ( !id )
  1013. id = elem[ expando ] = ++uuid;
  1014. // Only generate the data cache if we're
  1015. // trying to access or manipulate it
  1016. if ( name && !jQuery.cache[ id ] )
  1017. jQuery.cache[ id ] = {};
  1018. // Prevent overriding the named cache with undefined values
  1019. if ( data !== undefined )
  1020. jQuery.cache[ id ][ name ] = data;
  1021. // Return the named cache data, or the ID for the element
  1022. return name ?
  1023. jQuery.cache[ id ][ name ] :
  1024. id;
  1025. },
  1026. removeData: function( elem, name ) {
  1027. elem = elem == window ?
  1028. windowData :
  1029. elem;
  1030. var id = elem[ expando ];
  1031. // If we want to remove a specific section of the element's data
  1032. if ( name ) {
  1033. if ( jQuery.cache[ id ] ) {
  1034. // Remove the section of cache data
  1035. delete jQuery.cache[ id ][ name ];
  1036. // If we've removed all the data, remove the element's cache
  1037. name = "";
  1038. for ( name in jQuery.cache[ id ] )
  1039. break;
  1040. if ( !name )
  1041. jQuery.removeData( elem );
  1042. }
  1043. // Otherwise, we want to remove all of the element's data
  1044. } else {
  1045. // Clean up the element expando
  1046. try {
  1047. delete elem[ expando ];
  1048. } catch(e){
  1049. // IE has trouble directly removing the expando
  1050. // but it's ok with using removeAttribute
  1051. if ( elem.removeAttribute )
  1052. elem.removeAttribute( expando );
  1053. }
  1054. // Completely remove the data cache
  1055. delete jQuery.cache[ id ];
  1056. }
  1057. },
  1058. queue: function( elem, type, data ) {
  1059. if ( elem ){
  1060. type = (type || "fx") + "queue";
  1061. var q = jQuery.data( elem, type );
  1062. if ( !q || jQuery.isArray(data) )
  1063. q = jQuery.data( elem, type, jQuery.makeArray(data) );
  1064. else if( data )
  1065. q.push( data );
  1066. }
  1067. return q;
  1068. },
  1069. dequeue: function( elem, type ){
  1070. var queue = jQuery.queue( elem, type ),
  1071. fn = queue.shift();
  1072. if( !type || type === "fx" )
  1073. fn = queue[0];
  1074. if( fn !== undefined )
  1075. fn.call(elem);
  1076. }
  1077. });
  1078. jQuery.fn.extend({
  1079. data: function( key, value ){
  1080. var parts = key.split(".");
  1081. parts[1] = parts[1] ? "." + parts[1] : "";
  1082. if ( value === undefined ) {
  1083. var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  1084. if ( data === undefined && this.length )
  1085. data = jQuery.data( this[0], key );
  1086. return data === undefined && parts[1] ?
  1087. this.data( parts[0] ) :
  1088. data;
  1089. } else
  1090. return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
  1091. jQuery.data( this, key, value );
  1092. });
  1093. },
  1094. removeData: function( key ){
  1095. return this.each(function(){
  1096. jQuery.removeData( this, key );
  1097. });
  1098. },
  1099. queue: function(type, data){
  1100. if ( typeof type !== "string" ) {
  1101. data = type;
  1102. type = "fx";
  1103. }
  1104. if ( data === undefined )
  1105. return jQuery.queue( this[0], type );
  1106. return this.each(function(){
  1107. var queue = jQuery.queue( this, type, data );
  1108. if( type == "fx" && queue.length == 1 )
  1109. queue[0].call(this);
  1110. });
  1111. },
  1112. dequeue: function(type){
  1113. return this.each(function(){
  1114. jQuery.dequeue( this, type );
  1115. });
  1116. }
  1117. });/*!
  1118. * Sizzle CSS Selector Engine - v0.9.3
  1119. * Copyright 2009, The Dojo Foundation
  1120. * Released under the MIT, BSD, and GPL Licenses.
  1121. * More information: http://sizzlejs.com/
  1122. */
  1123. (function(){
  1124. var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
  1125. done = 0,
  1126. toString = Object.prototype.toString;
  1127. var Sizzle = function(selector, context, results, seed) {
  1128. results = results || [];
  1129. context = context || document;
  1130. if ( context.nodeType !== 1 && context.nodeType !== 9 )
  1131. return [];
  1132. if ( !selector || typeof selector !== "string" ) {
  1133. return results;
  1134. }
  1135. var parts = [], m, set, checkSet, check, mode, extra, prune = true;
  1136. // Reset the position of the chunker regexp (start from head)
  1137. chunker.lastIndex = 0;
  1138. while ( (m = chunker.exec(selector)) !== null ) {
  1139. parts.push( m[1] );
  1140. if ( m[2] ) {
  1141. extra = RegExp.rightContext;
  1142. break;
  1143. }
  1144. }
  1145. if ( parts.length > 1 && origPOS.exec( selector ) ) {
  1146. if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
  1147. set = posProcess( parts[0] + parts[1], context );
  1148. } else {
  1149. set = Expr.relative[ parts[0] ] ?
  1150. [ context ] :
  1151. Sizzle( parts.shift(), context );
  1152. while ( parts.length ) {
  1153. selector = parts.shift();
  1154. if ( Expr.relative[ selector ] )
  1155. selector += parts.shift();
  1156. set = posProcess( selector, set );
  1157. }
  1158. }
  1159. } else {
  1160. var ret = seed ?
  1161. { expr: parts.pop(), set: makeArray(seed) } :
  1162. Sizzle.find( parts.pop(), parts.length === 1 && context.parentNode ? context.parentNode : context, isXML(context) );
  1163. set = Sizzle.filter( ret.expr, ret.set );
  1164. if ( parts.length > 0 ) {
  1165. checkSet = makeArray(set);
  1166. } else {
  1167. prune = false;
  1168. }
  1169. while ( parts.length ) {
  1170. var cur = parts.pop(), pop = cur;
  1171. if ( !Expr.relative[ cur ] ) {
  1172. cur = "";
  1173. } else {
  1174. pop = parts.pop();
  1175. }
  1176. if ( pop == null ) {
  1177. pop = context;
  1178. }
  1179. Expr.relative[ cur ]( checkSet, pop, isXML(context) );
  1180. }
  1181. }
  1182. if ( !checkSet ) {
  1183. checkSet = set;
  1184. }
  1185. if ( !checkSet ) {
  1186. throw "Syntax error, unrecognized expression: " + (cur || selector);
  1187. }
  1188. if ( toString.call(checkSet) === "[object Array]" ) {
  1189. if ( !prune ) {
  1190. results.push.apply( results, checkSet );
  1191. } else if ( context.nodeType === 1 ) {
  1192. for ( var i = 0; checkSet[i] != null; i++ ) {
  1193. if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
  1194. results.push( set[i] );
  1195. }
  1196. }
  1197. } else {
  1198. for ( var i = 0; checkSet[i] != null; i++ ) {
  1199. if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
  1200. results.push( set[i] );
  1201. }
  1202. }
  1203. }
  1204. } else {
  1205. makeArray( checkSet, results );
  1206. }
  1207. if ( extra ) {
  1208. Sizzle( extra, context, results, seed );
  1209. }
  1210. return results;
  1211. };
  1212. Sizzle.matches = function(expr, set){
  1213. return Sizzle(expr, null, null, set);
  1214. };
  1215. Sizzle.find = function(expr, context, isXML){
  1216. var set, match;
  1217. if ( !expr ) {
  1218. return [];
  1219. }
  1220. for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
  1221. var type = Expr.order[i], match;
  1222. if ( (match = Expr.match[ type ].exec( expr )) ) {
  1223. var left = RegExp.leftContext;
  1224. if ( left.substr( left.length - 1 ) !== "\\" ) {
  1225. match[1] = (match[1] || "").replace(/\\/g, "");
  1226. set = Expr.find[ type ]( match, context, isXML );
  1227. if ( set != null ) {
  1228. expr = expr.replace( Expr.match[ type ], "" );
  1229. break;
  1230. }
  1231. }
  1232. }
  1233. }
  1234. if ( !set ) {
  1235. set = context.getElementsByTagName("*");
  1236. }
  1237. return {set: set, expr: expr};
  1238. };
  1239. Sizzle.filter = function(expr, set, inplace, not){
  1240. var old = expr, result = [], curLoop = set, match, anyFound;
  1241. while ( expr && set.length ) {
  1242. for ( var type in Expr.filter ) {
  1243. if ( (match = Expr.match[ type ].exec( expr )) != null ) {
  1244. var filter = Expr.filter[ type ], found, item;
  1245. anyFound = false;
  1246. if ( curLoop == result ) {
  1247. result = [];
  1248. }
  1249. if ( Expr.preFilter[ type ] ) {
  1250. match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not );
  1251. if ( !match ) {
  1252. anyFound = found = true;
  1253. } else if ( match === true ) {
  1254. continue;
  1255. }
  1256. }
  1257. if ( match ) {
  1258. for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
  1259. if ( item ) {
  1260. found = filter( item, match, i, curLoop );
  1261. var pass = not ^ !!found;
  1262. if ( inplace && found != null ) {
  1263. if ( pass ) {
  1264. anyFound = true;
  1265. } else {
  1266. curLoop[i] = false;
  1267. }
  1268. } else if ( pass ) {
  1269. result.push( item );
  1270. anyFound = true;
  1271. }
  1272. }
  1273. }
  1274. }
  1275. if ( found !== undefined ) {
  1276. if ( !inplace ) {
  1277. curLoop = result;
  1278. }
  1279. expr = expr.replace( Expr.match[ type ], "" );
  1280. if ( !anyFound ) {
  1281. return [];
  1282. }
  1283. break;
  1284. }
  1285. }
  1286. }
  1287. expr = expr.replace(/\s*,\s*/, "");
  1288. // Improper expression
  1289. if ( expr == old ) {
  1290. if ( anyFound == null ) {
  1291. throw "Syntax error, unrecognized expression: " + expr;
  1292. } else {
  1293. break;
  1294. }
  1295. }
  1296. old = expr;
  1297. }
  1298. return curLoop;
  1299. };
  1300. var Expr = Sizzle.selectors = {
  1301. order: [ "ID", "NAME", "TAG" ],
  1302. match: {
  1303. ID: /#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1304. CLASS: /\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,
  1305. NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,
  1306. ATTR: /\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
  1307. TAG: /^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,
  1308. CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
  1309. POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
  1310. PSEUDO: /:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
  1311. },
  1312. attrMap: {
  1313. "class": "className",
  1314. "for": "htmlFor"
  1315. },
  1316. attrHandle: {
  1317. href: function(elem){
  1318. return elem.getAttribute("href");
  1319. }
  1320. },
  1321. relative: {
  1322. "+": function(checkSet, part){
  1323. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1324. var elem = checkSet[i];
  1325. if ( elem ) {
  1326. var cur = elem.previousSibling;
  1327. while ( cur && cur.nodeType !== 1 ) {
  1328. cur = cur.previousSibling;
  1329. }
  1330. checkSet[i] = typeof part === "string" ?
  1331. cur || false :
  1332. cur === part;
  1333. }
  1334. }
  1335. if ( typeof part === "string" ) {
  1336. Sizzle.filter( part, checkSet, true );
  1337. }
  1338. },
  1339. ">": function(checkSet, part, isXML){
  1340. if ( typeof part === "string" && !/\W/.test(part) ) {
  1341. part = isXML ? part : part.toUpperCase();
  1342. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1343. var elem = checkSet[i];
  1344. if ( elem ) {
  1345. var parent = elem.parentNode;
  1346. checkSet[i] = parent.nodeName === part ? parent : false;
  1347. }
  1348. }
  1349. } else {
  1350. for ( var i = 0, l = checkSet.length; i < l; i++ ) {
  1351. var elem = checkSet[i];
  1352. if ( elem ) {
  1353. checkSet[i] = typeof part === "string" ?
  1354. elem.parentNode :
  1355. elem.parentNode === part;
  1356. }
  1357. }
  1358. if ( typeof part === "string" ) {
  1359. Sizzle.filter( part, checkSet, true );
  1360. }
  1361. }
  1362. },
  1363. "": function(checkSet, part, isXML){
  1364. var doneName = "done" + (done++), checkFn = dirCheck;
  1365. if ( !part.match(/\W/) ) {
  1366. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1367. checkFn = dirNodeCheck;
  1368. }
  1369. checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
  1370. },
  1371. "~": function(checkSet, part, isXML){
  1372. var doneName = "done" + (done++), checkFn = dirCheck;
  1373. if ( typeof part === "string" && !part.match(/\W/) ) {
  1374. var nodeCheck = part = isXML ? part : part.toUpperCase();
  1375. checkFn = dirNodeCheck;
  1376. }
  1377. checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
  1378. }
  1379. },
  1380. find: {
  1381. ID: function(match, context, isXML){
  1382. if ( typeof context.getElementById !== "undefined" && !isXML ) {
  1383. var m = context.getElementById(match[1]);
  1384. return m ? [m] : [];
  1385. }
  1386. },
  1387. NAME: function(match, context, isXML){
  1388. if ( typeof context.getElementsByName !== "undefined" && !isXML ) {
  1389. return context.getElementsByName(match[1]);
  1390. }
  1391. },
  1392. TAG: function(match, context){
  1393. return context.getElementsByTagName(match[1]);
  1394. }
  1395. },
  1396. preFilter: {
  1397. CLASS: function(match, curLoop, inplace, result, not){
  1398. match = " " + match[1].replace(/\\/g, "") + " ";
  1399. var elem;
  1400. for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
  1401. if ( elem ) {
  1402. if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
  1403. if ( !inplace )
  1404. result.push( elem );
  1405. } else if ( inplace ) {
  1406. curLoop[i] = false;
  1407. }
  1408. }
  1409. }
  1410. return false;
  1411. },
  1412. ID: function(match){
  1413. return match[1].replace(/\\/g, "");
  1414. },
  1415. TAG: function(match, curLoop){
  1416. for ( var i = 0; curLoop[i] === false; i++ ){}
  1417. return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase();
  1418. },
  1419. CHILD: function(match){
  1420. if ( match[1] == "nth" ) {
  1421. // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
  1422. var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
  1423. match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
  1424. !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
  1425. // calculate the numbers (first)n+(last) including if they are negative
  1426. match[2] = (test[1] + (test[2] || 1)) - 0;
  1427. match[3] = test[3] - 0;
  1428. }
  1429. // TODO: Move to normal caching system
  1430. match[0] = "done" + (done++);
  1431. return match;
  1432. },
  1433. ATTR: function(match){
  1434. var name = match[1].replace(/\\/g, "");
  1435. if ( Expr.attrMap[name] ) {
  1436. match[1] = Expr.attrMap[name];
  1437. }
  1438. if ( match[2] === "~=" ) {
  1439. match[4] = " " + match[4] + " ";
  1440. }
  1441. return match;
  1442. },
  1443. PSEUDO: function(match, curLoop, inplace, result, not){
  1444. if ( match[1] === "not" ) {
  1445. // If we're dealing with a complex expression, or a simple one
  1446. if ( match[3].match(chunker).length > 1 ) {
  1447. match[3] = Sizzle(match[3], null, null, curLoop);
  1448. } else {
  1449. var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
  1450. if ( !inplace ) {
  1451. result.push.apply( result, ret );
  1452. }
  1453. return false;
  1454. }
  1455. } else if ( Expr.match.POS.test( match[0] ) ) {
  1456. return true;
  1457. }
  1458. return match;
  1459. },
  1460. POS: function(match){
  1461. match.unshift( true );
  1462. return match;
  1463. }
  1464. },
  1465. filters: {
  1466. enabled: function(elem){
  1467. return elem.disabled === false && elem.type !== "hidden";
  1468. },
  1469. disabled: function(elem){
  1470. return elem.disabled === true;
  1471. },
  1472. checked: function(elem){
  1473. return elem.checked === true;
  1474. },
  1475. selected: function(elem){
  1476. // Accessing this property makes selected-by-default
  1477. // options in Safari work properly
  1478. elem.parentNode.selectedIndex;
  1479. return elem.selected === true;
  1480. },
  1481. parent: function(elem){
  1482. return !!elem.firstChild;
  1483. },
  1484. empty: function(elem){
  1485. return !elem.firstChild;
  1486. },
  1487. has: function(elem, i, match){
  1488. return !!Sizzle( match[3], elem ).length;
  1489. },
  1490. header: function(elem){
  1491. return /h\d/i.test( elem.nodeName );
  1492. },
  1493. text: function(elem){
  1494. return "text" === elem.type;
  1495. },
  1496. radio: function(elem){
  1497. return "radio" === elem.type;
  1498. },
  1499. checkbox: function(elem){
  1500. return "checkbox" === elem.type;
  1501. },
  1502. file: function(elem){
  1503. return "file" === elem.type;
  1504. },
  1505. password: function(elem){
  1506. return "password" === elem.type;
  1507. },
  1508. submit: function(elem){
  1509. return "submit" === elem.type;
  1510. },
  1511. image: function(elem){
  1512. return "image" === elem.type;
  1513. },
  1514. reset: function(elem){
  1515. return "reset" === elem.type;
  1516. },
  1517. button: function(elem){
  1518. return "button" === elem.type || elem.nodeNam