Skip to content

--computed follow-ups: clean snapshot errors, size-aware collapse, hidden pseudo-elements - #34

Merged
tmashara merged 1 commit into
mainfrom
claude/computed-followups
Oct 29, 2026
Merged

tmashara merged 1 commit into
mainfrom
claude/computed-followups

Conversation

@tmashara

Copy link
Copy Markdown
Owner

Follow-ups from the re-review of --computed (#30).

  • Snapshot errors (pageError in src/computed.ts, used by src/run.ts): a page throw keeps only its text after the first Error: , first line, so computedError, the progress line, the summary and the report no longer carry page.evaluate's stack. A message with no Error: (e.g. a selector timeout with its call log) is kept whole. Tested with a real Playwright evaluate error string.
  • Size-aware collapse: the walk records each element's specified width/height from computedStyleMap() (auto, 100%, 200px; em/rem/vw come back as px). collapseInherited keeps a box whose own size is px on either side (a child widened inside an inline-block is no longer dropped in favour of the span), and a % height child gives way to its px-height parent (a height:100% child no longer hides the parent's own change). In an auto-height parent a % child is treated as auto, so one of the two heights always remains. Without computedStyleMap (other browsers) the old behaviour holds. Measured cost: ~19ms on a 51k-element page.
  • Hidden hosts: an element going display: none no longer adds a ::before/::after content finding.
  • Docs (docs/output.md): a wrapper's class change re-keys its subtree, so style changes under it show only as dom differs / unmatched; dom counts a re-keyed element once per side; the new collapse rules.

Known, not changed: calc(100% - Npx) heights count as %; a fixed-width child squeezed by its parent (max-width, flex-shrink) is now kept beside the parent's change.

🤖 Generated with Claude Code

…dden pseudo-elements

- A failed snapshot keeps only the page's message, not page.evaluate's
  prefix and stack.
- The walk records each element's specified width and height; a box whose
  own size is set is never collapsed away, and a height: 100% child gives
  way to the parent it follows.
- An element going display: none no longer adds a ::before/::after finding.
- docs: a wrapper's class change re-keys its subtree; dom counts a re-keyed
  element once per side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmashara
tmashara merged commit 8884e54 into main Oct 29, 2026
3 checks passed
@tmashara tmashara mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant