Skip to content

normalizeStrayBreaks: deferred robustness follow-ups (null-guard consistency, malformed-nesting note) #20

Description

@mriechers

Description

Two low-priority robustness follow-ups on the new normalizeStrayBreaks formatter function, both deferred (non-blocking) by the feature's code review.

Context

  • Discovered during session on 2026-06-24 (PR Formatter: prettyhtml.com parity + stray line-break normalization #18, stray-break feature)
  • (a) Unguarded checkbox read: the Tidy handler reads document.getElementById('opt-stray-breaks').checked with no null guard. This matches the existing convention for every other option read in the same handler (all bare .checked), and the element is statically present in index.html — so it's a consistency note, not a live bug. Worth addressing only if the handler's option-reads are hardened as a group.
  • (b) Malformed/unclosed nesting: in normalizeStrayBreaks Pass A, a mismatched closing tag (e.g. <div><p>text</div>) leaves the block stack unpopped, so a following body-level <br> is misclassified as inside a block. The spec assumes well-formed input; it degrades gracefully (passes the <br> through verbatim, no crash). A short "assumes well-formed input" comment would prevent future confusion; full malformed-input handling is out of scope.

Notes

  • Created by /wrap-up during session review.
  • Both items were triaged as fine-to-defer by the per-task and final whole-feature reviews.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions