Skip to content

Commit b76132d

Browse files
committed
[selectors-4] Whoops I wrote an essay about the ::-webkit- quirk.
1 parent 2940a79 commit b76132d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

selectors-4/Overview.bs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3808,6 +3808,59 @@ Appendix B: Obsolete but Required Parsing Quirks for Web Compat</h2>
38083808
These otherwise-unsupported pseudo-elements
38093809
must be serialized in ASCII lowercase.
38103810

3811+
<details class=note>
3812+
<summary>What's this quirk about?</summary>
3813+
3814+
Selectors have long had a behavior
3815+
where a single unknown/invalid selector
3816+
invalidates the entire selector list
3817+
(rather than just invaliding the one complex selector it finds itself in).
3818+
This is generally considered a legacy mistake by the WG,
3819+
but can't be fixed at this point,
3820+
as too many stylesheets depend on this behavior,
3821+
intentionally or not.
3822+
3823+
One aspect of this is that any use of vendor-specific selectors,
3824+
which are generally not recognized by other User Agents,
3825+
invalidate the entire selector,
3826+
and take the entire style rule down with them.
3827+
This has been used intentionally in the past--
3828+
in the severely not-recommended practice of hiding style rules from some browsers
3829+
by making them invalid in every other browser--
3830+
and unintentionally,
3831+
with people styling an element
3832+
and also applying those styles to a vendor-specific pseudo-element
3833+
(such as the various <{input}>-related pseudos some browsers expose),
3834+
not realizing that this hides the entire rule from other browsers.
3835+
3836+
In addition to this more general reasoning,
3837+
WebKit-derived user agents,
3838+
such as Safari or Chrome,
3839+
have an additional quirk related to their vendor-prefixed pseudo-elements,
3840+
where any <css>::-webkit-</css>-prefixed selectors is considered valid at parse time.
3841+
(This is probably a leftover quirk of an early CSS feature,
3842+
since dropped,
3843+
that intentionally treated all possible pseudo-elements as valid at parse time,
3844+
in anticipation of a feature letting authors define their own pseudo-elements.)
3845+
3846+
Similar to other legacy quirks,
3847+
such as those documented in [[QUIRKS]],
3848+
this particular vendor-specific oddity has become common enough
3849+
that other user agents are seeing sites breaking due to them depending on it,
3850+
accidentally or not.
3851+
As such, since the quirk is thus,
3852+
in practical terms,
3853+
required to render the modern web correctly,
3854+
specifying it and requiring it for all user agents
3855+
ensures that today's web pages are more likely to be correctly rendered
3856+
in user agents both current and future.
3857+
3858+
As usual with quirks, however,
3859+
webpages intentionally relying on this
3860+
will be met with shaming and derision from members of the CSSWG,
3861+
and all right-thinking web developers.
3862+
</details>
3863+
38113864

38123865
<h2 id="changes">
38133866
Changes</h2>

0 commit comments

Comments
 (0)