[Prototype-core] Re: $$() and :nth psuedo-elements

2007-03-17 Thread Christophe Porteneuve

Hey Andrew,

Andrew Dupont a écrit :
 I'm frustrated at the ambiguity of the CSS3 spec on this issue.  See
 for yourself at (http://www.w3.org/TR/2001/CR-css3-selectors-2003/

OK, start by using the latest version, OK?

http://www.w3.org/TR/css3-selectors/

 #nth-child-pseudo). The spec says that a and b must be zero, negative
 integers or positive integers, but does not give any examples in
 which b is negative -- neither in the spec nor in the test suite.

It's much better expressed in the latest version.  For instance:

The value a can be negative, but only the positive values of an+b, for
n≥0, may represent an element in the document tree.

html|tr:nth-child(-n+6) represents the 6 first rows of XHTML tables

When the value b is negative, the + character in the expression must
be removed (it is effectively replaced by the - character indicating
the negative value of b).

:nth-child(10n-1)  represents the 9th, 19th, 29th, etc, element
 :nth-child(10n+9)  (same)
 :nth-child(10n+-1) (Syntactically invalid, and would be ignored)

Based on this, I'll review your latest parseNth today ;-)

-- 
Christophe Porteneuve a.k.a. TDD
[They] did not know it was impossible, so they did it. --Mark Twain
Email: [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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: $$() and :nth psuedo-elements

2007-03-17 Thread Andrew Dupont

This is what I came up with for the XPath version: http://pastie.caboo.se/47671

It's a direct port of the logic of parseNth (albeit not yet tested).
I'll look at yours and see if it makes more sense, though.

Cheers,
Andrew

On Mar 17, 4:51 pm, Trevan Richins [EMAIL PROTECTED] wrote:
 Andrew Dupont wrote:
  This site might be useful:http://gallery.theopalgroup.com/selectoracle/

  I'd found that site as well, but it seems to get stuff wrong. If I ask
  it to explain ulli:nth-child(n+2), it replies with:

 Wow, I didn't notice that one.

 The parseNth code looks better.  I'm wondering, though, how you are
 going to convert it to Xpath?  This is what I came up 
 with:http://pastie.caboo.se/47653.  It is similar to the patch I submitted in
 the original bug but is slightly more condensed.

 It first reduces the selection to the elements that fit the bth item
 from groups of a.  Then, in the resulting selection, it grabs the
 elements that have a position (in this new selection, not the original
 one) that are = b/a (for a  0) or = b/a (for a  0).

 Trevan


--~--~-~--~~~---~--~~
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: $$() and :nth psuedo-elements

2007-03-16 Thread Christophe Porteneuve

Hey Trevan,

Trevan Richins a écrit :
 The new version of $$() is wonderful but doesn't seem to work all that 
 well with the :nth psuedo-elements.  It looks to only work correctly 
 when in the formula an+b, a and b are positive and b  a.  I 
 don't know if anyone has noticed this yet, but I couldn't find a bug id 
 so I filled a new one and added a possible fix for it (as well as test 
 cases).  The bug is at: http://dev.rubyonrails.org/ticket/7841.

Thanks for the heads up.  It's possible, due to the code's freshness,
that there are still bugs.  The negative values, in particular, are very
likely not handled, although I'm surprised about the b  a thing.  I
(and Andrew, no doubt) will look into it ASAP.

As a small note, $$ does not implement any pseudo-element, but
pseudo-classes.  Pseudo-elements, as their name implies, do not select
*elements*.  They select fragments, or sometimes as-yet-empty locations
(:first-letter, :first-line, :before, :after, :selection).

-- 
Christophe Porteneuve a.k.a. TDD
[They] did not know it was impossible, so they did it. --Mark Twain
Email: [EMAIL PROTECTED]

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