Files
hyperframes/packages
Michael Wang 435dd0e685 fix(producer): bound the static media selector check by the page it walks (#8091)
* fix(producer): bound the static media selector check by the page it walks

The pre-check matched every script selector against each media element and
bounded the work by selector length alone. A selector such as :has(...),
a positional pseudo-class or a chain of descendant combinators can walk the
whole page on each match, so the check could block the render process.

Only tags, ids, classes and attributes joined by child combinators and at
most one descendant combinator are now matched statically. Each check is
charged for the media element's ancestors and their attribute text, and
everything else is left to the browser probe.

* fix(producer): charge each selector's full text and every simple test

The selector check charged the collapsed selector shape, so a long
attribute value or whitespace run was nearly free even though the matcher
compiles the whole selector on every call. Each media element is now
charged the raw selector length per ancestor. Attribute text is charged per
simple test rather than per compound, and it is measured only once a
non-id selector needs costing.

* style(producer): shorten the selector cost comment
2026-11-17 20:26:56 +00:00
..
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00
2026-11-17 18:25:31 +00:00