HTML API: Ensure correct normalization of namespace-prefixed attribute names#12140
HTML API: Ensure correct normalization of namespace-prefixed attribute names#12140sirreal wants to merge 10 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Verified that the space-to-colon replacement in 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
dmsnell
left a comment
There was a problem hiding this comment.
Great work. This is a rare edge case and the fix seems prudent. I was going to ask that you mention the space/colon issue in get_qualified_attribute_name() but was pleased to see that you already did.
Discovered during fuzz-testing of the HTML API. Adjusted foreign attributes, such as `xlink:href`, were being normalized with a space instead of a colon through `::serialize_token()`. This led to the creation of two attributes on output instead of the proper singular attribute. This patch corrects the issue by ensuring that the attribute namespace and name are separated by a colon when serializing. Developed in: #12140 Discussed in: https://core.trac.wordpress.org/ticket/65372 Props jonsurrell. See #65372. git-svn-id: https://develop.svn.wordpress.org/trunk@62492 602fd350-edb4-49c9-b593-d223f7449a82
Discovered during fuzz-testing of the HTML API. Adjusted foreign attributes, such as `xlink:href`, were being normalized with a space instead of a colon through `::serialize_token()`. This led to the creation of two attributes on output instead of the proper singular attribute. This patch corrects the issue by ensuring that the attribute namespace and name are separated by a colon when serializing. Developed in: WordPress/wordpress-develop#12140 Discussed in: https://core.trac.wordpress.org/ticket/65372 Props jonsurrell. See #65372. Built from https://develop.svn.wordpress.org/trunk@62492 git-svn-id: http://core.svn.wordpress.org/trunk@61773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes an issue where HTML Processor serialization issue where adjusted foreign attributes such as
xlink:hrefwere emitted with a space separator asxlink href. After normalization, this would become two attributes,xlinkandhref.This keeps duplicate detection keyed to the adjusted qualified attribute name while converting adjusted foreign attributes back to colon-prefixed names when writing HTML. It also adds regression coverage for both
WP_HTML_Processor::normalize()andserialize_token().Trac ticket: https://core.trac.wordpress.org/ticket/65372
Use of AI Tools
AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5
Used for: Discover issue with fuzz testing, add the regression test, implement fix, perform verification, and draft this PR description.