[Prototype-core] Re: combinator selectors in Element#select

2007-10-17 Thread [EMAIL PROTECTED]

Please make it to be simple, look at the source code:
  select: function() {
var args = $A(arguments), element = $(args.shift());
return Selector.findChildElements(element, args);
  },
the select method is only a wrapper of the
Selector.findChildElements, and with different selector context. For
the css selecting rule as same with the css with $$, make it to be
complex is not a good idea.

On Oct 17, 10:47 pm, kangax [EMAIL PROTECTED] wrote:
 I recently stumbled upon a href=http://dev.rubyonrails.org/ticket/
 9465this ticket/a

 In a nutshell, element.select('  foo') does not return the correct
 result while element.select('foo') does.

 I understand that combinator selector should be defined between two
 simple ones (so it's not quite a valid expression), but the question
 is do we want to allow this kind of thing? Is it an edge case? Should
 we make this work or just fall back to an alternative way?

 i.e. element.childElements().map(function(el){ return
 el.match('foo') })

 Best,
 kangax


--~--~-~--~~~---~--~~
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: combinator selectors in Element#select

2007-10-17 Thread Mislav Marohnić
On 10/17/07, kangax [EMAIL PROTECTED] wrote:


 In a nutshell, element.select('  foo') does not return the correct
 result


+1 for fixing it, regardless of the fact it may not be a valid selector ...
it's a valid fragment of a selector.

I want to be able to select immediate descendants this way. Do others feel
the same?

--~--~-~--~~~---~--~~
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: combinator selectors in Element#select

2007-10-17 Thread Andrew Dupont

I'm not crazy about it. Deviations from the CSS3 spec are troublesome
because they're not discoverable and they violate POLS. If we're going
to go down that slippery slope, selector.js will get even larger than
it already has.

The extended Enumerable#grep semantics in 1.6 make kangax's
alternative code shorter:

var matches = element.childElements().grep(new Selector('.foo'));

Anything that has a match method can now be used as a filter.

Cheers,
Andrew

On Oct 17, 10:17 am, Mislav Marohnić [EMAIL PROTECTED]
wrote:
 On 10/17/07, kangax [EMAIL PROTECTED] wrote:



  In a nutshell, element.select('  foo') does not return the correct
  result

 +1 for fixing it, regardless of the fact it may not be a valid selector ...
 it's a valid fragment of a selector.

 I want to be able to select immediate descendants this way. Do others feel
 the same?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---