Avoid restyling entire parent subtrees for changes that only affect a
child or sibling selector. Skip unrelated class changes, cache selector
dependencies, and avoid searching sibling subtrees that cannot match.
This improves typing performance on Gitea.
Track attribute names and class tokens used by relative selectors. Check classes before and after attribute updates so removing a watched class still invalidates its anchors, while unrelated changes avoid broad subtree restyles.
Preserve conservative handling of implicit pseudo-class attribute dependencies and explicit attribute selectors. Validated with a full build, runtime restyle counts, and 22 correctness checks.
Track state dependencies inside relative selectors to avoid restyling for unrelated state changes. Restrict parent dependency markers to sibling selectors while preserving outer sibling invalidation, and limit simple child and sibling searches to their candidate elements.