Skip to content

Align selector invalidation plans with trigger-first runtime traversal #844

Description

@wieslawsoltes

Problem

The full selector contract exposed stale assertions for state pseudo-class invalidation on an ordinary non-subject compound. The assertions expected the compile-time dependency route itself to point from the changed trigger to the final selector subject.

The runtime contract deliberately separates those two steps:

  1. the invalidation plan identifies the compound whose state changed (invalidation_subject, plus invalidation_ancestors for inclusive states such as :target-within);
  2. recascade_selector_transition compares that trigger compound in the previous/current state and then visit_related_candidates follows the selector's remaining child, descendant, or sibling combinators to the final subject.

Adding forward routes to ordinary outer dependencies bypasses that separation, changes the anchor before comparison, and breaks structural invalidation such as .parent:empty + .target.

Fix

  • keep ordinary :link, :local-link, functional :local-link(...), and :target-within dependencies scoped to their changed trigger;
  • assert that these outer dependencies do not carry a second forward route;
  • retain reverse routes for dependencies inside relational selectors such as :has();
  • retain the existing runtime/WPT mutation gates that prove href, document URL, child, sibling, and relational subjects recascade correctly.

Acceptance

  • webscene_selector_parser_tests passes the complete invalidation-plan contract;
  • css-link-state-invalidation.html continues to cover href addition/removal across subject, sibling, and relational consumers;
  • css-local-link-invalidation.html continues to cover href, history URL, and effective-base changes;
  • no broad subtree fallback or additional idle work is introduced.

Activity

  1. added
    bugSomething isn't working
    vscode-oss/plannedPlanned for the AppScene/WebScene VS Code OSS integration
    on Sep 20, 2026
  2. changed the title [-]Route ordinary selector dependencies to their final subjects[/-] [+]Align selector invalidation plans with trigger-first runtime traversal[/+] on Sep 20, 2026
  3. added
    vscode-oss/mergedMerged for the AppScene/WebScene VS Code OSS integration
    and removed
    vscode-oss/plannedPlanned for the AppScene/WebScene VS Code OSS integration
    on Sep 20, 2026
  4. wieslawsoltes commented on Sep 20, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Implemented by merged PR #845. The full selector invalidation-plan contract and linked WPT mutation coverage passed before merge; closing this focused child while parent CSS epic #235 retains cumulative product acceptance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions