[jQuery] Possible idea regarding $() and multiple selectors via add()
So basically, would it be practical to code the $() selector function
in jquery to allow multiple selectors, instead of having to add them
afterwards?
Current style of selecting two ID's
1 $("#foo")
2 $("#foo").add("#bar")
3 $("#foo","#container")
4 $("#foo","#container").add($("#bar","#container"))
Suggested Way:
1 $("#foo")
2 $(["#foo","#bar"]) aka $(array("#foo","#bar"))
3 $("#foo","#container")
4 $(["#foo","#bar"],"#container") aka $
(array("#foo","#bar"),"#container")
To make this suggestion a reality, all you would need to do is
something like [obviously this won't work because the $ function is
much more complicated then this, but you get the idea...]
function $(param1,param2){
if(typeof param1=="array"){
$.each(param1,function(x){
css_select(x,param2)
});
}
else
css_select(param1,param2);
}
Any reason why this isn't a possibility or unwanted?