fix(html/formatter): preserve closing > before self-closing elements#9333
fix(html/formatter): preserve closing > before self-closing elements#9333terror wants to merge 1 commit intobiomejs:mainfrom
> before self-closing elements#9333Conversation
🦋 Changeset detectedLatest commit: ab2948e The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Exclude self-closing elements from the token borrowing pattern by only setting next_is_adjacent_inline when the next element is an HtmlElement.
eb58e58 to
ab2948e
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughIntroduces a stricter borrowing check Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #9310.
When an inline element like
<code>is immediately followed by a self-closing element like<br>, theformatter's token borrowing pattern would steal the closing
>from</code>to pass to the nextsibling. But self-closing elements (
<br>,<img>, etc.) can't accept borrowed tokens informat_element_with_borrowing, so the>was silently dropped:The fix excludes self-closing elements from the borrowing pattern by only setting
next_is_adjacent_inlinewhen the next element is anHtmlElement(which has opening/closing tags).Test Plan
inline-before-self-closing.htmlsnapshot test covering<code>,<span>,<b>, and<a>followed by
<br>and<img>.Docs
No docs changes needed.