[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Nicolás Sanguinetti

On 1.6.0 this has been aliased to select

$(my-element).select(a[href=foo])

-Nicolas

On 8/29/07, Jacob Rockowitz [EMAIL PROTECTED] wrote:

 Hi,

 I have been using Element#getElementsBySelector a lot and keep feeling
 that the method's name is too verbose, couldn't it just be an Element#$
 $.

 ex:

 instead of
 $('my-element').getElementsBySelector('a[href=foo]');
 it could be
 $('my-element').$$('a[href=foo]');

 I understand that the usage of the $ is for utility functions but this
 seems like a reasonable idea.

 http://dev.rubyonrails.org/ticket/9424

 thanks
 ~jake


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Jacob Rockowitz

There is a 'select' method already used form inputs but I guess it is
okay to have two DOM methods with the same method name doing
completely different things.

http://www.w3schools.com/htmldom/met_text_select.asp

At same time, I could see someone building an HTML editor using
prototype.js or a just browser wanting to add a 'select' method to the
DOM that was similar to the input.select(), it would select the
innerHTML of an element.

~ jake

On Aug 29, 4:47 pm, Nicolás Sanguinetti [EMAIL PROTECTED] wrote:
 On 1.6.0 this has been aliased to select

 $(my-element).select(a[href=foo])

 -Nicolas

 On 8/29/07, Jacob Rockowitz [EMAIL PROTECTED] wrote:

  Hi,

  I have been using Element#getElementsBySelector a lot and keep feeling
  that the method's name is too verbose, couldn't it just be an Element#$
  $.

  ex:

  instead of
  $('my-element').getElementsBySelector('a[href=foo]');
  it could be
  $('my-element').$$('a[href=foo]');

  I understand that the usage of the $ is for utility functions but this
  seems like a reasonable idea.

 http://dev.rubyonrails.org/ticket/9424

  thanks
  ~jake


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Mislav Marohnić
On 8/29/07, Jacob Rockowitz [EMAIL PROTECTED] wrote:


 There is a 'select' method already used form inputs but I guess it is
 okay to have two DOM methods with the same method name doing
 completely different things.


Ahh, sarcasm :)

This is why I suggested that we use the Selectors API (selectAllElements)
instead of select. Chaining with $$ in the middle is just too much.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Jeff Watkins

How about changing the name from Element.select to  
Element.selectElement and Element.selectAllElements? This would be in  
keeping with the future DOM methods - which prototype could adopt when  
supported.

On Aug 29, 2007, at 2:17 PM, Jacob Rockowitz [EMAIL PROTECTED]  
wrote:


 There is a 'select' method already used form inputs but I guess it is
 okay to have two DOM methods with the same method name doing
 completely different things.

 http://www.w3schools.com/htmldom/met_text_select.asp

 At same time, I could see someone building an HTML editor using
 prototype.js or a just browser wanting to add a 'select' method to the
 DOM that was similar to the input.select(), it would select the
 innerHTML of an element.

 ~ jake

 On Aug 29, 4:47 pm, Nicol�s Sanguinetti [EMAIL PROTECTED] wrote:
 On 1.6.0 this has been aliased to select

 $(my-element).select(a[href=foo])

 -Nicolas

 On 8/29/07, Jacob Rockowitz [EMAIL PROTECTED] wrote:

 Hi,

 I have been using Element#getElementsBySelector a lot and keep  
 feeling
 that the method's name is too verbose, couldn't it just be an  
 Element#$
 $.

 ex:

 instead of
 $('my-element').getElementsBySelector('a[href=foo]');
 it could be
 $('my-element').$$('a[href=foo]');

 I understand that the usage of the $ is for utility functions but  
 this
 seems like a reasonable idea.

 http://dev.rubyonrails.org/ticket/9424

 thanks
 ~jake


 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Jeff Watkins

Oh come on. The syntax of this stuff is getting pretty opaque. It's  
bad enough with libraries like jQuery which seems to delight in  
redefining nearly every DOM call - I tried reading some code that used  
jQuery recently and it made absolutely no sense.

Would it kill us to have method names that are self-documenting?

On Aug 29, 2007, at 2:57 PM, Ih�rosi Wiktor [EMAIL PROTECTED]  
wrote:


 This is why I suggested that we use the Selectors API  
 (selectAllElements)
 instead of select. Chaining with $$ in the middle is just too  
 much.
 imho it's not too much. I agree with Jake, it would be a logical step
 if we use $$ for selectors.

 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Ihárosi Wiktor

On 8/30/07, Jeff Watkins [EMAIL PROTECTED] wrote:
 Oh come on. The syntax of this stuff is getting pretty opaque.
 Would it kill us to have method names that are self-documenting?
Of course not. :) I agree with you and Mislav. If there is an standard
Selectors API use those syntax, so I am ok with selectAllElements
name.

But because I use this $(foo).$$(.bar) syntax since months I get
used to it. I don't think it's evil if we have a shortcut for
selectAllElements and it is the obvious choice, the $$.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Mislav Marohnić
On 8/30/07, Ihárosi Wiktor [EMAIL PROTECTED] wrote:


 But because I use this $(foo).$$(.bar) syntax since months I get
 used to it. I don't think it's evil if we have a shortcut for
 selectAllElements and it is the obvious choice, the $$.


I understand your need, and was also thinking of the same alias myself. But
seeing how it looks like in real world made me give up on it. $ and $$ are
OK in the front, but terrible in the middle of the chain.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Ihárosi Wiktor
On 8/30/07, Mislav Marohnić [EMAIL PROTECTED] wrote:
 I understand your need, and was also thinking of the same alias myself. But
 seeing how it looks like in real world made me give up on it. $ and $$ are
 OK in the front, but terrible in the middle of the chain.

I respect your decision and of course I accept if it will not be
aliased in the official version. In spite of this my favorite lib will
be prototype, because - as I noted in the trac ticket - it's easy to
extend so I can do it to myself. :) And thats the reason why prototype
is great. ;)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Wiktor Ihárosi

what a surprise! few hours ago on ajaxian...
first sentence: Naming is hard. :)
http://ajaxian.com/archives/selectors-api-method-names-selectelement-and-selectallelements


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---



[Prototype-core] Re: $('my-element').$$('a[href=foo]');

2007-08-29 Thread Wiktor Ihárosi

On Aug 30, 1:43 am, Wiktor Ihárosi [EMAIL PROTECTED] wrote:
 what a surprise! few hours ago on ajaxian...
 first sentence: Naming is hard. 
 :)http://ajaxian.com/archives/selectors-api-method-names-selectelement-...

I read this article and other links and if I understand it well the
names are changed in the API:

selectElement - querySelector
selectElementAll - querySelectorAll

Details: http://dean.edwards.name/weblog/2007/08/names/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype: Core group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~--~~~~--~~--~--~---