[selectors4] Consider :has() instead of the subject indicator

Hi,

I’d like that we consider removing the subject indicator and adding an 
:has() pseudo-class (described below) instead. Reasons include:

* "!" suggests a "boolean negation" meaning that the subject indicator 
doesn’t have.
* :has() already exists in hitchjs and (in limited form) in jQuery.
* IMO having a name is preferable to assigning arbitrary meaning to 
ASCII characters, and worth the verbosity.
* This resolves the issue of whether to append or prepend the indicator.
* Assuming :matches() exists, I believe they’re equal in power.
* The performance concerns are the same.


:has()
------

:has(), is a functional pseudo-class taking a list of <a>relative 
selectors</a> as its argument. It represents an element such that its 
argument represents anything with the element as the <a>scoping root</a>.

Example: div:has(p) represents a <div> element that has at least one <p> 
descendant element.

Example: div:has(> p) represents a <div> element that has at least one 
<p> child element.

:has() is not allowed in the <a>fast profile</a>.

The specificity of :has() is calculated like :matches().


-- 
Simon Sapin

Received on Thursday, 16 January 2014 16:35:27 UTC