Re: selector negation (was Re: New version of the Selectors moduleofCSS3)

 | On Mon, 16 Oct 2000, fantasai wrote:
 | > 
 | > Defining $ as equivalent to :subject.
 | > $ by itself means $*
 | > The default $ subject is the last simple selector in a complex pattern.
 | > 
 | > Redefining X:matches(Y) to mean any X that matches the Y pattern where
 | > Y is given as a CSS selector.
 | >
 | > This way you only have to learn how to match against one set of rules;
 | > standard CSS selectors.
 | 
 | So 
 | 
 |    $A > B
 | 
 | ...is directly equivalent to:
 | 
 |    A:matches( $ > B ) 
 | 
 | ...?
 | 
 | All you've done is changed Daniel's '#' into a '$' and allowed it outside
 | the :matches() pseudo-class...

Well, yes, I've done that, but I also changed the meaning of the pattern
within the parentheses.

From your proposal 
(http://lists.w3.org/Archives/Public/www-style/1999Nov/0241.html):
 >    Proposed syntax:  x:matches(y)
 >    WD syntax:        x:subject y
 >    matches:          <x MATCHED> <z> <y/> </z> </x>

In the syntax I've described, x:matches(y) wouldn't match anything.

I wrote:
 > Redefining X:matches(Y) to mean any X that matches the Y pattern where
 > Y is given as a CSS selector.

Thus, to use :matches for the above situation, you would have to put
  x:matches($ y)

:matches() in this context takes the intersection of the set defined in the
parentheses and the set defined by the simple selector it's modifying.

In 'x:matches(y)', the intersection of 'x' & 'y' is the empty set - 
  'x' matches any element <x>.
  'y' matches any element <y>.
  You cannot find an element that matches both conditions.

For 'x:matches($ y)' - 
  'x' matches any element <x>
  '$ y' matches any element with a descendant of <y>.
  An element in the pattern <x> <z> <y/> </z> </x> will satisfy both
  conditions.

Received on Monday, 16 October 2000 15:27:18 UTC