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(selector, context) {
17 // If the context is a namespace object, return a new object
18 return this instanceof jQuery ?
19 this.init(selector, context) :
20 new jQuery(selector, context);
23 // Map over the $ in case of overwrite
24 if ( typeof $ != "undefined" )
27 // Map the jQuery namespace to the '$' one
30 var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
32 jQuery.fn = jQuery.prototype = {
33 init: function(selector, context) {
34 // Make sure that a selection was provided
35 selector = selector || document;
37 // Handle HTML strings
38 if ( typeof selector == "string" ) {
39 var m = quickExpr.exec(selector);
40 if ( m && (m[1] || !context) ) {
41 // HANDLE: $(html) -> $(array)
43 selector = jQuery.clean( [ m[1] ], context );
47 var tmp = document.getElementById( m[3] );
49 // Handle the case where IE and Opera return items
50 // by name instead of ID
52 return jQuery().find( selector );
64 return new jQuery( context ).find( selector );
66 // HANDLE: $(function)
67 // Shortcut for document ready
68 } else if ( jQuery.isFunction(selector) )
69 return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( selector );
73 selector.constructor == Array && selector ||
75 // HANDLE: $(arraylike)
76 // Watch for when an array-like object is passed as the selector
77 (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
91 get: function( num ) {
92 return num == undefined ?
94 // Return a 'clean' array
95 jQuery.makeArray( this ) :
97 // Return just the object
101 pushStack: function( a ) {
103 ret.prevObject = this;
107 setArray: function( a ) {
109 Array.prototype.push.apply( this, a );
113 each: function( fn, args ) {
114 return jQuery.each( this, fn, args );
117 index: function( obj ) {
119 this.each(function(i){
120 if ( this == obj ) pos = i;
125 attr: function( key, value, type ) {
128 // Look for the case where we're accessing a style value
129 if ( key.constructor == String )
130 if ( value == undefined )
131 return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
137 // Check to see if we're setting style values
138 return this.each(function(index){
139 // Set all the styles
140 for ( var prop in obj )
142 type ? this.style : this,
143 prop, jQuery.prop(this, obj[prop], type, index, prop)
148 css: function( key, value ) {
149 return this.attr( key, value, "curCSS" );
153 if ( typeof e != "object" && e != null )
154 return this.empty().append( document.createTextNode( e ) );
157 jQuery.each( e || this, function(){
158 jQuery.each( this.childNodes, function(){
159 if ( this.nodeType != 8 )
160 t += this.nodeType != 1 ?
161 this.nodeValue : jQuery.fn.text([ this ]);
167 wrapAll: function(html) {
169 // The elements to wrap the target around
170 jQuery(html, this[0].ownerDocument)
172 .insertBefore(this[0])
175 while ( elem.firstChild )
176 elem = elem.firstChild;
184 wrapInner: function(html) {
185 return this.each(function(){
186 jQuery(this).contents().wrapAll(html);
190 wrap: function(html) {
191 return this.each(function(){
192 jQuery(this).wrapAll(html);
197 return this.domManip(arguments, true, 1, function(a){
198 this.appendChild( a );
202 prepend: function() {
203 return this.domManip(arguments, true, -1, function(a){
204 this.insertBefore( a, this.firstChild );
209 return this.domManip(arguments, false, 1, function(a){
210 this.parentNode.insertBefore( a, this );
215 return this.domManip(arguments, false, -1, function(a){
216 this.parentNode.insertBefore( a, this.nextSibling );
221 return this.prevObject || jQuery([]);
225 var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
226 return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
227 jQuery.unique( data ) : data );
230 clone: function(events) {
232 var ret = this.map(function(){
233 return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true);
236 // Need to set the expando to null on the cloned set if it exists
237 // removeData doesn't work here, IE removes it from the original as well
238 // this is primarily for IE but the data expando shouldn't be copied over in any browser
239 var clone = ret.find("*").andSelf().each(function(){
240 if ( this[ expando ] != undefined )
241 this[ expando ] = null;
244 // Copy the events from the original to the clone
246 this.find("*").andSelf().each(function(i) {
247 var events = jQuery.data(this, "events");
248 for ( var type in events )
249 for ( var handler in events[type] )
250 jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
253 // Return the cloned set
257 filter: function(t) {
258 return this.pushStack(
259 jQuery.isFunction( t ) &&
260 jQuery.grep(this, function(el, index){
261 return t.apply(el, [index]);
264 jQuery.multiFilter(t,this) );
268 return this.pushStack(
269 t.constructor == String &&
270 jQuery.multiFilter(t, this, true) ||
272 jQuery.grep(this, function(a) {
273 return ( t.constructor == Array || t.jquery )
274 ? jQuery.inArray( a, t ) < 0
281 return this.pushStack( jQuery.merge(
283 t.constructor == String ?
285 t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
291 return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
294 hasClass: function(expr) {
295 return this.is("." + expr);
298 val: function( val ) {
299 if ( val == undefined ) {
303 // We need to handle select boxes special
304 if ( jQuery.nodeName(elem, "select") ) {
305 var index = elem.selectedIndex,
307 options = elem.options,
308 one = elem.type == "select-one";
310 // Nothing was selected
314 // Loop through all the selected options
315 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
316 var option = options[i];
317 if ( option.selected ) {
318 // Get the specifc value for the option
319 var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value;
321 // We don't need an array for one selects
325 // Multi-Selects return an array
332 // Everything else, we just grab the value
334 return this[0].value.replace(/\r/g, "");
337 return this.each(function(){
338 if ( val.constructor == Array && /radio|checkbox/.test(this.type) )
339 this.checked = (jQuery.inArray(this.value, val) >= 0 ||
340 jQuery.inArray(this.name, val) >= 0);
341 else if ( jQuery.nodeName(this, "select") ) {
342 var tmp = val.constructor == Array ? val : [val];
344 jQuery("option", this).each(function(){
345 this.selected = (jQuery.inArray(this.value, tmp) >= 0 ||
346 jQuery.inArray(this.text, tmp) >= 0);
350 this.selectedIndex = -1;
356 html: function( val ) {
357 return val == undefined ?
358 ( this.length ? this[0].innerHTML : null ) :
359 this.empty().append( val );
362 replaceWith: function( val ) {
363 return this.after( val ).remove();
367 return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
371 return this.pushStack(jQuery.map( this, function(elem,i){
372 return fn.call( elem, i, elem );
376 andSelf: function() {
377 return this.add( this.prevObject );
380 domManip: function(args, table, dir, fn) {
381 var clone = this.length > 1, a;
383 return this.each(function(){
385 a = jQuery.clean(args, this.ownerDocument);
392 if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
393 obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
395 jQuery.each( a, function(){
396 var elem = clone ? this.cloneNode(true) : this;
397 if ( !evalScript(0, elem) )
398 fn.call( obj, elem );
404 function evalScript(i, elem){
405 var script = jQuery.nodeName(elem, "script");
409 jQuery.ajax({ url: elem.src, async: false, dataType: "script" });
411 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
413 if ( elem.parentNode )
414 elem.parentNode.removeChild(elem);
416 } else if ( elem.nodeType == 1 )
417 jQuery("script", elem).each(evalScript);
422 jQuery.extend = jQuery.fn.extend = function() {
423 // copy reference to target object
424 var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
426 // Handle a deep copy situation
427 if ( target.constructor == Boolean ) {
429 target = arguments[1] || {};
432 // extend jQuery itself if only one argument is passed
440 for ( ; a < al; a++ )
441 // Only deal with non-null/undefined values
442 if ( (prop = arguments[a]) != null )
443 // Extend the base object
444 for ( var i in prop ) {
445 // Prevent never-ending loop
446 if ( target == prop[i] )
449 // Recurse if we're merging object values
450 if ( deep && typeof prop[i] == 'object' && target[i] )
451 jQuery.extend( target[i], prop[i] );
453 // Don't bring in undefined values
454 else if ( prop[i] != undefined )
458 // Return the modified object
462 var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {};
465 noConflict: function(deep) {
468 window.jQuery = _jQuery;
472 // This may seem like some crazy code, but trust me when I say that this
473 // is the only cross-browser way to do this. --John
474 isFunction: function( fn ) {
475 return !!fn && typeof fn != "string" && !fn.nodeName &&
476 fn.constructor != Array && /function/i.test( fn + "" );
479 // check if an element is in a XML document
480 isXMLDoc: function(elem) {
481 return elem.documentElement && !elem.body ||
482 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
485 // Evalulates a script in a global context
486 // Evaluates Async. in Safari 2 :-(
487 globalEval: function( data ) {
488 data = jQuery.trim( data );
490 if ( window.execScript )
491 window.execScript( data );
492 else if ( jQuery.browser.safari )
493 // safari doesn't provide a synchronous global eval
494 window.setTimeout( data, 0 );
496 eval.call( window, data );
500 nodeName: function( elem, name ) {
501 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
506 data: function( elem, name, data ) {
507 elem = elem == window ? win : elem;
509 var id = elem[ expando ];
511 // Compute a unique ID for the element
513 id = elem[ expando ] = ++uuid;
515 // Only generate the data cache if we're
516 // trying to access or manipulate it
517 if ( name && !jQuery.cache[ id ] )
518 jQuery.cache[ id ] = {};
520 // Prevent overriding the named cache with undefined values
521 if ( data != undefined )
522 jQuery.cache[ id ][ name ] = data;
524 // Return the named cache data, or the ID for the element
525 return name ? jQuery.cache[ id ][ name ] : id;
528 removeData: function( elem, name ) {
529 elem = elem == window ? win : elem;
531 var id = elem[ expando ];
533 // If we want to remove a specific section of the element's data
535 if ( jQuery.cache[ id ] ) {
536 // Remove the section of cache data
537 delete jQuery.cache[ id ][ name ];
539 // If we've removed all the data, remove the element's cache
541 for ( name in jQuery.cache[ id ] ) break;
543 jQuery.removeData( elem );
546 // Otherwise, we want to remove all of the element's data
548 // Clean up the element expando
550 delete elem[ expando ];
552 // IE has trouble directly removing the expando
553 // but it's ok with using removeAttribute
554 if ( elem.removeAttribute )
555 elem.removeAttribute( expando );
558 // Completely remove the data cache
559 delete jQuery.cache[ id ];
563 // args is for internal usage only
564 each: function( obj, fn, args ) {
566 if ( obj.length == undefined )
568 fn.apply( obj[i], args );
570 for ( var i = 0, ol = obj.length; i < ol; i++ )
571 if ( fn.apply( obj[i], args ) === false ) break;
573 // A special, fast, case for the most common use of each
575 if ( obj.length == undefined )
577 fn.call( obj[i], i, obj[i] );
579 for ( var i = 0, ol = obj.length, val = obj[0];
580 i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){}
586 prop: function(elem, value, type, index, prop){
587 // Handle executable functions
588 if ( jQuery.isFunction( value ) )
589 value = value.call( elem, [index] );
591 // exclude the following css properties to add px
592 var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
594 // Handle passing in a number to a CSS property
595 return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
601 // internal only, use addClass("class")
602 add: function( elem, c ){
603 jQuery.each( (c || "").split(/\s+/), function(i, cur){
604 if ( !jQuery.className.has( elem.className, cur ) )
605 elem.className += ( elem.className ? " " : "" ) + cur;
609 // internal only, use removeClass("class")
610 remove: function( elem, c ){
611 elem.className = c != undefined ?
612 jQuery.grep( elem.className.split(/\s+/), function(cur){
613 return !jQuery.className.has( c, cur );
617 // internal only, use is(".class")
618 has: function( t, c ) {
619 return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1;
623 swap: function(e,o,f) {
625 e.style["old"+i] = e.style[i];
630 e.style[i] = e.style["old"+i];
634 if ( p == "height" || p == "width" ) {
635 var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
637 jQuery.each( d, function(){
638 old["padding" + this] = 0;
639 old["border" + this + "Width"] = 0;
642 jQuery.swap( e, old, function() {
643 if ( jQuery(e).is(':visible') ) {
644 oHeight = e.offsetHeight;
645 oWidth = e.offsetWidth;
647 e = jQuery(e.cloneNode(true))
648 .find(":radio").removeAttr("checked").end()
650 visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
651 }).appendTo(e.parentNode)[0];
653 var parPos = jQuery.css(e.parentNode,"position") || "static";
654 if ( parPos == "static" )
655 e.parentNode.style.position = "relative";
657 oHeight = e.clientHeight;
658 oWidth = e.clientWidth;
660 if ( parPos == "static" )
661 e.parentNode.style.position = "static";
663 e.parentNode.removeChild(e);
667 return p == "height" ? oHeight : oWidth;
670 return jQuery.curCSS( e, p );
673 curCSS: function(elem, prop, force) {
674 var ret, stack = [], swap = [];
676 // A helper method for determining if an element's values are broken
678 if ( !jQuery.browser.safari )
681 var ret = document.defaultView.getComputedStyle(a,null);
682 return !ret || ret.getPropertyValue("color") == "";
685 if (prop == "opacity" && jQuery.browser.msie) {
686 ret = jQuery.attr(elem.style, "opacity");
687 return ret == "" ? "1" : ret;
690 if (prop.match(/float/i))
693 if (!force && elem.style[prop])
694 ret = elem.style[prop];
696 else if (document.defaultView && document.defaultView.getComputedStyle) {
698 if (prop.match(/float/i))
701 prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
702 var cur = document.defaultView.getComputedStyle(elem, null);
704 if ( cur && !color(elem) )
705 ret = cur.getPropertyValue(prop);
707 // If the element isn't reporting its values properly in Safari
708 // then some display: none elements are involved
710 // Locate all of the parent display: none elements
711 for ( var a = elem; a && color(a); a = a.parentNode )
714 // Go through and make them visible, but in reverse
715 // (It would be better if we knew the exact display type that they had)
716 for ( a = 0; a < stack.length; a++ )
717 if ( color(stack[a]) ) {
718 swap[a] = stack[a].style.display;
719 stack[a].style.display = "block";
722 // Since we flip the display style, we have to handle that
723 // one special, otherwise get the value
724 ret = prop == "display" && swap[stack.length-1] != null ?
726 document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
728 // Finally, revert the display styles back
729 for ( a = 0; a < swap.length; a++ )
730 if ( swap[a] != null )
731 stack[a].style.display = swap[a];
734 if ( prop == "opacity" && ret == "" )
737 } else if (elem.currentStyle) {
738 var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
739 ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
741 // From the awesome hack by Dean Edwards
742 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
744 // If we're not dealing with a regular pixel number
745 // but a number that has a weird ending, we need to convert it to pixels
746 if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) {
747 var style = elem.style.left;
748 var runtimeStyle = elem.runtimeStyle.left;
749 elem.runtimeStyle.left = elem.currentStyle.left;
750 elem.style.left = ret || 0;
751 ret = elem.style.pixelLeft + "px";
752 elem.style.left = style;
753 elem.runtimeStyle.left = runtimeStyle;
760 clean: function(a, doc) {
762 doc = doc || document;
764 jQuery.each( a, function(i,arg){
767 if ( arg.constructor == Number )
768 arg = arg.toString();
770 // Convert html string into DOM nodes
771 if ( typeof arg == "string" ) {
772 // Fix "XHTML"-style tags in all browsers
773 arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){
774 return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">";
777 // Trim whitespace, otherwise indexOf won't work as expected
778 var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = [];
781 // option or optgroup
782 !s.indexOf("<opt") &&
783 [1, "<select>", "</select>"] ||
785 !s.indexOf("<leg") &&
786 [1, "<fieldset>", "</fieldset>"] ||
788 s.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
789 [1, "<table>", "</table>"] ||
792 [2, "<table><tbody>", "</tbody></table>"] ||
794 // <thead> matched above
795 (!s.indexOf("<td") || !s.indexOf("<th")) &&
796 [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
798 !s.indexOf("<col") &&
799 [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
801 // IE can't serialize <link> and <script> tags normally
802 jQuery.browser.msie &&
803 [1, "div<div>", "</div>"] ||
807 // Go to html and back, then peel off extra wrappers
808 div.innerHTML = wrap[1] + arg + wrap[2];
810 // Move to the right depth
814 // Remove IE's autoinserted <tbody> from table fragments
815 if ( jQuery.browser.msie ) {
817 // String was a <table>, *may* have spurious <tbody>
818 if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )
819 tb = div.firstChild && div.firstChild.childNodes;
821 // String was a bare <thead> or <tfoot>
822 else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
825 for ( var n = tb.length-1; n >= 0 ; --n )
826 if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
827 tb[n].parentNode.removeChild(tb[n]);
829 // IE completely kills leading whitespace when innerHTML is used
830 if ( /^\s/.test(arg) )
831 div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
835 arg = jQuery.makeArray( div.childNodes );
838 if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) )
841 if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options )
844 r = jQuery.merge( r, arg );
851 attr: function(elem, name, value){
852 var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
854 // Safari mis-reports the default selected property of a hidden option
855 // Accessing the parent's selectedIndex property fixes it
856 if ( name == "selected" && jQuery.browser.safari )
857 elem.parentNode.selectedIndex;
859 // Certain attributes only work when accessed via the old DOM 0 way
861 if ( value != undefined ) elem[fix[name]] = value;
862 return elem[fix[name]];
863 } else if ( jQuery.browser.msie && name == "style" )
864 return jQuery.attr( elem.style, "cssText", value );
866 else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
867 return elem.getAttributeNode(name).nodeValue;
869 // IE elem.getAttribute passes even for style
870 else if ( elem.tagName ) {
872 if ( value != undefined ) {
873 if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode )
874 throw "type property can't be changed";
875 elem.setAttribute( name, value );
878 if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
879 return elem.getAttribute( name, 2 );
881 return elem.getAttribute( name );
883 // elem is actually elem.style ... set the style
885 // IE actually uses filters for opacity
886 if ( name == "opacity" && jQuery.browser.msie ) {
887 if ( value != undefined ) {
888 // IE has trouble with opacity if it does not have layout
889 // Force it by setting the zoom level
892 // Set the alpha filter to set the opacity
893 elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
894 (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
898 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
900 name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
901 if ( value != undefined ) elem[name] = value;
907 return (t||"").replace(/^\s+|\s+$/g, "");
910 makeArray: function( a ) {
913 // Need to use typeof to fight Safari childNodes crashes
914 if ( typeof a != "array" )
915 for ( var i = 0, al = a.length; i < al; i++ )
923 inArray: function( b, a ) {
924 for ( var i = 0, al = a.length; i < al; i++ )
930 merge: function(first, second) {
931 // We have to loop this way because IE & Opera overwrite the length
932 // expando of getElementsByTagName
934 // Also, we need to make sure that the correct elements are being returned
935 // (IE returns comment nodes in a '*' query)
936 if ( jQuery.browser.msie ) {
937 for ( var i = 0; second[i]; i++ )
938 if ( second[i].nodeType != 8 )
939 first.push(second[i]);
941 for ( var i = 0; second[i]; i++ )
942 first.push(second[i]);
947 unique: function(first) {
948 var r = [], done = {};
951 for ( var i = 0, fl = first.length; i < fl; i++ ) {
952 var id = jQuery.data(first[i]);
965 grep: function(elems, fn, inv) {
966 // If a string is passed in for the function, make a function
967 // for it (a handy shortcut)
968 if ( typeof fn == "string" )
969 fn = eval("false||function(a,i){return " + fn + "}");
973 // Go through the array, only saving the items
974 // that pass the validator function
975 for ( var i = 0, el = elems.length; i < el; i++ )
976 if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
977 result.push( elems[i] );
982 map: function(elems, fn) {
983 // If a string is passed in for the function, make a function
984 // for it (a handy shortcut)
985 if ( typeof fn == "string" )
986 fn = eval("false||function(a){return " + fn + "}");
990 // Go through the array, translating each of the items to their
991 // new value (or values).
992 for ( var i = 0, el = elems.length; i < el; i++ ) {
993 var val = fn(elems[i],i);
995 if ( val !== null && val != undefined ) {
996 if ( val.constructor != Array ) val = [val];
997 result = result.concat( val );
1005 var userAgent = navigator.userAgent.toLowerCase();
1007 // Figure out what browser is being used
1009 version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
1010 safari: /webkit/.test(userAgent),
1011 opera: /opera/.test(userAgent),
1012 msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
1013 mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
1016 var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
1019 // Check to see if the W3C box model is being used
1020 boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
1022 styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
1026 "class": "className",
1027 "float": styleFloat,
1028 cssFloat: styleFloat,
1029 styleFloat: styleFloat,
1030 innerHTML: "innerHTML",
1031 className: "className",
1033 disabled: "disabled",
1035 readonly: "readOnly",
1036 selected: "selected",
1037 maxlength: "maxLength"
1042 parent: "a.parentNode",
1043 parents: "jQuery.dir(a,'parentNode')",
1044 next: "jQuery.nth(a,2,'nextSibling')",
1045 prev: "jQuery.nth(a,2,'previousSibling')",
1046 nextAll: "jQuery.dir(a,'nextSibling')",
1047 prevAll: "jQuery.dir(a,'previousSibling')",
1048 siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
1049 children: "jQuery.sibling(a.firstChild)",
1050 contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
1052 jQuery.fn[ i ] = function(a) {
1053 var ret = jQuery.map(this,n);
1054 if ( a && typeof a == "string" )
1055 ret = jQuery.multiFilter(a,ret);
1056 return this.pushStack( jQuery.unique(ret) );
1062 prependTo: "prepend",
1063 insertBefore: "before",
1064 insertAfter: "after",
1065 replaceAll: "replaceWith"
1067 jQuery.fn[ i ] = function(){
1069 return this.each(function(){
1070 for ( var j = 0, al = a.length; j < al; j++ )
1071 jQuery(a[j])[n]( this );
1077 removeAttr: function( key ) {
1078 jQuery.attr( this, key, "" );
1079 this.removeAttribute( key );
1081 addClass: function(c){
1082 jQuery.className.add(this,c);
1084 removeClass: function(c){
1085 jQuery.className.remove(this,c);
1087 toggleClass: function( c ){
1088 jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
1090 remove: function(a){
1091 if ( !a || jQuery.filter( a, [this] ).r.length ) {
1092 jQuery.removeData( this );
1093 this.parentNode.removeChild( this );
1097 // Clean up the cache
1098 jQuery("*", this).each(function(){ jQuery.removeData(this); });
1100 while ( this.firstChild )
1101 this.removeChild( this.firstChild );
1104 jQuery.fn[ i ] = function() {
1105 return this.each( n, arguments );
1109 jQuery.each( [ "Height", "Width" ], function(i,name){
1110 var n = name.toLowerCase();
1112 jQuery.fn[ n ] = function(h) {
1113 return this[0] == window ?
1114 jQuery.browser.safari && self["inner" + name] ||
1115 jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) ||
1116 document.body["client" + name] :
1118 this[0] == document ?
1119 Math.max( document.body["scroll" + name], document.body["offset" + name] ) :
1122 ( this.length ? jQuery.css( this[0], n ) : null ) :
1123 this.css( n, h.constructor == String ? h : h + "px" );