Skip to content

HTML API: Ignore slash inside unquoted attribute values#39

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

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

Conversation

@sirreal

@sirreal sirreal commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Treat a trailing slash in an unquoted attribute value as part of that value.
  • Prevent foreign-content elements from self-closing when no syntactic self-closing flag is present.
  • Add Tag Processor and HTML Processor regressions for the MathML case.

Testing

  • Focused PHPUnit coverage for unquoted trailing-slash attributes.
  • HTML API PHPUnit coverage and PHPCS pass.
  • codex review --base trunk.

Trac ticket: https://core.trac.wordpress.org/ticket/65372

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5.5
Used for: PR description cleanup and code review.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

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 👎.

@sirreal

sirreal commented Jun 16, 2026

Copy link
Copy Markdown
Owner Author

This is an interesting one, confirmed.

<math><mi a=b/>math:mi is not self-closing, it has [a="b/"] attribute.

That should produce:

└─math:math
  └─math:mi a="b/"
    └─#text math:mi is not self-closing, it has [a="b/"] attribute.

But it produces:

└─math:math
  ├─math:mi a="b/"
  └─#text math:mi is not self-closing, it has [a="b/"] attribute.

Playground demo (WP 7.0)

I'd like to simplify the fix.

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