}
t=t.substring(0,cursor);
} while (cursor>0);
this.s[i]=s;
}
},
get:function(root) {
this.explore(root || document,this.i==(this.s.length-1));
return this.r;
},
explore:function(elt,leaf) {
var s=this.s[this.i];
var r=[];
if (s[1]) {
e=$(s[1]);
if (e && (s[0]=="*" || e.tagName==s[0]) && e.childOf(elt)) {
r=[e];
}
} else {
r=$A(elt.getElementsByTagName(s[0]));
}
if (s[2].length==1) { //single classname
r=r.findAll(function(o) {
if (o.className.indexOf(" ")==-1) {
return o.className==s[2][0];
} else {
return o.className.split(/\s+/).include(s[2][0]);
}
});
} else if (s[2].length>0) {
r=r.findAll(function(o) {
if (o.className.indexOf(" ")==-1) {
return false;
} else {
var q=o.className.split(/\s+/);
return s[2].all(function(c) {
return q.include(c);
});
}
});
}
if (leaf) {
this.r=this.r.concat(r);
} else {
++this.i;
r.each(function(o) {
this.explore(o,this.i==(this.s.length-1));
}.bind(this));
}
}
}
var $$old=$$;
var $$=function(a,b) {
if (b || a.indexOf("[")>=0) return $$old.apply(this,arguments);
return new SelectorLiteAddon(a.split(/\s+/)).get();
}