Bug Tracker

Changeset 4187

Show
Ignore:
Timestamp:
12/16/07 17:15:27 (1 year ago)
Author:
joern.zaefferer
Message:

fix for strict warnings

Location:
trunk/plugins
Files:
1 added
5 modified

Legend:

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

    r4186 r4187  
    7777                ajax( settings ); 
    7878            }); 
    79             return; 
     79            return undefined; 
    8080        case "sync": 
    8181            var pos = synced.length; 
  • trunk/plugins/ajaxQueue/test/index.html

    r3255 r4187  
    66     
    77    <link rel="stylesheet" href="testsuite.css"/> 
    8     <script type="text/javascript" src="../../../jquery/dist/jquery.js"></script> 
     8    <script type="text/javascript" src="jquery.js"></script> 
    99    <script type="text/javascript" src="../jquery.ajaxQueue.js"></script> 
    10     <script type="text/javascript" src="../../../jquery/test/data/testrunner.js"></script> 
     10    <script type="text/javascript" src="testrunner.js"></script> 
    1111    <script type="text/javascript" src="test.js"></script> 
    1212    <style type="text/css"> 
  • trunk/plugins/ajaxQueue/test/testrunner.js

    r2841 r4187  
    7575         
    7676    var filter = location.search.slice(1); 
    77     if ( filter && encodeURIComponent(name) != filter ) 
     77    if ( filter && encodeURIComponent(name).indexOf(filter) == -1 ) 
    7878        return; 
    7979         
     
    8989            } 
    9090            _config.Test.push( [ false, "Died on test #" + (_config.Test.length+1) + ": " + e ] ); 
    91             throw e; 
    9291        } 
    9392    }); 
     
    163162 */ 
    164163function reset() { 
    165     document.getElementById('main').innerHTML = _config.fixture; 
     164    $("#main").html( _config.fixture ); 
    166165} 
    167166 
     
    275274 * @example equals( "Expected 2 characters.", v.formatMessage("Expected {0} characters.", 2) ); 
    276275 * 
     276 * @param Object actual 
    277277 * @param Object expected 
    278  * @param Object actual 
    279278 * @param String message (optional) 
    280279 */ 
  • trunk/plugins/metadata/jquery.metadata.js

    r3640 r4187  
    8585                    data = m[1]; 
    8686            } else if ( settings.type == "elem" ) { 
    87                 if( !elem.getElementsByTagName ) return; 
     87                if( !elem.getElementsByTagName ) 
     88                    return undefined; 
    8889                var e = elem.getElementsByTagName(settings.name); 
    8990                if ( e.length ) 
  • trunk/plugins/metadata/test/jquery.js

    r3640 r4187  
    11(function(){ 
    22/* 
    3  * jQuery @VERSION - New Wave Javascript 
     3 * jQuery 1.2.2-pre - New Wave Javascript 
    44 * 
    55 * Copyright (c) 2007 John Resig (jquery.com) 
     
    77 * and GPL (GPL-LICENSE.txt) licenses. 
    88 * 
    9  * $Date: 2007-10-01 22:15:20 +0200 (Mo, 01 Okt 2007) $ 
    10  * $Rev: 3501 $ 
     9 * $Date: 2007-12-16 02:03:50 +0100 (Son, 16 Dez 2007) $ 
     10 * $Rev: 4171 $ 
    1111 */ 
    1212 
    1313// Map over jQuery in case of overwrite 
    14 if ( typeof jQuery != "undefined" ) 
    15     var _jQuery = jQuery; 
     14if ( window.jQuery ) 
     15    var _jQuery = window.jQuery; 
    1616 
    1717var 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 ); 
     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 
     
    3230// (both of which we optimize for) 
    3331var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; 
     32 
     33// Is it a simple selector 
     34var isSimple = /^.[^:#\[\.]*$/; 
    3435 
    3536jQuery.fn = jQuery.prototype = { 
     
    3839        selector = selector || document; 
    3940 
     41        // Handle $(DOMElement) 
     42        if ( selector.nodeType ) { 
     43            this[0] = selector; 
     44            this.length = 1; 
     45            return this; 
     46 
    4047        // Handle HTML strings 
    41         if ( typeof selector == "string" ) { 
     48        } else if ( typeof selector == "string" ) { 
    4249            // Are we dealing with HTML string or an ID? 
    4350            var match = quickExpr.exec( selector ); 
     
    190197 
    191198    css: function( key, value ) { 
     199        // ignore negative width and height values 
     200        if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) 
     201            value = undefined; 
    192202        return this.attr( key, value, "curCSS" ); 
    193203    }, 
     
    195205    text: function( text ) { 
    196206        if ( typeof text != "object" && text != null ) 
    197             return this.empty().append( document.createTextNode( text ) ); 
     207            return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); 
    198208 
    199209        var ret = ""; 
     
    244254    append: function() { 
    245255        return this.domManip(arguments, true, false, function(elem){ 
    246             this.appendChild( elem ); 
     256            if (this.nodeType == 1) 
     257                this.appendChild( elem ); 
    247258        }); 
    248259    }, 
     
    250261    prepend: function() { 
    251262        return this.domManip(arguments, true, true, function(elem){ 
    252             this.insertBefore( elem, this.firstChild ); 
     263            if (this.nodeType == 1) 
     264                this.insertBefore( elem, this.firstChild ); 
    253265        }); 
    254266    }, 
     
    283295        // Do the clone 
    284296        var ret = this.map(function(){ 
    285             return this.outerHTML ? 
    286                 jQuery( this.outerHTML )[0] : 
    287                 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); 
    288314        }); 
    289315 
     
    321347 
    322348    not: function( selector ) { 
    323         return this.pushStack( 
    324             selector.constructor == String && 
    325             jQuery.multiFilter( selector, this, true ) || 
    326  
    327             jQuery.grep(this, function(elem) { 
    328                 return selector.constructor == Array || selector.jquery ? 
    329                     jQuery.inArray( elem, selector ) < 0 : 
    330                     elem != selector; 
    331             }) ); 
     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        return this.filter(function() { 
     357            return jQuery.inArray( this, selector ) < 0; 
     358        }); 
    332359    }, 
    333360 
    334361    add: function( selector ) { 
    335         return this.pushStack( jQuery.merge( this.get(), jQuery( selector ) ) ); 
     362        return !selector ? this : this.pushStack( jQuery.merge(  
     363            this.get(), 
     364            selector.constructor == String ?  
     365                jQuery( selector ).get() : 
     366                selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? 
     367                    selector : [selector] ) ); 
    336368    }, 
    337369 
     
    351383            if ( this.length ) { 
    352384                var elem = this[0]; 
    353                  
     385 
    354386                // We need to handle select boxes special 
    355387                if ( jQuery.nodeName( elem, "select" ) ) { 
     
    384416                // Everything else, we just grab the value 
    385417                } else 
    386                     return this[0].value.replace(/\r/g, ""); 
    387  
    388             } 
    389  
    390         } else 
    391             return this.each(function(){ 
    392                 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 
    393                     this.checked = (jQuery.inArray(this.value, value) >= 0 || 
    394                         jQuery.inArray(this.name, value) >= 0); 
    395  
    396                 else if ( jQuery.nodeName( this, "select" ) ) { 
    397                     var values = value.constructor == Array ? 
    398                         value : 
    399                         [ value ]; 
    400  
    401                     jQuery( "option", this ).each(function(){ 
    402                         this.selected = (jQuery.inArray( this.value, values ) >= 0 || 
    403                             jQuery.inArray( this.text, values ) >= 0); 
    404                     }); 
    405  
    406                     if ( !tmp.length ) 
    407                         this.selectedIndex = -1; 
    408  
    409                 } else 
    410                     this.value = value; 
    411             }); 
     418                    return (this[0].value || "").replace(/\r/g, ""); 
     419 
     420            } 
     421 
     422        } 
     423 
     424        return this.each(function(){ 
     425            if ( this.nodeType != 1 ) 
     426                return; 
     427 
     428            if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) 
     429                this.checked = (jQuery.inArray(this.value, value) >= 0 || 
     430                    jQuery.inArray(this.name, value) >= 0); 
     431 
     432            else if ( jQuery.nodeName( this, "select" ) ) { 
     433                var values = value.constructor == Array ? 
     434                    value : 
     435                    [ value ]; 
     436 
     437                jQuery( "option", this ).each(function(){ 
     438                    this.selected = (jQuery.inArray( this.value, values ) >= 0 || 
     439                        jQuery.inArray( this.text, values ) >= 0); 
     440                }); 
     441 
     442                if ( !values.length ) 
     443                    this.selectedIndex = -1; 
     444 
     445            } else 
     446                this.value = value; 
     447        }); 
    412448    }, 
    413449     
     
    456492 
    457493            if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) 
    458                 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( document.createElement("tbody") ); 
     494                obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); 
     495 
     496            var scripts = jQuery( [] ); 
    459497 
    460498            jQuery.each(elems, function(){ 
     
    463501                    this; 
    464502 
    465                 if ( !evalScript( 0, elem ) ) 
     503                // execute all scripts after the elements have been injected 
     504                if ( jQuery.nodeName( elem, "script" ) ) { 
     505                    scripts = scripts.add( elem ); 
     506                } else { 
     507                    // Remove any inner scripts for later evaluation 
     508                    if ( elem.nodeType == 1 ) 
     509                        scripts = scripts.add( jQuery( "script", elem ).remove() ); 
     510 
     511                    // Inject the elements into the document 
    466512                    callback.call( obj, elem ); 
     513                } 
    467514            }); 
     515 
     516            scripts.each( evalScript ); 
    468517        }); 
    469518    } 
    470519}; 
    471520 
     521// Give the init function the jQuery prototype for later instantiation 
     522jQuery.prototype.init.prototype = jQuery.prototype; 
     523 
    472524function evalScript( i, elem ) { 
    473     var script = jQuery.nodeName( elem, "script" ); 
    474  
    475     if ( script ) { 
    476         if ( elem.src ) 
    477             jQuery.ajax({ 
    478                 url: elem.src, 
    479                 async: false, 
    480                 dataType: "script" 
    481             }); 
    482  
    483         else 
    484             jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 
    485      
    486         if ( elem.parentNode ) 
    487             elem.parentNode.removeChild( elem ); 
    488  
    489     } else if ( elem.nodeType == 1 ) 
    490         jQuery( "script", elem ).each( evalScript ); 
    491  
    492     return script; 
     525    if ( elem.src ) 
     526        jQuery.ajax({ 
     527            url: elem.src, 
     528            async: false, 
     529            dataType: "script" 
     530        }); 
     531 
     532    else 
     533        jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 
     534 
     535    if ( elem.parentNode ) 
     536        elem.parentNode.removeChild( elem ); 
    493537} 
    494538 
     
    501545        deep = target; 
    502546        target = arguments[1] || {}; 
     547        // skip the boolean and the target 
     548        i = 2; 
    503549    } 
     550 
     551    // Handle case when target is a string or something (possible in deep copy) 
     552    if ( typeof target != "object" && typeof target != "function" ) 
     553        target = {}; 
    504554 
    505555    // extend jQuery itself if only one argument is passed 
     
    515565            for ( var name in options ) { 
    516566                // Prevent never-ending loop 
    517                 if ( target == options[ name ] ) 
     567                if ( target === options[ name ] ) 
    518568                    continue; 
    519569 
    520570                // Recurse if we're merging object values 
    521                 if ( deep && typeof options[ name ] == "object" && target[ name ] ) 
    522                     jQuery.extend( target[ name ], options[ name ] ); 
     571                if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType ) 
     572                    target[ name ] = jQuery.extend( target[ name ], options[ name ] ); 
    523573 
    524574                // Don't bring in undefined values 
     
    561611 
    562612    // Evalulates a script in a global context 
    563     // Evaluates Async. in Safari 2 :-( 
    564613    globalEval: function( data ) { 
    565614        data = jQuery.trim( data ); 
     
    693742        add: function( elem, classNames ) { 
    694743            jQuery.each((classNames || "").split(/\s+/), function(i, className){ 
    695                 if ( !jQuery.className.has( elem.className, className ) ) 
     744                if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) 
    696745                    elem.className += (elem.className ? " " : "") + className; 
    697746            }); 
     
    700749        // internal only, use removeClass("class") 
    701750        remove: function( elem, classNames ) { 
    702             elem.className = classNames != undefined ? 
    703                 jQuery.grep(elem.className.split(/\s+/), function(className){ 
    704                     return !jQuery.className.has( classNames, className );   
    705                 }).join(" ") : 
    706                 ""; 
     751            if (elem.nodeType == 1) 
     752                elem.className = classNames != undefined ? 
     753                    jQuery.grep(elem.className.split(/\s+/), function(className){ 
     754                        return !jQuery.className.has( classNames, className );   
     755                    }).join(" ") : 
     756                    ""; 
    707757        }, 
    708758 
     
    728778    }, 
    729779 
    730     css: function( elem, name ) { 
    731         if ( name == "height" || name == "width" ) { 
    732             var old = {}, height, width; 
    733  
    734             // Revert the padding and border widths to get the 
    735             // correct height/width values 
    736             jQuery.each([ "Top", "Bottom", "Right", "Left" ], function(){ 
    737                 old[ "padding" + this ] = 0; 
    738                 old[ "border" + this + "Width" ] = 0; 
    739             }); 
    740  
    741             // Swap out the padding/border values temporarily 
    742             jQuery.swap( elem, old, function() { 
    743  
    744                 // If the element is visible, then the calculation is easy 
    745                 if ( jQuery( elem ).is(":visible") ) { 
    746                     height = elem.offsetHeight; 
    747                     width = elem.offsetWidth; 
    748  
    749                 // Otherwise, we need to flip out more values 
    750                 } else { 
    751                     elem = jQuery( elem.cloneNode(true) ) 
    752                         .find(":radio").removeAttr("checked").end() 
    753                         .css({ 
    754                             visibility: "hidden", 
    755                             position: "absolute", 
    756                             display: "block", 
    757                             right: "0", 
    758                             left: "0" 
    759                         }).appendTo( elem.parentNode )[0]; 
    760  
    761                     var position = jQuery.css( elem.parentNode, "position" ) || "static"; 
    762                     if ( position == "static" ) 
    763                         elem.parentNode.style.position = "relative"; 
    764  
    765                     height = elem.clientHeight; 
    766                     width = elem.clientWidth; 
    767  
    768                     if ( position == "static" ) 
    769                         elem.parentNode.style.position = "static"; 
    770  
    771                     elem.parentNode.removeChild( elem ); 
    772                 } 
    773             }); 
    774  
    775             return name == "height" ? 
    776                 height : 
    777                 width; 
    778         } 
    779  
    780         return jQuery.curCSS( elem, name ); 
     780    css: function( elem, name, force ) { 
     781        if ( name == "width" || name == "height" ) { 
     782            var width, height, props = { position: "absolute", visibility: "hidden", display:"block" }; 
     783         
     784            function getWH() { 
     785                width = elem.clientWidth; 
     786                height = elem.clientHeight; 
     787            } 
     788         
     789            if ( jQuery(elem).is(":visible") ) 
     790                getWH(); 
     791            else 
     792                jQuery.swap( elem, props, getWH ); 
     793 
     794            return name == "width" ? width : height; 
     795        } 
     796         
     797        return jQuery.curCSS( elem, name, force ); 
    781798    }, 
    782799 
     
    843860                ret = name == "display" && swap[ stack.length - 1 ] != null ? 
    844861                    "none" : 
    845                     document.defaultView.getComputedStyle( elem, null ).getPropertyValue( name ) || ""; 
     862                    ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || ""; 
    846863 
    847864                // Finally, revert the display styles back 
     
    888905        var ret = []; 
    889906        context = context || document; 
     907        // !context.createElement fails in IE with an error but returns typeof 'object' 
     908        if (typeof context.createElement == 'undefined')  
     909            context = context.ownerDocument || context[0] && context[0].ownerDocument || document; 
    890910 
    891911        jQuery.each(elems, function(i, elem){ 
     
    911931                    // option or optgroup 
    912932                    !tags.indexOf("<opt") && 
    913                     [ 1, "<select>", "</select>" ] || 
     933                    [ 1, "<select multiple='multiple'>", "</select>" ] || 
    914934                     
    915935                    !tags.indexOf("<leg") && 
     
    950970                         
    951971                        // String was a bare <thead> or <tfoot> 
    952                         wrap[1] == "<table>" && s.indexOf("<tbody") < 0 ? 
     972                        wrap[1] == "<table>" && tags.indexOf("<tbody") < 0 ? 
    953973                            div.childNodes : 
    954974                            []; 
    955  
    956                     for ( var i = tbody.length - 1; i >= 0 ; --i ) 
    957                         if ( jQuery.nodeName( tbody[ i ], "tbody" ) && !tbody[ i ].childNodes.length ) 
    958                             tbody[ i ].parentNode.removeChild( tbody[ i ] ); 
    959      
     975                 
     976                    for ( var j = tbody.length - 1; j >= 0 ; --j ) 
     977                        if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) 
     978                            tbody[ j ].parentNode.removeChild( tbody[ j ] ); 
     979                     
    960980                    // IE completely kills leading whitespace when innerHTML is used     
    961981                    if ( /^\s/.test( elem ) )    
    962982                        div.insertBefore( context.createTextNode( elem.match(/^\s*/)[0] ), div.firstChild ); 
    963  
     983                 
    964984                } 
    965985                 
     
    9821002     
    9831003    attr: function( elem, name, value ) { 
     1004        // don't set attributes on text and comment nodes 
     1005        if (!elem || elem.nodeType == 3 || elem.nodeType == 8) 
     1006            return undefined; 
     1007 
    9841008        var fix = jQuery.isXMLDoc( elem ) ? 
    9851009            {} : 
     
    10121036                    throw "type property can't be changed"; 
    10131037 
    1014                 elem.setAttribute( name, value ); 
     1038                // convert the value to a string (all browsers do this but IE) see #1070 
     1039                elem.setAttribute( name, "" + value ); 
    10151040            } 
    10161041 
     
    10341059                } 
    10351060     
    1036                 return elem.filter ?  
     1061                return elem.filter && elem.filter.indexOf("opacity=") >= 0 ? 
    10371062                    (parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : 
    10381063                    ""; 
     
    11841209        selected: "selected", 
    11851210        maxlength: "maxLength", 
    1186         selectedIndex: "selectedIndex" 
     1211        selectedIndex: "selectedIndex", 
     1212        defaultValue: "defaultValue", 
     1213        tagName: "tagName", 
     1214        nodeName: "nodeName" 
    11871215    } 
    11881216}); 
     
    12311259    removeAttr: function( name ) { 
    12321260        jQuery.attr( this, name, "" ); 
    1233         this.removeAttribute( name ); 
     1261        if (this.nodeType == 1)  
     1262            this.removeAttribute( name ); 
    12341263    }, 
    12351264 
     
    12481277    remove: function( selector ) { 
    12491278        if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { 
    1250