List Info

Thread: Grouped Selectors implementation redux




Grouped Selectors implementation redux
user name
2006-01-10 09:50:24
Hi all,

I read the thread on grouped selectors at [1], and if anyone
is
interested in a quick hack that adds the the ability to use
commas,
I've done something fairly simple. This goes just after the
test for
the "getElementsByTagName" function:

  if(selector.indexOf(",") != -1) {
  	var selectors = selector.split(",");

  	var result = new Array();

  	for(var sNum = 0; sNum != selectors.length; sNum++) {
  		result =
result.concat(document.getElementsBySelector(selectors[sNum]
));
  	}
  	return result;
  }

I've seen so many different patches to Behaviour here, maybe
it would
be a good idea to create a short form that lets you
configure the mods
you want, and bakes you a script to order 

 - Ian

[1]
http://groups.goo
gle.com/group/behaviour/browse_thread/thread/a1d692dc2f657cd
3/089782e3dde8484e

Grouped Selectors implementation redux
user name
2006-01-10 10:28:49
Heh. I think I should release a new one at some stage.

I also thought I might change the coding style to like this:

var Behaviour = {
create: function(){
  var obj = new Object; foreach(var i in Behaviour){obj[i]=Behaviour[i];
},
func1 : function(a,b,c){
  // Code starts here
}
}

behaviour = Behaviour.create();

It's like a super-mini prototype. And is more rubyish (which I like). Meh. Rambling.

Ben

On 1/10/06, Ian Sollars < ian.sollarsgmail.com">ian.sollarsgmail.com> wrote:

Hi all,

I read the thread on grouped selectors at [1], and if anyone is
interested in a quick hack that adds the the ability to use commas,
I've done something fairly simple. This goes just after the test for
the "getElementsByTagName" function:

 &nbsp;if(selector.indexOf(",&quot;) != -1) {
 &nbsp; &nbsp;   ; var selectors = selector.split(",");

  ; &nbsp; &nbsp; &nbsp;var result = new Array();

  ; &nbsp; &nbsp; &nbsp;for(var sNum = 0; sNum != selectors.length; sNum++) {
 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; result =
result.concat(document.getElementsBySelector(selectors[sNum]));
 &nbsp; &nbsp; &nbsp; &nbsp;}
&nbsp; &nbsp; &nbsp; &nbsp; return result;
&nbsp; }

I've seen so many different patches to Behaviour here, maybe it would
be a good idea to create a short form that lets you configure the mods
you want, and bakes you a script to order

- Ian

[1]
http://groups.google.com/group/behaviour/browse_thread/thread/a1d692dc2f657cd3/089782e3dde8484e


Grouped Selectors implementation redux
user name
2006-01-10 19:13:13
Ben Nolan wrote:
> Heh.  I think I
should release a new one at some stage.

Please do.  

Do you plan to stay with getElementsBySelector or switch to
cssQuery?


/Jelks

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )