Skip to content

HTML API: Limit leading newline serialization to HTML elements#45

Open
sirreal wants to merge 1 commit into
trunkfrom
html-api-fuzz-fiz/foreign-textarea
Open

HTML API: Limit leading newline serialization to HTML elements#45
sirreal wants to merge 1 commit into
trunkfrom
html-api-fuzz-fiz/foreign-textarea

Conversation

@sirreal

@sirreal sirreal commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Restrict the serializer leading-newline preservation rule for textarea, pre, and listing to tokens in the HTML namespace.
  • Add regression coverage for foreign SVG and MathML textarea elements, HTML integration-point textarea behavior, and pre / listing foreign-content exit behavior.

Root Cause

WP_HTML_Processor::serialize_token() applied the HTML textarea / pre / listing leading-LF restoration rule by tag name alone. Foreign SVG and MathML elements with local name textarea do not have that parser-stripped leading newline, so normalization inserted an extra LF and was not idempotent.

Verification

  • WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit --group html-api,html-api-html5lib-tests
  • ./vendor/bin/phpcs src/wp-includes/html-api/class-wp-html-processor.php tests/phpunit/tests/html-api/wpHtmlProcessor-serialize.php

Review Notes

Three contrarian subagent review passes were run for the test, implementation, and final formatted diff. The requested codex-review-loop skill was invoked after commit, but codex review could not complete: the sandboxed run failed and the required unsandboxed retry was rejected by policy because it may transmit repository diff data externally.

@sirreal sirreal marked this pull request as ready for review June 10, 2026 10:06
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props jonsurrell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@sirreal

sirreal commented Jun 10, 2026

Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

sirreal added a commit that referenced this pull request Jun 10, 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