-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Fixed: get_attribute_names_with_prefix() now agrees with enqueued att… #10828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @gclapps0612-cmd. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
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. |
|
Rest
…On Fri, Jan 30, 2026, 03:22 Jerome B. ***@***.***> wrote:
Fixed: get_attribute_names_with_prefix() now agrees with enqueued
attribute updates
The method now returns real-time attribute names that reflect
set_attribute() and remove_attribute() calls without needing to call
get_updated_html() first.
Trac ticket: https://core.trac.wordpress.org/ticket/64567
------------------------------
------------------------------
You can view, comment on, or merge this pull request online at:
#10828
Commit Summary
- 6ee4b36
<6ee4b36>
Fixed: get_attribute_names_with_prefix() now agrees with enqueued attribute
updates
File Changes
(1 file <https://github.com/WordPress/wordpress-develop/pull/10828/files>)
- *M* src/wp-includes/html-api/class-wp-html-tag-processor.php
<https://github.com/WordPress/wordpress-develop/pull/10828/files#diff-0c2d7bb49853cc0faafd5412a25ee90e8cbb4f9293e7c3bb308494aba7d08272>
(35)
Patch Links:
- https://github.com/WordPress/wordpress-develop/pull/10828.patch
- https://github.com/WordPress/wordpress-develop/pull/10828.diff
—
Reply to this email directly, view it on GitHub
<#10828>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BXZWJXFX6GBMB55QFJVVC6L4JMIFJAVCNFSM6AAAAACTNCJCJWVHI2DSMVQWIX3LMV43ASLTON2WKOZTHA3TINJZGA2DMOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
dmsnell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@whaze so glad to see you work on this! this is great.
how would you feel about adding new unit test cases to cover this scenario?
there are existing tests covering this method in tests/phpunit/tests/html-api/wpHtmlTagProcessor.php, ending in test_get_attribute_names_with_prefix_returns_attribute_added_by_set_attribute() and I think a new test method after that would be handy.
for testing, there are a few specific cases I would want to ensure we make explicit:
- removing an attribute removes it from the returned array
- added attributes appear in the same order in the returned array as they would appear in
get_updated_html(). while I don’t know that this is essential, I think it would be consistent with how other code behaves. what do you think on this point? - when failing to
set_attribute()on a new attribute, the failed attribute name does not appear in the output.
Your code is clear and looks straightforward, though I wonder if we could stick with the numeric array/list structure from before and actually need the associative array. I’m guessing that the normal case will involve no removed attributes, so perhaps what we could do is start by adding new attributes, then append the existing attributes, unless they are removed? maybe we could gather the list of removed attributes up front and do a basic in_array() check on $this->attributes as we iterate it.
Fixed: get_attribute_names_with_prefix() now agrees with enqueued attribute updates
The method now returns real-time attribute names that reflect set_attribute() and remove_attribute() calls without needing to call get_updated_html() first.
Trac ticket: https://core.trac.wordpress.org/ticket/64567