W3C home > Mailing lists > Public > www-style@w3.org > January 2014

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

From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 16 Jan 2014 16:35:03 +0000
Message-ID: <52D80A37.7040702@exyr.org>
To: www-style@w3.org
CC: Brian Kardell <bkardell@gmail.com>
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

This archive was generated by hypermail 2.3.1 : Thursday, 16 January 2014 16:35:27 UTC