Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


CSS4 selector subject support #236

kraih opened this Issue · 11 comments

6 participants

Sebastian Riedel Glen Hinkle Marcus Ramberg Magnus Holm Dimitar Petrov Maurice
Sebastian Riedel

Once the CSS4 selector spec becomes more stable, i think we should add selector subject support to Mojo::DOM::CSS again.

A previous attempt had to be aborted since the exact semantics are not clear yet, but many of the implementation details should be reusable.


Glen Hinkle


Sebastian Riedel

They better hurry up with the spec, this is so useful.

Marcus Ramberg

Editor's Draft 3 was released January 2012

Sebastian Riedel

Looks like semantics and syntax did not change this time, lets hope it stays that way.

Magnus Holm

One thing that the spec doesn't clarify:

<div id="toc"></div>

?p ~ #toc can either:

  1. Work like p ~ #toc, but instead of returning #toc it follows the parent-chain and returns one of the p's instead.
  2. Return both p's.

I think that the second option makes more sense, but it's quite a lot harder to implement.

Sebastian Riedel

The spec seems pretty clear about that actually, it can only be 1.

Although the element structure that the selector represents is the same with or without the exclamation mark, indicating the subject in this way can change which compound selector represents the subject in that structure.

Dimitar Petrov

Editor's Draft 4 released 15 October 2012


Selectors Level 4, Editor's Draft 13 May 2013
W3C Working Draft 2 May 2013

Sebastian Riedel

Interesting change in the spec, a selector can now have multiple subjects.

!div > !p.warning
Sebastian Riedel

Looks like subject selectors have been replaced with the :has() pseudo-class now.

Sebastian Riedel

The spec is still changing so much, i don't think we can really plan ahead.

Sebastian Riedel kraih closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.