Skip to content

Use lol_html's on_end_tag convenience method - #137

Merged
gjtorikian merged 4 commits into
mainfrom
gjt/on-end-tag-convenience
May 3, 2026
Merged

Use lol_html's on_end_tag convenience method#137
gjtorikian merged 4 commits into
mainfrom
gjt/on-end-tag-convenience

Conversation

@gjtorikian

Copy link
Copy Markdown
Owner

Summary

  • Stacks on top of Bump lol_html from 2.7.2 to 2.8.1 #136 (lol_html 2.8.1 bump).
  • Replaces three el.end_tag_handlers().unwrap().push(Box::new(...)) call sites in rewriter.rs and sanitizer.rs with the new Element::on_end_tag convenience added in lol_html 2.8.
  • The user-facing dispatch in process_element_handlers now surfaces lol_html's "<tag> can't have content" error as a magnus RuntimeError instead of panicking via .unwrap(). The two internal call sites continue to swallow the void-element case to preserve prior behavior (selma's self_closing table and lol_html's void-element list don't fully overlap — e.g. SVG <path>).

Test plan

  • bundle exec rake compile
  • bundle exec rake test — 201 runs, 975 assertions, 0 failures

lol_html 2.8 added Element::on_end_tag, which collapses
end_tag_handlers().unwrap().push(Box::new(...)) into a single call
and surfaces a typed error for void elements instead of panicking.

Replaces the three call sites in the rewriter and sanitizer. Two of
them silently ignore the void-element error to preserve the previous
behavior (selma's self_closing list and lol_html's void list don't
fully overlap, e.g. SVG <path>); the user-facing on_end_tag dispatch
in process_element_handlers propagates the error as a magnus
RuntimeError so callers wiring on_end_tag to a void selector get a
clear message.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Base automatically changed from dependabot/cargo/lol_html-2.8.1 to main May 3, 2026 19:16
@gjtorikian
gjtorikian merged commit 6445b60 into main May 3, 2026
6 of 9 checks passed
@gjtorikian
gjtorikian deleted the gjt/on-end-tag-convenience branch May 3, 2026 19:32
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