Re:CSS4 Preview – Selectors
by chrisbroadfoot on Tuesday March 06, 2012 @07:18PM
(#3673606)
Right. I get it. Basically an infix notation. Seems inconsistent with the rest of CSS.
Well every other operator is infix, so it's not really that inconsistent. " " (space) selectes descendents, ">" selects children, "+" selectes next-siblings and so on. The weird feeling of "/{attr}/" is probably just that the operator is variabel on the name of the attribute, which can't be avoided by any syntax (given that is part of the needed semantics).
> Seems inconsistent with the rest of CSS.
Not really, although it's a bit weird the `//` operator is a relation (like the space, or `>`). It "just" works sideways (and potentially upwards) instead of selecting strictly downwards.
The syntax uses the id named in the for-attribute to connect with the element with the same id.