Skip to content

[selectors] webkit-prefixed pseudo-elements are always treated valid in WebKit and Blink #2156

@upsuper

Description

@upsuper

There is a webcompat issue raised against Firefox that Firefox treats rules like the following invalid which breaks some websites:

.promagnifier, .prosettings, .searchsettings, 
.search input[type=search]::-webkit-search-decoration,
.search input[type=search]::-webkit-search-cancel-button,
.search input[type=search]::-webkit-search-results-button,
.search input[type=search]::-webkit-search-results-decoration { 
      display: none !important; }

This is a reasonable behavior since Firefox doesn't support those webkit-prefixed pseudo-elements, and thus, according to the spec, it should treat the whole selector list invalid.

However, at least Blink only supports -webkit-search-cancel-button, and doesn't support any other pseudo-element here either, but it doesn't treat the rule invalid.

Then I did some test and I realized that in Blink and WebKit, all pseudo-element prefixed with -webkit- is treated valid, as can be shown with the following testcase:

<!DOCTYPE html>
<style>
div {
  width: 100px; height: 100px;
  background: red;
}
div::-webkit-something-invalid-12345, div {
  background: green;
}
</style>
<div></div>
<script>
  alert(document.styleSheets[0].cssRules[1].cssText);
</script>

I'm not sure what should we do, then.

Should we spec this behavior that any webkit-prefixed pseudo-element should be accepted even if it's unknown? Or should we push WebKit and Blink to change their behavior here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions