mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Instead of doing a full document style invalidation when a stylesheet is dynamically added, we now analyze the new sheet's selectors to determine which elements could potentially be affected, and only invalidate those. This works by building an InvalidationSet from the rightmost compound selector (the "subject") of each rule in the new stylesheet, extracting class, ID, tag name, attribute, and pseudo-class features. We then walk the DOM tree and only mark elements matching those features as needing a style update. If any selector has a rightmost compound that is purely universal (no identifying features), or uses a pseudo-class not supported by the invalidation set matching logic, we fall back to full invalidation.
14 lines
298 B
Plaintext
14 lines
298 B
Plaintext
PASS: class selector
|
|
PASS: id selector
|
|
PASS: tag selector
|
|
PASS: attr selector
|
|
PASS: compound selector
|
|
PASS: descendant selector
|
|
PASS: multi selector
|
|
PASS: link pseudo-class
|
|
PASS: multi-rule sheet
|
|
PASS: :has() as sole feature
|
|
PASS: :has() with class
|
|
PASS: :has() with direct child
|
|
PASS: empty sheet
|