css2 - 6.4/5/6 Contextual selectors

Bravo to the authors for addressing finer contexts for contextual
selectors[1]. But rather then dividing these into separate sections,
shouldn't '6.4 Contextual selectors' be subdivided into '6.4.1 Ancestral
selectors' and '6.4.2 Sequential selectors'?

Also, I find the syntax for sequential selectors and the context-relative
meaning of '~' to be confusing. It seems that the slashes constitute a kind
of bracketing mechanism and that the tilde is sort of an 'immediate
specificity-increaser', but that is not really clear from the draft. The
logic of the double-slash indicating first child eludes me also. Maybe this
is in part due to uncertainty as to whether 6.5 and 6.6 are mutually
exclusive. 6.6 would make more sense if there were no 6.5.

Would it not be easier to grok the syntax if the sequential selector were a
single '/' for "following" and '//' for "immediately following"? E.g.:

  H1 / P { ...       /* P following H1 */

  H1 // P { ...      /* P immediately following H1 */

  DIV ~ P { ...      /* P as any direct child of DIV

  DIV ~/ P {...      /* P as first direct child of DIV */

  DIV ~// P {...     /* P as immediately-following first child of DIV */


David Perrell

[1] http://www.w3.org/TR/WD-CSS2/selector.html#h-6.4

Received on Tuesday, 25 November 1997 17:45:35 UTC