10BC0 [selectors-4] `x-pseudo-element` test is not documented in the selectors-4 spec · Issue #6826 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

[selectors-4] x-pseudo-element test is not documented in the selec A1CB tors-4 spec #6826

@jwmcglynn

Description

@jwmcglynn

web-platform-tests/wpt#12743 created a test with the description of "x-prefixed pseudo-elements should make the whole rule invalid".

It's attached to Section 3.6 Pseudo elements (see test table), however looking at the draft version of the spec, that behavior is not documented. In fact, the only time "x-" appears in the entire spec is for within the words "complex-" or "max-".

It looks like the spec needs to be updated, however as an aside I'd like to mention that this change seems a bit weird. Looking at the pull request that added the test and the attached webkit bug, I don't see any discussion about why the behavior was added. Adding context would be helpful, since this seems like something that could be considered a breaking change for some parsers.

For context, here is the type of selector this test asserts to be invalid:

::x-something-nobody-would-think-of, p {
  color: red;
}

Slightly later in the spec, in 3.9 Invalid Selectors and Error Handling, it states that "a selector list containing an invalid selector is invalid", however in 3.6 there is a line stating that "The host language defines which pseudo-elements exist".

This makes sense, I saw discussion in another bug about how "::-webkit"-prefixed pseudo elements are only supported on webkit and invalidate the whole selector on other UAs. I think the wording can be improved by updating the text to say something along the lines of

The host language and UAs defines which pseudo-elements exist [...]. If a pseudo-element does not exist, the selector is invalid.

...

UAs must not implement support for pseudo-elements prefixed with x-, such as ::x-pseudo-element.

Now that I'm writing that, my expectation of that is actually the opposite. For HTTP headers prefixing them with "X-" makes them ignored by the UA, so that it may be used for custom metadata and consumed by scripts. Maybe the ::x- pseudo prefix could operate the same way, providing a mechanism for user-defined pseudo elements?

If I missed something please let me know, but I spent the last hour or two scouring so if it is documented. It was not discoverable for me and may be a reason to amend the spec 🙂

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0