Skip to content

HTML API: Ignore slash inside unquoted attribute values#39

Open
sirreal wants to merge 1 commit into
trunkfrom
fix/html-api-unquoted-slash-self-closing
Open

HTML API: Ignore slash inside unquoted attribute values#39
sirreal wants to merge 1 commit into
trunkfrom
fix/html-api-unquoted-slash-self-closing

Conversation

@sirreal

@sirreal sirreal commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • treats a trailing slash in an unquoted attribute value as part of that value
  • prevents foreign-content elements from self-closing when no syntactic self-closing flag is present
  • adds tag-processor and processor regression coverage for the MathML case

Testing

  • WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit --filter 'test_trailing_slash_in_unquoted_attribute_value' tests/phpunit/tests/html-api/wpHtmlProcessor.php
  • WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit tests/phpunit/tests/html-api/wpHtmlProcessor.php
  • WP_TESTS_SKIP_INSTALL=1 ./vendor/bin/phpunit tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
  • ./vendor/bin/phpcs --standard=phpcs.xml.dist src/wp-includes/html-api/class-wp-html-tag-processor.php tests/phpunit/tests/html-api/wpHtmlProcessor.php tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
  • codex review --base trunk

gemini-code-assist[bot]

This comment was marked as off-topic.

@sirreal sirreal marked this pull request as ready for review June 9, 2026 20:05
@github-actions

This comment was marked as off-topic.

@sirreal

sirreal commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

Code review

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

🤖 Generated with Claude Code

@sirreal

sirreal commented Jun 10, 2026

Copy link
Copy Markdown
Owner Author

Code review

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

Verified the attribute-span check in has_self_closing_flag(): attributes are eagerly parsed in base_class_next_token() before this method can be called, unquoted-value spans include a trailing solidus (strcspn does not stop at /), a genuine self-closing / is never stored as an attribute, and both WP_HTML_Attribute_Token and the WP_HTML_Span duplicate-attribute entries share the same start/length semantics. The flipped expectation for <div id=test/> matches the WHATWG attribute-value-(unquoted) state, and the new tag-processor and HTML-processor tests cover the MathML regression.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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