- From: fantasai <fantasai@escape.com>
- Date: Fri, 03 May 2002 20:28:12 -0400
- To: www-style@w3.org
Ian Hickson wrote: | | There have basically been three proposals over the years. Here | is a brief description of each (yes, there are four listed | below -- the last two are both variations on :matches()): | | :subject and (...) ... | <, - ... | :matches() ... | :matches() and :has() There was also a later variation [1] on :matches() -- $ and :matches() - A $ in front of a simple selector sequence indicates the subject of the selector. By default the last sequence is the subject. - $ by itself means $* - X:matches(Y) means any X that matches the Y pattern where Y is given as a CSS selector. Advantages: 1. Reuses existing idioms. 2. Very simple conceptual model. 3. Can be used to to make almost any selector imaginable, so it won't need to be extended with each subsequent vesion of the spec. 4. Parsing and processing code for the main selector can be reused to handle the :matches() argument. 5. The most common cases are easy to write. 6. A partial implementation of just $ will suffice for most needs. 7. Reads better: .section > $div > code One can see the selector as mapping unbroken path through the tree, branching only when selectors _need_ to branch off. .section > :matches(h1,h2,h3,h4,h5,h6) + $div > code The nature of the pattern is thus clearer and more easily grasped. (This is more important than forcing the subject last.) 8. And if you want it last, you can have it last: .section > div:matches($ > span) Disadvantages: 1. Costly in a dynamic environment, a disadvantage which is common to them all. ~fantasai [1] fantasai. "Re: selector negation (was Re: New version of the Selectors moduleof CSS3)", www-style@w3.org (October 16, 2000). message-id: <39EB3094.796229EC@escape.com> http://lists.w3.org/Archives/Public/www-style/2000Oct/0182.html
Received on Friday, 3 May 2002 20:24:42 UTC