[selectors] Validity of pseudo-elements per context

We don't define anywhere what pseudo-elements the DOM methods accepting
a selector are allowed to use.

For example, IIRC they can only return elements, so any selectors that
use most pseudo-elements should be invalid. E.g. ::selection, ::before,
::first-letter, etc. should all be invalid.

However, we might want that using ::shadow or ::content as a combinator
is valid, so that
   ::shadow
is either invalid or returns nothing but
   ::shadow div
is valid and returns <div> descendants of any shadow trees.

I think this should be done by DOM specifying what it accepts rather
than Selectors defining what DOM should accept. So

1. We need to decide whether .query("::shadow") is throws SyntaxError
    or returns nothing.

2. We need edits saying that the various DOM methods support all selectors
    in the Selectors 4 module plus the selectors in the CSS Scoping Module
    (or not), and nothing that no other pseudo-elements (e.g. those in
    Selectors 3) are valid. Probably this text should go in DOM, but could
    go into Selectors 4 (+ CSS Scoping) if necessary.

~fantasai

Received on Thursday, 27 August 2015 01:08:52 UTC