Changeset 11988

Show
Ignore:
Timestamp:
01/10/08 08:29:45 (7 months ago)
Author:
peller
Message:

some reductions (=== undefined) and style mods. Refs #5542

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/NodeList.js

    r11985 r11988  
    195195                        //              an Array (*not* a NodeList) 
    196196                         
    197                         return d.map(this, d.coords); 
     197                        return d.map(this, d.coords); // Array 
    198198                }, 
    199199 
     
    259259                        //              or an offset in the childNodes property 
    260260                        var item = d.query(queryOrNode)[0]; 
    261                         position = position||"last"; 
     261                        position = position || "last"; 
    262262 
    263263                        for(var x=0; x<this.length; x++){ 
     
    306306                        //      simpleFilter: single-expression CSS filter 
    307307                        //      return: a dojo.NodeList of all of the elements orpahned 
    308                         var orphans = (simpleFilter) ? d._filterQueryResult(this, simpleFilter) : this; 
     308                        var orphans = simpleFilter ? d._filterQueryResult(this, simpleFilter) : this; 
    309309                        orphans.forEach(function(item){ 
    310                                 if(item["parentNode"]){ 
     310                                if(item.parentNode){ 
    311311                                        item.parentNode.removeChild(item); 
    312312                                } 
     
    332332                        //              or an offset in the childNodes property 
    333333                        var item = this[0]; 
    334                         return d.query(queryOrListOrNode).forEach(function(ai){ d.place(ai, item, (position||"last")); }); // dojo.NodeList 
     334                        return d.query(queryOrListOrNode).forEach(function(ai){ d.place(ai, item, position || "last"); }); // dojo.NodeList 
    335335                }, 
    336336 
     
    342342                        //              current NodeList as query roots. 
    343343 
    344                         if(!queryStr){ return this; }; 
     344                        if(!queryStr){ return this; } 
    345345 
    346346                        // FIXME: probably slow 
     347                        // FIXME: use map? 
    347348                        var ret = d.NodeList(); 
    348349                        this.forEach(function(item){ 
    349350                                d.query(queryStr, item).forEach(function(subItem){ 
    350                                         if(typeof subItem != "undefined"){ 
     351                                        if(subItem !== undefined){ 
    351352                                                ret.push(subItem); 
    352353                                        } 
     
    375376                        var r = d.NodeList(); 
    376377                        var rp = function(t){  
    377                                 if(typeof t != "undefined"){ 
     378                                if(t !== undefined){ 
    378379                                        r.push(t);  
    379380                                } 
     
    386387                                } 
    387388                                // if we got a callback, run it over the filtered items 
    388                                 d.forEach(d.filter(items, _a[1], _a[2]), rp); 
    389                                 return r; // dojo.NodeList 
     389                                _a.shift(); 
    390390                        } 
    391391                        // handle the (callback, [thisObject]) case 
    392392                        d.forEach(d.filter(items, _a[0], _a[1]), rp); 
    393393                        return r; // dojo.NodeList 
    394  
    395394                }, 
    396395                 
     
    437436                                ta.appendChild(content); 
    438437                        } 
    439                         if(typeof position == "undefined"){ 
     438                        if(position === undefined){ 
    440439                                position = "last"; 
    441440                        } 
    442                         var ct = ((position == "first")||(position == "after")) ? "lastChild" : "firstChild"; 
     441                        var ct = (position == "first" || position == "after") ? "lastChild" : "firstChild"; 
    443442                        this.forEach(function(item){ 
    444443                                var tn = ta.cloneNode(true);