2 * jQuery @VERSION - New Wave Javascript
4 * Copyright (c) 2007 John Resig (jquery.com)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
12 // Map over jQuery in case of overwrite
13 if ( typeof jQuery != "undefined" )
16 var jQuery = window.jQuery = function(a,c) {
17 // If the context is global, return a new object
18 if ( window == this || !this.init )
19 return new jQuery(a,c);
21 return this.init(a,c);
24 // Map over the $ in case of overwrite
25 if ( typeof $ != "undefined" )
28 // Map the jQuery namespace to the '$' one
31 var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
33 jQuery.fn = jQuery.prototype = {
35 // Make sure that a selection was provided
38 // Handle HTML strings
39 if ( typeof a == "string" ) {
40 var m = quickExpr.exec(a);
41 if ( m && (m[1] || !c) ) {
42 // HANDLE: $(html) -> $(array)
44 a = jQuery.clean( [ m[1] ], c );
48 var tmp = document.getElementById( m[3] );
50 // Handle the case where IE and Opera return items
51 // by name instead of ID
53 return jQuery().find( a );
65 return new jQuery( c ).find( a );
67 // HANDLE: $(function)
68 // Shortcut for document ready
69 } else if ( jQuery.isFunction(a) )
70 return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
74 a.constructor == Array && a ||
76 // HANDLE: $(arraylike)
77 // Watch for when an array-like object is passed as the selector
78 (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||
92 get: function( num ) {
93 return num == undefined ?
95 // Return a 'clean' array
96 jQuery.makeArray( this ) :
98 // Return just the object
102 pushStack: function( a ) {
104 ret.prevObject = this;
108 setArray: function( a ) {
110 Array.prototype.push.apply( this, a );
114 each: function( fn, args ) {
115 return jQuery.each( this, fn, args );
118 index: function( obj ) {
120 this.each(function(i){
121 if ( this == obj ) pos = i;
126 attr: function( key, value, type ) {
129 // Look for the case where we're accessing a style value
130 if ( key.constructor == String )
131 if ( value == undefined )
132 return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
138 // Check to see if we're setting style values
139 return this.each(function(index){
140 // Set all the styles
141 for ( var prop in obj )
143 type ? this.style : this,
144 prop, jQuery.prop(this, obj[prop], type, index, prop)
149 css: function( key, value ) {
150 return this.attr( key, value, "curCSS" );
154 if ( typeof e != "object" && e != null )
155 return this.empty().append( document.createTextNode( e ) );
158 jQuery.each( e || this, function(){
159 jQuery.each( this.childNodes, function(){
160 if ( this.nodeType != 8 )
161 t += this.nodeType != 1 ?
162 this.nodeValue : jQuery.fn.text([ this ]);
168 wrapAll: function(html) {
170 // The elements to wrap the target around
171 jQuery(html, this[0].ownerDocument)
173 .insertBefore(this[0])
176 while ( elem.firstChild )
177 elem = elem.firstChild;
185 wrapInner: function(html) {
186 return this.each(function(){
187 jQuery(this).contents().wrapAll(html);
191 wrap: function(html) {
192 return this.each(function(){
193 jQuery(this).wrapAll(html);
198 return this.domManip(arguments, true, 1, function(a){
199 this.appendChild( a );
203 prepend: function() {
204 return this.domManip(arguments, true, -1, function(a){
205 this.insertBefore( a, this.firstChild );
210 return this.domManip(arguments, false, 1, function(a){
211 this.parentNode.insertBefore( a, this );
216 return this.domManip(arguments, false, -1, function(a){
217 this.parentNode.insertBefore( a, this.nextSibling );
222 return this.prevObject || jQuery([]);
226 var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
227 return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
228 jQuery.unique( data ) : data );
232 var $this = this.add(this.find("*"));
233 if (jQuery.browser.msie) {
234 // Need to remove events on the element and its descendants
235 $this.each(function() {
237 for (var type in this.$events)
238 this._$events[type] = jQuery.extend({},this.$events[type]);
243 var r = this.pushStack( jQuery.map( this, function(a){
244 return a.cloneNode( true );
247 if (jQuery.browser.msie) {
248 $this.each(function() {
249 // Add the events back to the original and its descendants
250 var events = this._$events;
251 for (var type in events)
252 for (var handler in events[type])
253 jQuery.event.add(this, type, events[type][handler], events[type][handler].data);
254 this._$events = null;
258 // copy form values over
259 var inputs = r.add(r.find('*')).filter('select,input[@type=checkbox]');
260 $this.filter('select,input[@type=checkbox]').each(function(i) {
261 if (this.selectedIndex)
262 inputs[i].selectedIndex = this.selectedIndex;
264 inputs[i].checked = true;
267 // Return the cloned set
271 filter: function(t) {
272 return this.pushStack(
273 jQuery.isFunction( t ) &&
274 jQuery.grep(this, function(el, index){
275 return t.apply(el, [index]);
278 jQuery.multiFilter(t,this) );
282 return this.pushStack(
283 t.constructor == String &&
284 jQuery.multiFilter(t, this, true) ||
286 jQuery.grep(this, function(a) {
287 return ( t.constructor == Array || t.jquery )
288 ? jQuery.inArray( a, t ) < 0
295 return this.pushStack( jQuery.merge(
297 t.constructor == String ?
299 t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
305 return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
308 hasClass: function(expr) {
309 return this.is("." + expr);
312 val: function( val ) {
313 if ( val == undefined ) {
317 // We need to handle select boxes special
\r if ( jQuery.nodeName(elem, "select") ) {
\r var index = elem.selectedIndex,
319 options = elem.options,
320 one = elem.type == "select-one";
322 // Nothing was selected
\r if ( index < 0 )
325 // Loop through all the selected options
\r for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
326 var option = options[i];
\r if ( option.selected ) {
\r // Get the specifc value for the option
\r var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value;
328 // We don't need an array for one selects
\r if ( one )
331 // Multi-Selects return an array
\r a.push(val);
\r }
\r }
334 // Everything else, we just grab the value
\r } else
335 return this[0].value.replace(/\r/g, "");
338 return this.attr( "value", val );
341 html: function( val ) {
342 return val == undefined ?
343 ( this.length ? this[0].innerHTML : null ) :
344 this.empty().append( val );
347 replaceWith: function( val ) {
348 return this.after( val ).remove();
352 return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
356 return this.pushStack(jQuery.map( this, function(elem,i){
357 return fn.call( elem, i, elem );
361 andSelf: function() {
362 return this.add( this.prevObject );
365 domManip: function(args, table, dir, fn) {
366 var clone = this.length > 1, a;
368 return this.each(function(){
370 a = jQuery.clean(args, this.ownerDocument);
377 if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
378 obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
380 jQuery.each( a, function(){
381 if ( jQuery.nodeName(this, "script") ) {
383 jQuery.ajax({ url: this.src, async: false, dataType: "script" });
385 jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
387 fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
393 jQuery.extend = jQuery.fn.extend = function() {
394 // copy reference to target object
395 var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
397 // Handle a deep copy situation
398 if ( target.constructor == Boolean ) {
400 target = arguments[1] || {};
403 // extend jQuery itself if only one argument is passed
411 for ( ; a < al; a++ )
412 // Only deal with non-null/undefined values
413 if ( (prop = arguments[a]) != null )
414 // Extend the base object
415 for ( var i in prop ) {
416 // Prevent never-ending loop
417 if ( target == prop[i] )
420 // Recurse if we're merging object values
421 if ( deep && typeof prop[i] == 'object' && target[i] )
422 jQuery.extend( target[i], prop[i] );
424 // Don't bring in undefined values
425 else if ( prop[i] != undefined )
429 // Return the modified object
434 noConflict: function(deep) {
437 window.jQuery = _jQuery;
441 // This may seem like some crazy code, but trust me when I say that this
442 // is the only cross-browser way to do this. --John
443 isFunction: function( fn ) {
444 return !!fn && typeof fn != "string" && !fn.nodeName &&
445 fn.constructor != Array && /function/i.test( fn + "" );
448 // check if an element is in a XML document
449 isXMLDoc: function(elem) {
450 return elem.documentElement && !elem.body ||
451 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
454 // Evalulates a script in a global context
455 // Evaluates Async. in Safari 2 :-(
456 globalEval: function( data ) {
457 data = jQuery.trim( data );
459 if ( window.execScript )
460 window.execScript( data );
461 else if ( jQuery.browser.safari )
462 // safari doesn't provide a synchronous global eval
463 window.setTimeout( data, 0 );
465 eval.call( window, data );
469 nodeName: function( elem, name ) {
470 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
473 // args is for internal usage only
474 each: function( obj, fn, args ) {
476 if ( obj.length == undefined )
478 fn.apply( obj[i], args );
480 for ( var i = 0, ol = obj.length; i < ol; i++ )
481 if ( fn.apply( obj[i], args ) === false ) break;
483 // A special, fast, case for the most common use of each
485 if ( obj.length == undefined )
487 fn.call( obj[i], i, obj[i] );
489 for ( var i = 0, ol = obj.length, val = obj[0];
490 i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){}
496 prop: function(elem, value, type, index, prop){
497 // Handle executable functions
498 if ( jQuery.isFunction( value ) )
499 value = value.call( elem, [index] );
501 // exclude the following css properties to add px
502 var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
504 // Handle passing in a number to a CSS property
505 return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
511 // internal only, use addClass("class")
512 add: function( elem, c ){
513 jQuery.each( (c || "").split(/\s+/), function(i, cur){
514 if ( !jQuery.className.has( elem.className, cur ) )
515 elem.className += ( elem.className ? " " : "" ) + cur;
519 // internal only, use removeClass("class")
520 remove: function( elem, c ){
521 elem.className = c != undefined ?
522 jQuery.grep( elem.className.split(/\s+/), function(cur){
523 return !jQuery.className.has( c, cur );
527 // internal only, use is(".class")
528 has: function( t, c ) {
529 return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1;
533 swap: function(e,o,f) {
535 e.style["old"+i] = e.style[i];
540 e.style[i] = e.style["old"+i];
544 if ( p == "height" || p == "width" ) {
545 var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
547 jQuery.each( d, function(){
548 old["padding" + this] = 0;
549 old["border" + this + "Width"] = 0;
552 jQuery.swap( e, old, function() {
553 if ( jQuery(e).is(':visible') ) {
554 oHeight = e.offsetHeight;
555 oWidth = e.offsetWidth;
557 e = jQuery(e.cloneNode(true))
558 .find(":radio").removeAttr("checked").end()
560 visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
561 }).appendTo(e.parentNode)[0];
563 var parPos = jQuery.css(e.parentNode,"position") || "static";
564 if ( parPos == "static" )
565 e.parentNode.style.position = "relative";
567 oHeight = e.clientHeight;
568 oWidth = e.clientWidth;
570 if ( parPos == "static" )
571 e.parentNode.style.position = "static";
573 e.parentNode.removeChild(e);
577 return p == "height" ? oHeight : oWidth;
580 return jQuery.curCSS( e, p );
583 curCSS: function(elem, prop, force) {
584 var ret, stack = [], swap = [];
586 // A helper method for determining if an element's values are broken
588 if ( !jQuery.browser.safari )
591 var ret = document.defaultView.getComputedStyle(a,null);
592 return !ret || ret.getPropertyValue("color") == "";
595 if (prop == "opacity" && jQuery.browser.msie) {
596 ret = jQuery.attr(elem.style, "opacity");
597 return ret == "" ? "1" : ret;
600 if (prop.match(/float/i))
603 if (!force && elem.style[prop])
604 ret = elem.style[prop];
606 else if (document.defaultView && document.defaultView.getComputedStyle) {
608 if (prop.match(/float/i))
611 prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
612 var cur = document.defaultView.getComputedStyle(elem, null);
614 if ( cur && !color(elem) )
615 ret = cur.getPropertyValue(prop);
617 // If the element isn't reporting its values properly in Safari
618 // then some display: none elements are involved
620 // Locate all of the parent display: none elements
621 for ( var a = elem; a && color(a); a = a.parentNode )
624 // Go through and make them visible, but in reverse
625 // (It would be better if we knew the exact display type that they had)
626 for ( a = 0; a < stack.length; a++ )
627 if ( color(stack[a]) ) {
628 swap[a] = stack[a].style.display;
629 stack[a].style.display = "block";
632 // Since we flip the display style, we have to handle that
633 // one special, otherwise get the value
634 ret = prop == "display" && swap[stack.length-1] != null ?
636 document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
638 // Finally, revert the display styles back
639 for ( a = 0; a < swap.length; a++ )
640 if ( swap[a] != null )
641 stack[a].style.display = swap[a];
644 if ( prop == "opacity" && ret == "" )
647 } else if (elem.currentStyle) {
648 var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
649 ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
651 // From the awesome hack by Dean Edwards
652 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
654 // If we're not dealing with a regular pixel number
655 // but a number that has a weird ending, we need to convert it to pixels
656 if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) {
657 var style = elem.style.left;
658 var runtimeStyle = elem.runtimeStyle.left;
659 elem.runtimeStyle.left = elem.currentStyle.left;
660 elem.style.left = ret || 0;
661 ret = elem.style.pixelLeft + "px";
662 elem.style.left = style;
663 elem.runtimeStyle.left = runtimeStyle;
670 clean: function(a, doc) {
672 doc = doc || document;
674 jQuery.each( a, function(i,arg){
677 if ( arg.constructor == Number )
678 arg = arg.toString();
680 // Convert html string into DOM nodes
681 if ( typeof arg == "string" ) {
682 // Fix "XHTML"-style tags in all browsers
683 arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){
684 return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">";
687 // Trim whitespace, otherwise indexOf won't work as expected
688 var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = [];
691 // option or optgroup
692 !s.indexOf("<opt") &&
693 [1, "<select>", "</select>"] ||
695 !s.indexOf("<leg") &&
696 [1, "<fieldset>", "</fieldset>"] ||
698 s.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
699 [1, "<table>", "</table>"] ||
702 [2, "<table><tbody>", "</tbody></table>"] ||
704 // <thead> matched above
705 (!s.indexOf("<td") || !s.indexOf("<th")) &&
706 [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
708 !s.indexOf("<col") &&
709 [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
711 // IE can't serialize <link> and <script> tags normally
712 jQuery.browser.msie &&
713 [1, "div<div>", "</div>"] ||
717 // Go to html and back, then peel off extra wrappers
718 div.innerHTML = wrap[1] + arg + wrap[2];
720 // Move to the right depth
724 // Remove IE's autoinserted <tbody> from table fragments
725 if ( jQuery.browser.msie ) {
727 // String was a <table>, *may* have spurious <tbody>
728 if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )
729 tb = div.firstChild && div.firstChild.childNodes;
731 // String was a bare <thead> or <tfoot>
732 else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
735 for ( var n = tb.length-1; n >= 0 ; --n )
736 if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
737 tb[n].parentNode.removeChild(tb[n]);
739 // IE completely kills leading whitespace when innerHTML is used
740 if ( /^\s/.test(arg) )
741 div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
745 arg = jQuery.makeArray( div.childNodes );
748 if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) )
751 if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options )
754 r = jQuery.merge( r, arg );
761 attr: function(elem, name, value){
762 var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
764 // Safari mis-reports the default selected property of a hidden option
765 // Accessing the parent's selectedIndex property fixes it
766 if ( name == "selected" && jQuery.browser.safari )
767 elem.parentNode.selectedIndex;
769 // Certain attributes only work when accessed via the old DOM 0 way
771 if ( value != undefined ) elem[fix[name]] = value;
772 return elem[fix[name]];
773 } else if ( jQuery.browser.msie && name == "style" )
774 return jQuery.attr( elem.style, "cssText", value );
776 else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
777 return elem.getAttributeNode(name).nodeValue;
779 // IE elem.getAttribute passes even for style
780 else if ( elem.tagName ) {
782 if ( value != undefined ) {
783 if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode )
784 throw "type property can't be changed";
785 elem.setAttribute( name, value );
788 if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
789 return elem.getAttribute( name, 2 );
791 return elem.getAttribute( name );
793 // elem is actually elem.style ... set the style
795 // IE actually uses filters for opacity
796 if ( name == "opacity" && jQuery.browser.msie ) {
797 if ( value != undefined ) {
798 // IE has trouble with opacity if it does not have layout
799 // Force it by setting the zoom level
802 // Set the alpha filter to set the opacity
803 elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
804 (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
808 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
810 name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
811 if ( value != undefined ) elem[name] = value;
817 return (t||"").replace(/^\s+|\s+$/g, "");
820 makeArray: function( a ) {
823 // Need to use typeof to fight Safari childNodes crashes
824 if ( typeof a != "array" )
825 for ( var i = 0, al = a.length; i < al; i++ )
833 inArray: function( b, a ) {
834 for ( var i = 0, al = a.length; i < al; i++ )
840 merge: function(first, second) {
841 // We have to loop this way because IE & Opera overwrite the length
842 // expando of getElementsByTagName
844 // Also, we need to make sure that the correct elements are being returned
845 // (IE returns comment nodes in a '*' query)
846 if ( jQuery.browser.msie ) {
847 for ( var i = 0; second[i]; i++ )
848 if ( second[i].nodeType != 8 )
849 first.push(second[i]);
851 for ( var i = 0; second[i]; i++ )
852 first.push(second[i]);
857 unique: function(first) {
858 var r = [], num = jQuery.mergeNum++;
861 for ( var i = 0, fl = first.length; i < fl; i++ )
862 if ( num != first[i].mergeNum ) {
863 first[i].mergeNum = num;
875 grep: function(elems, fn, inv) {
876 // If a string is passed in for the function, make a function
877 // for it (a handy shortcut)
878 if ( typeof fn == "string" )
879 fn = eval("false||function(a,i){return " + fn + "}");
883 // Go through the array, only saving the items
884 // that pass the validator function
885 for ( var i = 0, el = elems.length; i < el; i++ )
886 if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
887 result.push( elems[i] );
892 map: function(elems, fn) {
893 // If a string is passed in for the function, make a function
894 // for it (a handy shortcut)
895 if ( typeof fn == "string" )
896 fn = eval("false||function(a){return " + fn + "}");
900 // Go through the array, translating each of the items to their
901 // new value (or values).
902 for ( var i = 0, el = elems.length; i < el; i++ ) {
903 var val = fn(elems[i],i);
905 if ( val !== null && val != undefined ) {
906 if ( val.constructor != Array ) val = [val];
907 result = result.concat( val );
915 var userAgent = navigator.userAgent.toLowerCase();
917 // Figure out what browser is being used
919 version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
920 safari: /webkit/.test(userAgent),
921 opera: /opera/.test(userAgent),
922 msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
923 mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
926 var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
929 // Check to see if the W3C box model is being used
930 boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
932 styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
936 "class": "className",
938 cssFloat: styleFloat,
939 styleFloat: styleFloat,
940 innerHTML: "innerHTML",
941 className: "className",
943 disabled: "disabled",
945 readonly: "readOnly",
946 selected: "selected",
947 maxlength: "maxLength"
952 parent: "a.parentNode",
953 parents: "jQuery.parents(a)",
954 next: "jQuery.nth(a,2,'nextSibling')",
955 prev: "jQuery.nth(a,2,'previousSibling')",
956 siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
957 children: "jQuery.sibling(a.firstChild)",
958 contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
960 jQuery.fn[ i ] = function(a) {
961 var ret = jQuery.map(this,n);
962 if ( a && typeof a == "string" )
963 ret = jQuery.multiFilter(a,ret);
964 return this.pushStack( jQuery.unique(ret) );
970 prependTo: "prepend",
971 insertBefore: "before",
972 insertAfter: "after",
973 replaceAll: "replaceWith"
975 jQuery.fn[ i ] = function(){
977 return this.each(function(){
978 for ( var j = 0, al = a.length; j < al; j++ )
979 jQuery(a[j])[n]( this );
985 removeAttr: function( key ) {
986 jQuery.attr( this, key, "" );
987 this.removeAttribute( key );
989 addClass: function(c){
990 jQuery.className.add(this,c);
992 removeClass: function(c){
993 jQuery.className.remove(this,c);
995 toggleClass: function( c ){
996 jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
999 if ( !a || jQuery.filter( a, [this] ).r.length )
1000 this.parentNode.removeChild( this );
1003 while ( this.firstChild )
1004 this.removeChild( this.firstChild );
1007 jQuery.fn[ i ] = function() {
1008 return this.each( n, arguments );
1012 jQuery.each( [ "height", "width" ], function(i,n){
1013 jQuery.fn[ n ] = function(h) {
1014 return h == undefined ?
1015 ( this.length ? jQuery.css( this[0], n ) : null ) :
1016 this.css( n, h.constructor == String ? h : h + "px" );