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 );
231 clone: function(events) {
233 var ret = this.map(function(){
234 return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true);
237 // Need to set the expando to null on the cloned set if it exists
238 // removeData doesn't work here, IE removes it from the original as well
239 // this is primarily for IE but the data expando shouldn't be copied over in any browser
240 var clone = ret.find("*").andSelf().each(function(){
241 if ( this[ expando ] != undefined )
242 this[ expando ] = null;
245 // Copy the events from the original to the clone
247 this.find("*").andSelf().each(function(i) {
248 var events = jQuery.data(this, "events");
249 for ( var type in events )
250 for ( var handler in events[type] )
251 jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
254 // Return the cloned set
258 filter: function(t) {
259 return this.pushStack(
260 jQuery.isFunction( t ) &&
261 jQuery.grep(this, function(el, index){
262 return t.apply(el, [index]);
265 jQuery.multiFilter(t,this) );
269 return this.pushStack(
270 t.constructor == String &&
271 jQuery.multiFilter(t, this, true) ||
273 jQuery.grep(this, function(a) {
274 return ( t.constructor == Array || t.jquery )
275 ? jQuery.inArray( a, t ) < 0
282 return this.pushStack( jQuery.merge(
284 t.constructor == String ?
286 t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
292 return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
295 hasClass: function(expr) {
296 return this.is("." + expr);
299 val: function( val ) {
300 if ( val == undefined ) {
304 // We need to handle select boxes special
305 if ( jQuery.nodeName(elem, "select") ) {
306 var index = elem.selectedIndex,
308 options = elem.options,
309 one = elem.type == "select-one";
311 // Nothing was selected
315 // Loop through all the selected options
316 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
317 var option = options[i];
318 if ( option.selected ) {
319 // Get the specifc value for the option
320 var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value;
322 // We don't need an array for one selects
326 // Multi-Selects return an array
333 // Everything else, we just grab the value
335 return this[0].value.replace(/\r/g, "");
338 return this.each(function(){
339 if ( val.constructor == Array && /radio|checkbox/.test(this.type) )
340 this.checked = (jQuery.inArray(this.value, val) >= 0 ||
341 jQuery.inArray(this.name, val) >= 0);
342 else if ( jQuery.nodeName(this, "select") ) {
343 var tmp = val.constructor == Array ? val : [val];
345 jQuery("option", this).each(function(){
346 this.selected = (jQuery.inArray(this.value, tmp) >= 0 ||
347 jQuery.inArray(this.text, tmp) >= 0);
351 this.selectedIndex = -1;
357 html: function( val ) {
358 return val == undefined ?
359 ( this.length ? this[0].innerHTML : null ) :
360 this.empty().append( val );
363 replaceWith: function( val ) {
364 return this.after( val ).remove();
368 return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
372 return this.pushStack(jQuery.map( this, function(elem,i){
373 return fn.call( elem, i, elem );
377 andSelf: function() {
378 return this.add( this.prevObject );
381 domManip: function(args, table, dir, fn) {
382 var clone = this.length > 1, a;
384 return this.each(function(){
386 a = jQuery.clean(args, this.ownerDocument);
393 if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
394 obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
396 jQuery.each( a, function(){
397 var elem = clone ? this.cloneNode(true) : this;
398 if ( !evalScript(0, elem) )
399 fn.call( obj, elem );
405 function evalScript(i, elem){
406 var script = jQuery.nodeName(elem, "script");
410 jQuery.ajax({ url: elem.src, async: false, dataType: "script" });
412 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
414 if ( elem.parentNode )
415 elem.parentNode.removeChild(elem);
417 } else if ( elem.nodeType == 1 )
418 jQuery("script", elem).each(evalScript);
423 jQuery.extend = jQuery.fn.extend = function() {
424 // copy reference to target object
425 var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
427 // Handle a deep copy situation
428 if ( target.constructor == Boolean ) {
430 target = arguments[1] || {};
433 // extend jQuery itself if only one argument is passed
441 for ( ; a < al; a++ )
442 // Only deal with non-null/undefined values
443 if ( (prop = arguments[a]) != null )
444 // Extend the base object
445 for ( var i in prop ) {
446 // Prevent never-ending loop
447 if ( target == prop[i] )
450 // Recurse if we're merging object values
451 if ( deep && typeof prop[i] == 'object' && target[i] )
452 jQuery.extend( target[i], prop[i] );
454 // Don't bring in undefined values
455 else if ( prop[i] != undefined )
459 // Return the modified object
463 var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {};
466 noConflict: function(deep) {
469 window.jQuery = _jQuery;
473 // This may seem like some crazy code, but trust me when I say that this
474 // is the only cross-browser way to do this. --John
475 isFunction: function( fn ) {
476 return !!fn && typeof fn != "string" && !fn.nodeName &&
477 fn.constructor != Array && /function/i.test( fn + "" );
480 // check if an element is in a XML document
481 isXMLDoc: function(elem) {
482 return elem.documentElement && !elem.body ||
483 elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
486 // Evalulates a script in a global context
487 // Evaluates Async. in Safari 2 :-(
488 globalEval: function( data ) {
489 data = jQuery.trim( data );
491 if ( window.execScript )
492 window.execScript( data );
493 else if ( jQuery.browser.safari )
494 // safari doesn't provide a synchronous global eval
495 window.setTimeout( data, 0 );
497 eval.call( window, data );
501 nodeName: function( elem, name ) {
502 return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
507 data: function( elem, name, data ) {
508 elem = elem == window ? win : elem;
510 var id = elem[ expando ];
512 // Compute a unique ID for the element
514 id = elem[ expando ] = ++uuid;
516 // Only generate the data cache if we're
517 // trying to access or manipulate it
518 if ( name && !jQuery.cache[ id ] )
519 jQuery.cache[ id ] = {};
521 // Prevent overriding the named cache with undefined values
522 if ( data != undefined )
523 jQuery.cache[ id ][ name ] = data;
525 // Return the named cache data, or the ID for the element
526 return name ? jQuery.cache[ id ][ name ] : id;
529 removeData: function( elem, name ) {
530 elem = elem == window ? win : elem;
532 var id = elem[ expando ];
534 // If we want to remove a specific section of the element's data
536 if ( jQuery.cache[ id ] ) {
537 // Remove the section of cache data
538 delete jQuery.cache[ id ][ name ];
540 // If we've removed all the data, remove the element's cache
542 for ( name in jQuery.cache[ id ] ) break;
544 jQuery.removeData( elem );
547 // Otherwise, we want to remove all of the element's data
549 // Clean up the element expando
551 delete elem[ expando ];
553 // IE has trouble directly removing the expando
554 // but it's ok with using removeAttribute
555 if ( elem.removeAttribute )
556 elem.removeAttribute( expando );
559 // Completely remove the data cache
560 delete jQuery.cache[ id ];
564 // args is for internal usage only
565 each: function( obj, fn, args ) {
567 if ( obj.length == undefined )
569 fn.apply( obj[i], args );
571 for ( var i = 0, ol = obj.length; i < ol; i++ )
572 if ( fn.apply( obj[i], args ) === false ) break;
574 // A special, fast, case for the most common use of each
576 if ( obj.length == undefined )
578 fn.call( obj[i], i, obj[i] );
580 for ( var i = 0, ol = obj.length, val = obj[0];
581 i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){}
587 prop: function(elem, value, type, index, prop){
588 // Handle executable functions
589 if ( jQuery.isFunction( value ) )
590 value = value.call( elem, [index] );
592 // exclude the following css properties to add px
593 var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
595 // Handle passing in a number to a CSS property
596 return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
602 // internal only, use addClass("class")
603 add: function( elem, c ){
604 jQuery.each( (c || "").split(/\s+/), function(i, cur){
605 if ( !jQuery.className.has( elem.className, cur ) )
606 elem.className += ( elem.className ? " " : "" ) + cur;
610 // internal only, use removeClass("class")
611 remove: function( elem, c ){
612 elem.className = c != undefined ?
613 jQuery.grep( elem.className.split(/\s+/), function(cur){
614 return !jQuery.className.has( c, cur );
618 // internal only, use is(".class")
619 has: function( t, c ) {
620 return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1;
624 swap: function(e,o,f) {
626 e.style["old"+i] = e.style[i];
631 e.style[i] = e.style["old"+i];
635 if ( p == "height" || p == "width" ) {
636 var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
638 jQuery.each( d, function(){
639 old["padding" + this] = 0;
640 old["border" + this + "Width"] = 0;
643 jQuery.swap( e, old, function() {
644 if ( jQuery(e).is(':visible') ) {
645 oHeight = e.offsetHeight;
646 oWidth = e.offsetWidth;
648 e = jQuery(e.cloneNode(true))
649 .find(":radio").removeAttr("checked").end()
651 visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
652 }).appendTo(e.parentNode)[0];
654 var parPos = jQuery.css(e.parentNode,"position") || "static";
655 if ( parPos == "static" )
656 e.parentNode.style.position = "relative";
658 oHeight = e.clientHeight;
659 oWidth = e.clientWidth;
661 if ( parPos == "static" )
662 e.parentNode.style.position = "static";
664 e.parentNode.removeChild(e);
668 return p == "height" ? oHeight : oWidth;
671 return jQuery.curCSS( e, p );
674 curCSS: function(elem, prop, force) {
675 var ret, stack = [], swap = [];
677 // A helper method for determining if an element's values are broken
679 if ( !jQuery.browser.safari )
682 var ret = document.defaultView.getComputedStyle(a,null);
683 return !ret || ret.getPropertyValue("color") == "";
686 if (prop == "opacity" && jQuery.browser.msie) {
687 ret = jQuery.attr(elem.style, "opacity");
688 return ret == "" ? "1" : ret;
691 if (prop.match(/float/i))
694 if (!force && elem.style[prop])
695 ret = elem.style[prop];
697 else if (document.defaultView && document.defaultView.getComputedStyle) {
699 if (prop.match(/float/i))
702 prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
703 var cur = document.defaultView.getComputedStyle(elem, null);
705 if ( cur && !color(elem) )
706 ret = cur.getPropertyValue(prop);
708 // If the element isn't reporting its values properly in Safari
709 // then some display: none elements are involved
711 // Locate all of the parent display: none elements
712 for ( var a = elem; a && color(a); a = a.parentNode )
715 // Go through and make them visible, but in reverse
716 // (It would be better if we knew the exact display type that they had)
717 for ( a = 0; a < stack.length; a++ )
718 if ( color(stack[a]) ) {
719 swap[a] = stack[a].style.display;
720 stack[a].style.display = "block";
723 // Since we flip the display style, we have to handle that
724 // one special, otherwise get the value
725 ret = prop == "display" && swap[stack.length-1] != null ?
727 document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
729 // Finally, revert the display styles back
730 for ( a = 0; a < swap.length; a++ )
731 if ( swap[a] != null )
732 stack[a].style.display = swap[a];
735 if ( prop == "opacity" && ret == "" )
738 } else if (elem.currentStyle) {
739 var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
740 ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
742 // From the awesome hack by Dean Edwards
743 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
745 // If we're not dealing with a regular pixel number
746 // but a number that has a weird ending, we need to convert it to pixels
747 if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) {
748 var style = elem.style.left;
749 var runtimeStyle = elem.runtimeStyle.left;
750 elem.runtimeStyle.left = elem.currentStyle.left;
751 elem.style.left = ret || 0;
752 ret = elem.style.pixelLeft + "px";
753 elem.style.left = style;
754 elem.runtimeStyle.left = runtimeStyle;
761 clean: function(a, doc) {
763 doc = doc || document;
765 jQuery.each( a, function(i,arg){
768 if ( arg.constructor == Number )
769 arg = arg.toString();
771 // Convert html string into DOM nodes
772 if ( typeof arg == "string" ) {
773 // Fix "XHTML"-style tags in all browsers
774 arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){
775 return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">";
778 // Trim whitespace, otherwise indexOf won't work as expected
779 var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = [];
782 // option or optgroup
783 !s.indexOf("<opt") &&
784 [1, "<select>", "</select>"] ||
786 !s.indexOf("<leg") &&
787 [1, "<fieldset>", "</fieldset>"] ||
789 s.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
790 [1, "<table>", "</table>"] ||
793 [2, "<table><tbody>", "</tbody></table>"] ||
795 // <thead> matched above
796 (!s.indexOf("<td") || !s.indexOf("<th")) &&
797 [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
799 !s.indexOf("<col") &&
800 [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
802 // IE can't serialize <link> and <script> tags normally
803 jQuery.browser.msie &&
804 [1, "div<div>", "</div>"] ||
808 // Go to html and back, then peel off extra wrappers
809 div.innerHTML = wrap[1] + arg + wrap[2];
811 // Move to the right depth
815 // Remove IE's autoinserted <tbody> from table fragments
816 if ( jQuery.browser.msie ) {
818 // String was a <table>, *may* have spurious <tbody>
819 if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )
820 tb = div.firstChild && div.firstChild.childNodes;
822 // String was a bare <thead> or <tfoot>
823 else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
826 for ( var n = tb.length-1; n >= 0 ; --n )
827 if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
828 tb[n].parentNode.removeChild(tb[n]);
830 // IE completely kills leading whitespace when innerHTML is used
831 if ( /^\s/.test(arg) )
832 div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
836 arg = jQuery.makeArray( div.childNodes );
839 if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) )
842 if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options )
845 r = jQuery.merge( r, arg );
852 attr: function(elem, name, value){
853 var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
855 // Safari mis-reports the default selected property of a hidden option
856 // Accessing the parent's selectedIndex property fixes it
857 if ( name == "selected" && jQuery.browser.safari )
858 elem.parentNode.selectedIndex;
860 // Certain attributes only work when accessed via the old DOM 0 way
862 if ( value != undefined ) elem[fix[name]] = value;
863 return elem[fix[name]];
864 } else if ( jQuery.browser.msie && name == "style" )
865 return jQuery.attr( elem.style, "cssText", value );
867 else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
868 return elem.getAttributeNode(name).nodeValue;
870 // IE elem.getAttribute passes even for style
871 else if ( elem.tagName ) {
873 if ( value != undefined ) {
874 if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode )
875 throw "type property can't be changed";
876 elem.setAttribute( name, value );
879 if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
880 return elem.getAttribute( name, 2 );
882 return elem.getAttribute( name );
884 // elem is actually elem.style ... set the style
886 // IE actually uses filters for opacity
887 if ( name == "opacity" && jQuery.browser.msie ) {
888 if ( value != undefined ) {
889 // IE has trouble with opacity if it does not have layout
890 // Force it by setting the zoom level
893 // Set the alpha filter to set the opacity
894 elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
895 (parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
899 (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
901 name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
902 if ( value != undefined ) elem[name] = value;
908 return (t||"").replace(/^\s+|\s+$/g, "");
911 makeArray: function( a ) {
914 // Need to use typeof to fight Safari childNodes crashes
915 if ( typeof a != "array" )
916 for ( var i = 0, al = a.length; i < al; i++ )
924 inArray: function( b, a ) {
925 for ( var i = 0, al = a.length; i < al; i++ )
931 merge: function(first, second) {
932 // We have to loop this way because IE & Opera overwrite the length
933 // expando of getElementsByTagName
935 // Also, we need to make sure that the correct elements are being returned
936 // (IE returns comment nodes in a '*' query)
937 if ( jQuery.browser.msie ) {
938 for ( var i = 0; second[i]; i++ )
939 if ( second[i].nodeType != 8 )
940 first.push(second[i]);
942 for ( var i = 0; second[i]; i++ )
943 first.push(second[i]);
948 unique: function(first) {
949 var r = [], done = {};
952 for ( var i = 0, fl = first.length; i < fl; i++ ) {
953 var id = jQuery.data(first[i]);
966 grep: function(elems, fn, inv) {
967 // If a string is passed in for the function, make a function
968 // for it (a handy shortcut)
969 if ( typeof fn == "string" )
970 fn = eval("false||function(a,i){return " + fn + "}");
974 // Go through the array, only saving the items
975 // that pass the validator function
976 for ( var i = 0, el = elems.length; i < el; i++ )
977 if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
978 result.push( elems[i] );
983 map: function(elems, fn) {
984 // If a string is passed in for the function, make a function
985 // for it (a handy shortcut)
986 if ( typeof fn == "string" )
987 fn = eval("false||function(a){return " + fn + "}");
991 // Go through the array, translating each of the items to their
992 // new value (or values).
993 for ( var i = 0, el = elems.length; i < el; i++ ) {
994 var val = fn(elems[i],i);
996 if ( val !== null && val != undefined ) {
997 if ( val.constructor != Array ) val = [val];
998 result = result.concat( val );
1006 var userAgent = navigator.userAgent.toLowerCase();
1008 // Figure out what browser is being used
1010 version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
1011 safari: /webkit/.test(userAgent),
1012 opera: /opera/.test(userAgent),
1013 msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
1014 mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
1017 var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
1020 // Check to see if the W3C box model is being used
1021 boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
1023 styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
1027 "class": "className",
1028 "float": styleFloat,
1029 cssFloat: styleFloat,
1030 styleFloat: styleFloat,
1031 innerHTML: "innerHTML",
1032 className: "className",
1034 disabled: "disabled",
1036 readonly: "readOnly",
1037 selected: "selected",
1038 maxlength: "maxLength"
1043 parent: "a.parentNode",
1044 parents: "jQuery.dir(a,'parentNode')",
1045 next: "jQuery.nth(a,2,'nextSibling')",
1046 prev: "jQuery.nth(a,2,'previousSibling')",
1047 nextAll: "jQuery.dir(a,'nextSibling')",
1048 prevAll: "jQuery.dir(a,'previousSibling')",
1049 siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
1050 children: "jQuery.sibling(a.firstChild)",
1051 contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
1053 jQuery.fn[ i ] = function(a) {
1054 var ret = jQuery.map(this,n);
1055 if ( a && typeof a == "string" )
1056 ret = jQuery.multiFilter(a,ret);
1057 return this.pushStack( jQuery.unique(ret) );
1063 prependTo: "prepend",
1064 insertBefore: "before",
1065 insertAfter: "after",
1066 replaceAll: "replaceWith"
1068 jQuery.fn[ i ] = function(){
1070 return this.each(function(){
1071 for ( var j = 0, al = a.length; j < al; j++ )
1072 jQuery(a[j])[n]( this );
1078 removeAttr: function( key ) {
1079 jQuery.attr( this, key, "" );
1080 this.removeAttribute( key );
1082 addClass: function(c){
1083 jQuery.className.add(this,c);
1085 removeClass: function(c){
1086 jQuery.className.remove(this,c);
1088 toggleClass: function( c ){
1089 jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
1091 remove: function(a){
1092 if ( !a || jQuery.filter( a, [this] ).r.length ) {
1093 jQuery.removeData( this );
1094 this.parentNode.removeChild( this );
1098 // Clean up the cache
1099 jQuery("*", this).each(function(){ jQuery.removeData(this); });
1101 while ( this.firstChild )
1102 this.removeChild( this.firstChild );
1105 jQuery.fn[ i ] = function() {
1106 return this.each( n, arguments );
1110 jQuery.each( [ "Height", "Width" ], function(i,name){
1111 var n = name.toLowerCase();
1113 jQuery.fn[ n ] = function(h) {
1114 return this[0] == window ?
1115 jQuery.browser.safari && self["inner" + name] ||
1116 jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) ||
1117 document.body["client" + name] :
1119 this[0] == document ?
1120 Math.max( document.body["scroll" + name], document.body["offset" + name] ) :
1123 ( this.length ? jQuery.css( this[0], n ) : null ) :
1124 this.css( n, h.constructor == String ? h : h + "px" );