[jQuery] How should :nth-of-type work?

2006-10-03 Thread George Adamson

Just canvassing opinions on the :nth-of-type() selector that is in now being
tested in the  http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
Selectors Plugin  (plus other ...-of-type selectors).

At face value it would 
http://www.nabble.com/nth-of-type-not-working-in-some-cases-tf2356344.html#a6571942
appear to be the same as :eq()  but I think there's more to it...

In a JQuery set containing 3 DIVs and 3 SPANs (#div0, #div1, #div2, #span0,
#span1 #span2),
I would expect :eq(1) to return only div1, but :nth-of-type(1) to return
div1 and span1.
Does this seem correct to you?

Taking it a step further, if the set also contains another 3 DIVs (#divX,
#divY, and #divZ) that are not siblings of div0,1,2 (ie they have different
parents) then my current implementation of :nth-of-type(1) will return div1,
span1 and divY. I think I've done it wrong. Should it still return only div1
and span1? I think I've done :nth-sibling-of-type() by mistake!

Thanks for you help,

George




-- 
View this message in context: 
http://www.nabble.com/How-should-%3Anth-of-type-work--tf2375279.html#a6617459
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How should :nth-of-type work?

2006-10-03 Thread Jörn Zaefferer
George Adamson schrieb:
 Just canvassing opinions on the :nth-of-type() selector that is in now being
 tested in the  http://www.softwareunity.com/sandbox/JQueryMoreSelectors/
 Selectors Plugin  (plus other ...-of-type selectors).
   
Do you have an example at hand where this selector is actaully useful?

-- Jörn

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How should :nth-of-type work?

2006-10-03 Thread George Adamson

Good point J?rn, thank you. (I've not found a good use for :nth-of-type()
myself, but someome will!)

More interesting as it turns out, is the :nth-sibling-of-type() selector
that I created accidentally...
It turns out to be a simple way of returning TD elements in the same column
of a table.

Here are two examples on a form and a table:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/nth-of-type/

Original test page is here:
http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

George


J?rn Zaefferer wrote:
 
 Do you have an example at hand where this selector is actaully useful?
 
 -- J?rn
 

-- 
View this message in context: 
http://www.nabble.com/How-should-%3Anth-of-type-work--tf2375279.html#a6621407
Sent from the JQuery mailing list archive at Nabble.com.


___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


Re: [jQuery] How should :nth-of-type work?

2006-10-03 Thread John Resig
I use to have all the *type selectors implemented, but after a quick
survery I couldn't find anyone who actually used them (and who
could've just used :nth-child() instead). Although, its' probably a
good idea to have these in an external plugin, for completeness, in
case anyone wants them. Good work George.

--John

 Good point J?rn, thank you. (I've not found a good use for :nth-of-type()
 myself, but someome will!)

 More interesting as it turns out, is the :nth-sibling-of-type() selector
 that I created accidentally...
 It turns out to be a simple way of returning TD elements in the same column
 of a table.

 Here are two examples on a form and a table:
 http://www.softwareunity.com/sandbox/JQueryMoreSelectors/nth-of-type/

 Original test page is here:
 http://www.softwareunity.com/sandbox/JQueryMoreSelectors/

___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/