Changeset 7393

Show
Ignore:
Timestamp:
02/21/07 08:39:03 (21 months ago)
Author:
alex
Message:

expose a semi-private way to filter a NodeList? by a query, needed by NodeList?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/query.js

    r7352 r7393  
    982982                // NOTE: elementsById is not currently supported 
    983983                // NOTE: ignores xpath-ish queries for now 
     984                if(typeof query != "string"){ 
     985                        return new dojo.NodeList(query); 
     986                } 
    984987 
    985988                // FIXME: should support more methods on the return than the stock array. 
    986989                return _zip(getQueryFunc(query)(root||document)); 
    987990        } 
     991 
     992        d._filterQueryResult = function(nodeList, simpleFilter){ 
     993                var tnl = new dojo.NodeList(); 
     994                var ff = (simpleFilter) ? getFilterFunc(simpleFilter) : function(){ return true; }; 
     995                dojo.debug(ff); 
     996                for(var x=0, te; te = nodeList[x]; x++){ 
     997                        if(ff(te)){ tnl.push(te); } 
     998                } 
     999                return tnl; 
     1000        } 
    9881001})();