You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d174cdf
Browse filesBrowse the repository at this point in the historyBrowse files
perf(css): drop a fallback every browserslist target reads past (#22158)
* perf(css): drop a fallback every browserslist target reads past
A declaration is a fallback only for an engine that cannot read the one
after it. `removeDeadRules` had no way to ask which engines those are, so
it dropped an earlier declaration only where the later one restated it —
identical text, a number in the same unit, a hex for a hex, an old color
name. Everything else was kept, including a hex standing before an
`oklch()` on a target that reads every color function there is.
`collectValueSupport` derives the missing answer from the compat data
already in the tree: a color function by its own name, and a property's
keyword as `property keyword`, taken only where BCD gives the construct a
row of its own — a parent's row answers for what was filed under it, not
for a name it never mentions, which is why `canvastext` is absent rather
than dated by its ancient `<system-color>` parent. The table is packed as
one string and unpacked on the first lookup a build makes, which costs
3.7x less than the `Map` literal and nothing at all to a build that never
asks.
Reading it is `_valueReadByTarget`, and it answers only for a value whose
every construct it can name: a bare keyword, or one color function over
numbers and named colors. Anything else — a relative color, a mix naming
its space, a `color()` naming a predefined one — stays unknown, so the
declaration before it stands. With no browserslist selection there are no
engines to name and nothing changes.
* test(css): cover the value-support reader where the minimizer's worker hides it
`minimize-dead-fallbacks` drives `_valueReadByTarget`'s whole call branch,
but the minimizer runs it inside the worker pool, where coverage cannot
follow — the integration flag reports 16.27% of the diff against the unit
flag's 80.76%, so the branch reads as untested.
Cover it from `CssSyntax.unittest.js`, which runs the printer in process:
one case per argument kind it can name and per kind it cannot, both sides
of the target gate, and the empty call whose guard is load-bearing —
without it an invalid `light-dark()` would drop the declaration before it.
`collectValueSupport` takes the BCD property tree as a defaulted argument,
as `collectLaterColorNames` and `collectColorFunctions` already do, so a
stub can drive the grammar filter (`is_transitionable` is no value of
`display`) and the row-less tree its throw names.
* fix(css): keep a fallback where the selection names an uncovered browser
`_useBrowsers` skips a browserslist name no compat dataset answers for —
`op_mini`, `and_uc`, `and_qq`, `baidu`, `kaios`, `bb` — so a selection
naming one alongside a covered browser was answered for in part. With
`chrome 130, op_mini all`, `_readsAll` consulted Chrome alone and dropped
the hex before a `lab()`, leaving Opera Mini nothing it can read. Reported
by CodeRabbit on #22158 and reproduced before fixing.
The skip itself is right for prefixes and wrong here, and the two want
opposite answers: reaching for a spelling an uncovered browser may not
read costs it nothing, while taking away the declaration before one takes
away the only spelling it had. So the skip is noted rather than only
taken, and `_valueReadByTarget` declines for the whole selection when any
of it went unanswered; prefixing is left exactly as it was.
0 commit comments