Skip to content

Scope-match a selectors string including a pseudo-element selector #1497

Description

@cdoublev

What is the issue with the DOM Standard?

Quoting @tabatkins in #185:

querySelector() does need to pass an empty list of allowed pseudo-elements, tho, since otherwise you get nonsensical results (there's no way to reflect a pseudo-element as a JS object right now).

Indeed, querySelector() and querySelectorAll() invoke scope-match a selectors string with a selector and the element, but without an empty list of allowed pseudo-elements. Then scope-match a selectors string invokes match a selector against a tree without this empty list, which is defaulted to a list of all pseudo-elements in match a selector against a tree:

[APIs using this algorithm] may optionally provide:

  • A list of pseudo-elements that are allowed to show up in the match list. If not specified, this defaults to allowing all pseudo-elements.

So I wonder if:

  1. the procedures for querySelector() and querySelectorAll() should invoke scope-match a selectors string with an empty list of allowed pseudo-elements
  2. scope-match a selectors string should always invoke match a tree against selector with an empty list of allowed pseudo-elements
  3. match a selector against a tree should default to an empty list of allowed pseudo-elements
  4. the WHATWG and CSSWG do not want to make a change because there is a plan to return pseudo-elements from querySelector() and querySelectorAll() in the future

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions