Re: Selectors in jQuery

Philip TAYLOR wrote:
>
>
> Andrew Fedoniouk wrote:
>
>> :has-child     - element has single child.
>> :has-children  - element has at least one child.
>
>> E:has-child-of-type(T) - matches element that has precisely one
>>               immediate child of type T.
>> E:has-children-of-type(T) - matches element that has one or more
>>               immediate children of type T.
>
> Slightly worried about the ambiguity of these names --
>
> if I have one or more children, then I "have child".
> if I have more than one child, then I "have children".
Yeah, the names are probably not that good...

Intention was to define: only-one and at-least-one predicates.
Similar to '?' and '*' constructions in regular expressions.

When :have-children is true then :have-child is true too.
Have-more-than-one-child condition can be written as
:have-children:not(:have-child) which is, I agree, looks
ugly.

Any ideas of how to name them properly?

:only-one-child, :at-least-one-child,
:only-one-child-of-type(T), :at-least-one-child-of-type(T)
are a bit "noisy", isn't it?

>
> You seem to be using these with the reverse semantics.
>
> Philip TAYLOR
>

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Thursday, 9 October 2008 18:26:31 UTC