RE: Selector Readabiliitiy [sic]

After thinking it over, I decided I preferred David's proposal over my own 
with respect to the first and last pseudo classes.  Any earlier message 
between he and I showed me how the -child or -sibling becomes confusing 
because it is unclear with respect to what. In contrast P:first means the 
first P of it's siblings, which seems much more straight forward (to me, at 
least for the moment).

Below I have reposted my own proposal, sans pseudo-classes. While strongly 
related, it seems best to keep them as separate proposals for the moment. 
(Sorry for the wasted bandwidth. If I could have pulled my previous 
message, I would have.)

------------------------------------------------
Selector syntax revision proposal for sibling and child relationships 
(second revision)
------------------------------------------------

To refer to an child (immediate descendant), place the '~' between the 
parent selector and the child selector. For example:
   DIV.sect ~ P {...}
would refer to any immediate P child of a DIV with class "sect". This 
should refer to the first, second, fifth, and sixth P, but not the third or 
forth P:
   <DIV class="sect">
      <H3>Section Title</H3>
      <P>first</P>
      <P>second</P>
      <OBJECT>
         <P>third</P>
         <P>forth</P>
      </OBJECT>
      <P>fifth</P>
      <P>sixth</P>
   </DIV>

To refer to any following sibling, place the '|' between the leading 
selector and the following sibling selector. For example:
   OBJECT | P {...}
would refer any sibling P after an OBJECT, which is both the fifth and 
sixth P's in the previous example HTML. I'm not going to say whether this 
is necessary, however I include because it keeps the mean of the operators 
consistent.

To refer and immediate sibling, place both the '|' and the '~' between the 
two selector in either order. For example:
   H3 ~| P {...}
or
   H3 |~ P {...}
both refer to the first sibling following a H3 only if it is a P element. 
The first P meets these requirements in the above HTML.

For both operators, whitespace on either side of the operator is optional. 
For example:
   H3~|P{...}
and
   H3 ~ | P { ... }
are both legal and equivalent.


------------------------------------------------

It should be noted that David's proposal maintains the ability to refer to 
a generic first element, as I pointed out in my previous message.
   OBJECT ~ :first {...}

Andrew n marshall
  student - artist - programmer
    http://www.media-electronica.com/anm-bin/anm
      "Everyone a mentor,  Everyone a pupil"

Received on Friday, 5 December 1997 03:12:28 UTC