Bug Tracker

Changeset 4280

Show
Ignore:
Timestamp:
12/20/07 18:18:04 (1 year ago)
Author:
joern.zaefferer
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/tooltip/jquery.js

    r3864 r4280  
    11(function(){ 
    22/* 
    3  * jQuery 1.2.1 - New Wave Javascript 
     3 * jQuery 1.2.2b2 - New Wave Javascript 
    44 * 
    55 * Copyright (c) 2007 John Resig (jquery.com) 
     
    77 * and GPL (GPL-LICENSE.txt) licenses. 
    88 * 
    9  * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $ 
    10  * $Rev: 3353 $ 
     9 * $Date: 2007-12-20 14:36:56 +0100 (Don, 20 Dez 2007) $ 
     10 * $Rev: 4251 $ 
    1111 */ 
    1212 
    1313// Map over jQuery in case of overwrite 
    14 if ( typeof jQuery != "undefined" ) 
    15     var _jQuery = jQuery; 
    16  
    17 var jQuery = window.jQuery = function(selector, context) { 
    18     // If the context is a namespace object, return a new object 
    19     return this instanceof jQuery ? 
    20         this.init(selector, context) : 
    21         new jQuery(selector, context); 
     14if ( window.jQuery ) 
     15    var _jQuery = window.jQuery; 
     16 
     17var jQuery = window.jQuery = function( selector, context ) { 
     18    // The jQuery object is actually just the init constructor 'enhanced' 
     19    return new jQuery.prototype.init( selector, context ); 
    2220}; 
    2321 
    2422// Map over the $ in case of overwrite 
    25 if ( typeof $ != "undefined" ) 
    26     var _$ = $; 
     23if ( window.$ ) 
     24    var _$ = window.$; 
    2725     
    2826// Map the jQuery namespace to the '$' one 
    2927window.$ = jQuery; 
    3028 
     29// A simple way to check for HTML strings or ID strings 
     30// (both of which we optimize for) 
    3131var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 
    3232 
     33// Is it a simple selector 
     34var isSimple = /^.[^:#\[\.]*$/; 
     35 
    3336jQuery.fn = jQuery.prototype = { 
    34     init: function(selector, context) { 
     37    init: function( selector, context ) { 
    3538        // Make sure that a selection was provided 
    3639        selector = selector || document; 
    3740 
     41        // Handle $(DOMElement) 
     42        if ( selector.nodeType ) { 
     43            this[0] = selector; 
     44            this.length = 1; 
     45            return this; 
     46 
    3847        // Handle HTML strings 
    39         if ( typeof selector  == "string" ) { 
    40             var m = quickExpr.exec(selector); 
    41             if ( m && (m[1] || !context) ) { 
     48        } else if ( typeof selector == "string" ) { 
     49            // Are we dealing with HTML string or an ID? 
     50            var match = quickExpr.exec( selector ); 
     51 
     52            // Verify a match, and that no context was specified for #id 
     53            if ( match && (match[1] || !context) ) { 
     54 
    4255                // HANDLE: $(html) -> $(array) 
    43                 if ( m[1] ) 
    44                     selector = jQuery.clean( [ m[1] ], context ); 
     56                if ( match[1] ) 
     57                    selector = jQuery.clean( [ match[1] ], context ); 
    4558 
    4659                // HANDLE: $("#id") 
    4760                else { 
    48                     var tmp = document.getElementById( m[3] ); 
    49                     if ( tmp ) 
     61                    var elem = document.getElementById( match[3] ); 
     62 
     63                    // Make sure an element was located 
     64                    if ( elem ) 
    5065                        // Handle the case where IE and Opera return items 
    5166                        // by name instead of ID 
    52                         if ( tmp.id != m[3] ) 
     67                        if ( elem.id != match[3] ) 
    5368                            return jQuery().find( selector ); 
     69 
     70                        // Otherwise, we inject the element directly into the jQuery object 
    5471                        else { 
    55                             this[0] = tmp; 
     72                            this[0] = elem; 
    5673                            this.length = 1; 
    5774                            return this; 
    5875                        } 
     76 
    5977                    else 
    6078                        selector = []; 
    6179                } 
    6280 
    63             // HANDLE: $(expr) 
     81            // HANDLE: $(expr, [context]) 
     82            // (which is just equivalent to: $(content).find(expr) 
    6483            } else 
    6584                return new jQuery( context ).find( selector ); 
     
    6786        // HANDLE: $(function) 
    6887        // Shortcut for document ready 
    69         } else if ( jQuery.isFunction(selector) ) 
    70             return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 
     88        } else if ( jQuery.isFunction( selector ) ) 
     89            return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 
    7190 
    7291        return this.setArray( 
     
    7594 
    7695            // HANDLE: $(arraylike) 
    77             // Watch for when an array-like object is passed as the selector 
     96            // Watch for when an array-like object, contains DOM nodes, is passed in as the selector 
    7897            (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || 
    7998 
     
    82101    }, 
    83102     
    84     jquery: "1.2.1", 
    85  
     103    // The current version of jQuery being used 
     104    jquery: "@VERSION", 
     105 
     106    // The number of elements contained in the matched element set 
    86107    size: function() { 
    87108        return this.length; 
    88109    }, 
    89110     
     111    // The number of elements contained in the matched element set 
    90112    length: 0, 
    91113 
     114    // Get the Nth element in the matched element set OR 
     115    // Get the whole matched element set as a clean array 
    92116    get: function( num ) { 
    93117        return num == undefined ? 
     
    97121 
    98122            // Return just the object 
    99             this[num]; 
    100     }, 
    101      
    102     pushStack: function( a ) { 
    103         var ret = jQuery(a); 
     123            this[ num ]; 
     124    }, 
     125     
     126    // Take an array of elements and push it onto the stack 
     127    // (returning the new matched element set) 
     128    pushStack: function( elems ) { 
     129        // Build a new jQuery matched element set 
     130        var ret = jQuery( elems ); 
     131 
     132        // Add the old object onto the stack (as a reference) 
    104133        ret.prevObject = this; 
     134 
     135        // Return the newly-formed element set 
    105136        return ret; 
    106137    }, 
    107138     
    108     setArray: function( a ) { 
     139    // Force the current matched set of elements to become 
     140    // the specified array of elements (destroying the stack in the process) 
     141    // You should use pushStack() in order to do this, but maintain the stack 
     142    setArray: function( elems ) { 
     143        // Resetting the length to 0, then using the native Array push 
     144        // is a super-fast way to populate an object with array-like properties 
    109145        this.length = 0; 
    110         Array.prototype.push.apply( this, a ); 
     146        Array.prototype.push.apply( this, elems ); 
     147         
    111148        return this; 
    112149    }, 
    113150 
    114     each: function( fn, args ) { 
    115         return jQuery.each( this, fn, args ); 
    116     }, 
    117  
    118     index: function( obj ) { 
    119         var pos = -1; 
     151    // Execute a callback for every element in the matched set. 
     152    // (You can seed the arguments with an array of args, but this is 
     153    // only used internally.) 
     154    each: function( callback, args ) { 
     155        return jQuery.each( this, callback, args ); 
     156    }, 
     157 
     158    // Determine the position of an element within  
     159    // the matched set of elements 
     160    index: function( elem ) { 
     161        var ret = -1; 
     162 
     163        // Locate the position of the desired element 
    120164        this.each(function(i){ 
    121             if ( this == obj ) pos = i; 
     165            if ( this == elem ) 
     166                ret = i; 
    122167        }); 
    123         return pos; 
    124     }, 
    125  
    126     attr: function( key, value, type ) { 
    127         var obj = key; 
     168 
     169        return ret; 
     170    }, 
     171 
     172    attr: function( name, value, type ) { 
     173        var options = name; 
    128174         
    129175        // Look for the case where we're accessing a style value 
    130         if ( key.constructor == String ) 
     176        if ( name.constructor == String ) 
    131177            if ( value == undefined ) 
    132                 return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; 
     178                return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined; 
     179 
    133180            else { 
    134                 obj = {}; 
    135                 obj[ key ] = value; 
     181                options = {}; 
     182                options[ name ] = value; 
    136183            } 
    137184         
    138185        // Check to see if we're setting style values 
    139         return this.each(function(index){ 
     186        return this.each(function(i){ 
    140187            // Set all the styles 
    141             for ( var prop in obj ) 
     188            for ( name in options ) 
    142189                jQuery.attr( 
    143                     type ? this.style : this, 
    144                     prop, jQuery.prop(this, obj[prop], type, index, prop) 
     190                    type ? 
     191                        this.style : 
     192                        this, 
     193                    name, jQuery.prop( this, options[ name ], type, i, name ) 
    145194                ); 
    146195        }); 
     
    148197 
    149198    css: function( key, value ) { 
     199        // ignore negative width and height values 
     200        if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) 
     201            value = undefined; 
    150202        return this.attr( key, value, "curCSS" ); 
    151203    }, 
    152204 
    153     text: function(e) { 
    154         if ( typeof e != "object" && e != null ) 
    155             return this.empty().append( document.createTextNode( e ) ); 
    156  
    157         var t = ""; 
    158         jQuery.each( e || this, function(){ 
     205    text: function( text ) { 
     206        if ( typeof text != "object" && text != null ) 
     207            return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 
     208 
     209        var ret = ""; 
     210 
     211        jQuery.each( text || this, function(){ 
    159212            jQuery.each( this.childNodes, function(){ 
    160213                if ( this.nodeType != 8 ) 
    161                     t += this.nodeType != 1 ? 
    162                         this.nodeValue : jQuery.fn.text([ this ]); 
     214                    ret += this.nodeType != 1 ? 
     215                        this.nodeValue : 
     216                        jQuery.fn.text( [ this ] ); 
    163217            }); 
    164218        }); 
    165         return t; 
    166     }, 
    167  
    168     wrapAll: function(html) { 
     219 
     220        return ret; 
     221    }, 
     222 
     223    wrapAll: function( html ) { 
    169224        if ( this[0] ) 
    170225            // The elements to wrap the target around 
    171             jQuery(html, this[0].ownerDocument) 
     226            jQuery( html, this[0].ownerDocument ) 
    172227                .clone() 
    173                 .insertBefore(this[0]) 
     228                .insertBefore( this[0] ) 
    174229                .map(function(){ 
    175230                    var elem = this; 
     231 
    176232                    while ( elem.firstChild ) 
    177233                        elem = elem.firstChild; 
     234 
    178235                    return elem; 
    179236                }) 
     
    183240    }, 
    184241 
    185     wrapInner: function(html) { 
     242    wrapInner: function( html ) { 
    186243        return this.each(function(){ 
    187             jQuery(this).contents().wrapAll(html); 
     244            jQuery( this ).contents().wrapAll( html ); 
    188245        }); 
    189246    }, 
    190247 
    191     wrap: function(html) { 
     248    wrap: function( html ) { 
    192249        return this.each(function(){ 
    193             jQuery(this).wrapAll(html); 
     250            jQuery( this ).wrapAll( html ); 
    194251        }); 
    195252    }, 
    196253 
    197254    append: function() { 
    198         return this.domManip(arguments, true, 1, function(a){ 
    199             this.appendChild( a ); 
     255        return this.domManip(arguments, true, false, function(elem){ 
     256            if (this.nodeType == 1) 
     257                this.appendChild( elem ); 
    200258        }); 
    201259    }, 
    202260 
    203261    prepend: function() { 
    204         return this.domManip(arguments, true, -1, function(a){ 
    205             this.insertBefore( a, this.firstChild ); 
     262        return this.domManip(arguments, true, true, function(elem){ 
     263            if (this.nodeType == 1) 
     264                this.insertBefore( elem, this.firstChild ); 
    206265        }); 
    207266    }, 
    208267     
    209268    before: function() { 
    210         return this.domManip(arguments, false, 1, function(a){ 
    211             this.parentNode.insertBefore( a, this ); 
     269        return this.domManip(arguments, false, false, function(elem){ 
     270            this.parentNode.insertBefore( elem, this ); 
    212271        }); 
    213272    }, 
    214273 
    215274    after: function() { 
    216         return this.domManip(arguments, false, -1, function(a){ 
    217             this.parentNode.insertBefore( a, this.nextSibling ); 
     275        return this.domManip(arguments, false, true, function(elem){ 
     276            this.parentNode.insertBefore( elem, this.nextSibling ); 
    218277        }); 
    219278    }, 
    220279 
    221280    end: function() { 
    222         return this.prevObject || jQuery([]); 
    223     }, 
    224  
    225     find: function(t) { 
    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 ); 
    229     }, 
    230  
    231     clone: function(events) { 
     281        return this.prevObject || jQuery( [] ); 
     282    }, 
     283 
     284    find: function( selector ) { 
     285        var elems = jQuery.map(this, function(elem){ 
     286            return jQuery.find( selector, elem ); 
     287        }); 
     288 
     289        return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? 
     290            jQuery.unique( elems ) : 
     291            elems ); 
     292    }, 
     293 
     294    clone: function( events ) { 
    232295        // Do the clone 
    233296        var ret = this.map(function(){ 
    234             return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true); 
     297            if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { 
     298                // IE copies events bound via attachEvent when 
     299                // using cloneNode. Calling detachEvent on the 
     300                // clone will also remove the events from the orignal 
     301                // In order to get around this, we use innerHTML. 
     302                // Unfortunately, this means some modifications to  
     303                // attributes in IE that are actually only stored  
     304                // as properties will not be copied (such as the 
     305                // the name attribute on an input). 
     306                var clone = this.cloneNode(true), 
     307                    container = document.createElement("div"), 
     308                    container2 = document.createElement("div"); 
     309                container.appendChild(clone); 
     310                container2.innerHTML = container.innerHTML; 
     311                return container2.firstChild; 
     312            } else 
     313                return this.cloneNode(true); 
    235314        }); 
    236315 
     
    244323         
    245324        // Copy the events from the original to the clone 
    246         if (events === true) 
    247             this.find("*").andSelf().each(function(i) { 
    248                 var events = jQuery.data(this, "events"); 
     325        if ( events === true ) 
     326            this.find("*").andSelf().each(function(i){ 
     327                var events = jQuery.data( this, "events" ); 
     328 
    249329                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); 
     330                    for ( var handler in events[ type ] ) 
     331                        jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); 
    252332            }); 
    253333 
     
    256336    }, 
    257337 
    258     filter: function(t) { 
     338    filter: function( selector ) { 
    259339        return this.pushStack( 
    260             jQuery.isFunction( t ) && 
    261             jQuery.grep(this, function(el, index){ 
    262                 return t.apply(el, [index]); 
     340            jQuery.isFunction( selector ) && 
     341            jQuery.grep(this, function(elem, i){ 
     342                return selector.call( elem, i ); 
    263343            }) || 
    264344 
    265             jQuery.multiFilter(t,this) ); 
    266     }, 
    267  
    268     not: function(t) { 
    269         return this.pushStack( 
    270             t.constructor == String && 
    271             jQuery.multiFilter(t, this, true) || 
    272  
    273             jQuery.grep(this, function(a) { 
    274                 return ( t.constructor == Array || t.jquery ) 
    275                     ? jQuery.inArray( a, t ) < 0 
    276                     : a != t; 
    277             }) 
    278         ); 
    279     }, 
    280  
    281     add: function(t) { 
    282         return this.pushStack( jQuery.merge( 
     345            jQuery.multiFilter( selector, this ) ); 
     346    }, 
     347 
     348    not: function( selector ) { 
     349        if ( selector.constructor == String ) 
     350            // test special case where just one selector is passed in 
     351            if ( isSimple.test( selector ) ) 
     352                return this.pushStack( jQuery.multiFilter( selector, this, true ) ); 
     353            else 
     354                selector = jQuery.multiFilter( selector, this ); 
     355 
     356        var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; 
     357        return this.filter(function() { 
     358            return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; 
     359        }); 
     360    }, 
     361 
     362    add: function( selector ) { 
     363        return !selector ? this : this.pushStack( jQuery.merge(  
    283364            this.get(), 
    284             t.constructor == String ? 
    285                 jQuery(t).get() : 
    286                 t.length != undefined && (!t.nodeName || jQuery.nodeName(t, "form")) ? 
    287                     t : [t] ) 
    288         ); 
    289     }, 
    290  
    291     is: function(expr) { 
    292         return expr ? jQuery.multiFilter(expr,this).length > 0 : false; 
    293     }, 
    294  
    295     hasClass: function(expr) { 
    296         return this.is("." + expr); 
    297     }, 
    298      
    299     val: function( val ) { 
    300         if ( val == undefined ) { 
     365            selector.constructor == String ?  
     366                jQuery( selector ).get() : 
     367                selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? 
     368                    selector : [selector] ) ); 
     369    }, 
     370 
     371    is: function( selector ) { 
     372        return selector ? 
     373            jQuery.multiFilter( selector, this ).length > 0 : 
     374            false; 
     375    }, 
     376 
     377    hasClass: function( selector ) { 
     378        return this.is( "." + selector ); 
     379    }, 
     380     
     381    val: function( value ) { 
     382        if ( value == undefined ) { 
     383 
    301384            if ( this.length ) { 
    302385                var elem = this[0]; 
    303                  
     386 
    304387                // We need to handle select boxes special 
    305                 if ( jQuery.nodeName(elem, "select") ) { 
     388                if ( jQuery.nodeName( elem, "select" ) ) { 
    306389                    var index = elem.selectedIndex, 
    307                         a = [], 
     390                        values = [], 
    308391                        options = elem.options, 
    309392                        one = elem.type == "select-one"; 
     
    315398                    // Loop through all the selected options 
    316399                    for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { 
    317                         var option = options[i]; 
     400                        var option = options[ i ]; 
     401 
    318402                        if ( option.selected ) { 
    319403                            // Get the specifc value for the option 
    320                             var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value; 
     404                            value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; 
    321405                             
    322406                            // We don't need an array for one selects 
    323407                            if ( one ) 
    324                                 return val; 
     408                                return value; 
    325409                             
    326410                            // Multi-Selects return an array 
    327                             a.push(val); 
     411                            values.push( value ); 
    328412                        } 
    329413                    } 
    330414                     
    331                     return a; 
     415                    return values; 
    332416                     
    333417                // Everything else, we just grab the value 
    334418                } else 
    335                     return this[0].value.replace(/\r/g, ""); 
    336             } 
    337         } else 
    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]; 
    344  
    345                     jQuery("option", this).each(function(){ 
    346                         this.selected = (jQuery.inArray(this.value, tmp) >= 0 || 
    347                         jQuery.inArray(this.text, tmp) >= 0); 
    348                     }); 
    349  
    350                     if ( !tmp.length ) 
    351                         this.selectedIndex = -1; 
    352                 } else 
    353                     this.value = val; 
    354             }); 
    355     }, 
    356      
    357     html: function( val ) { 
    358         return val == undefined ? 
    359             ( this.length ? this[0].innerHTML : null ) : 
    360             this.empty().append( val ); 
    361     }, 
    362  
    363     replaceWith: function( val ) { 
    364         return this.after( val ).remove(); 
    365     }, 
    366  
    367     eq: function(i){ 
    368         return this.slice(i, i+1); 
     419                    return (this[0].value || "").replace(/\r/g, ""); 
     420 
     421            } 
     422 
     423            return undefined; 
     424        } 
     425 
     426        return this.each(function(){ 
     427            if ( this.nodeType != 1 ) 
     428                return; 
     429 
     430            if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 
     431                this.checked = (jQuery.inArray(this.value, value) >= 0 || 
     432                    jQuery.inArray(this.name, value) >= 0); 
     433 
     434            else if ( jQuery.nodeName( this, "select" ) ) { 
     435                var values = value.constructor == Array ? 
     436                    value : 
     437                    [ value ]; 
     438 
     439                jQuery( "option", this ).each(function(){ 
     440                    this.selected = (jQuery.inArray( this.value, values ) >= 0 || 
     441                        jQuery.inArray( this.text, values ) >= 0); 
     442                }); 
     443 
     444                if ( !values.length ) 
     445                    this.selectedIndex = -1; 
     446 
     447            } else 
     448                this.value = value; 
     449        }); 
     450    }, 
     451     
     452    html: function( value ) { 
     453        return value == undefined ? 
     454            (this.length ? 
     455                this[0].innerHTML : 
     456                null) : 
     457            this.empty().append( value ); 
     458    }, 
     459 
     460    replaceWith: function( value ) { 
     461        return this.after( value ).remove(); 
     462    }, 
     463 
     464  &