Skip to content

Preserve lazy hover state across document switches - #207

Merged
jdalton merged 1 commit into
dperini:masterfrom
jdalton:perf/lazy-hover
Sep 7, 2026
Merged

jdalton merged 1 commit into
dperini:masterfrom
jdalton:perf/lazy-hover

Conversation

@jdalton

@jdalton jdalton commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

After an engine queries a second document, hover events from the first document can overwrite the active document's state. Keep lazy hover tracking per document, restore that state on document switches, and read native hover state that predates listener setup.

Use weak document records when WeakMap is available. Legacy hosts retain only the current document's record and reuse stable callbacks to avoid duplicate listeners. Preserve the lazy-registration and repeated-query assertions from #209, and add host-state, document-switching, background-event, and legacy-host regressions. The browser manifest retains the existing compound-negation fixture.

Validation after rebasing onto #206: 557 Node tests, 19 focused hover/descendant tests, and 56 browser tests pass. Formatting, lint, types, repository checks, and combined coverage pass. Combined coverage is 85.02% statements, 75.64% branches, 84.39% functions, and 83.83% lines. The packed-package check passed 22 tests before the rebase.

@jdalton
jdalton force-pushed the perf/lazy-hover branch 5 times, most recently from 28f0c22 to 7f8fc69 Compare September 7, 2026 15:02
@jdalton jdalton changed the title Install hover tracking on demand Preserve lazy hover state across document switches Sep 7, 2026
@jdalton
jdalton merged commit 947d9dd into dperini:master Sep 7, 2026
jdalton added a commit that referenced this pull request Sep 17, 2026
Consolidated commits:
- adba43d Evict from the resolver caches without Map.delete (#185)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- 17a7467 Add opt-in legacy DOM reads and regression coverage (#203)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- 47bad6d perf: streamline resolver execution, query plans and DOM reads
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- 341d50a Validate logical selector arguments before candidate matching
  Original author: jdalton <john.david.dalton@gmail.com>
- f74aaaa fix(selectors): defer hover tracking and integrate selector tests (#209)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- 9dcf18c perf(selectors): route simple descendant chains through scoped lookups (#206)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- 131347f fix(selectors): isolate lazy hover state by document (#207)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
- abdbc83 perf(selectors): filter candidates before ancestor traversal (#189)
  Original author: John-David Dalton <jdalton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant