[wp-trac] [WordPress Trac] #58146: HTML API: Ensure attribute updates happen only once for case variants

WordPress Trac noreply at wordpress.org
Mon Apr 17 15:51:58 UTC 2023


#58146: HTML API: Ensure attribute updates happen only once for case variants
--------------------------+--------------------------------------
 Reporter:  dmsnell       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  HTML API      |    Version:  6.2
 Severity:  normal        |   Keywords:  has-patch has-unit-tests
  Focuses:                |
--------------------------+--------------------------------------
 Github PR: [https://github.com/WordPress/wordpress-develop/pull/4337
 #4337]

 When setting a new value for an attribute multiple times and providing
 multiple case variations of the attribute name the Tag Processor has
 been appending multiple copies of the attribute into the updated HTML.

 This means that only the first attribute set determines the value in
 the final output, plus the output will //appear// wrong.

 In this patch we're adding a test to catch the situation and resolving it
 by using the appropriate comparable attribute name as a key for storing
 the updates as we go. Previously we stored updates to the attribute by
 its given `$name`, but when a new update of the same name with a
 case variant was queued, it would not override the previously-enqueued
 value as it out to have.

 This bug has not been reported or known to be exposed.
 Reproduce in `trunk` by enqueuing multiple updates to a given
 attribute with different case variants while visiting a single tag
 with the Tag Processor. (See included unit tests).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58146>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list