Changeset 55662
- Timestamp:
- 04/20/2023 09:11:06 AM (3 years ago)
- Location:
- branches/6.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.2/src/wp-includes/html-api/class-wp-html-tag-processor.php
r55477 r55662 1776 1776 * 1777 1777 * @since 6.2.0 1778 * @since 6.2.1 Fix: Only create a single update for multiple calls with case-variant attribute names. 1778 1779 * 1779 1780 * @param string $name The attribute name to target. … … 1868 1869 * Result: <div id="new"/> 1869 1870 */ 1870 $existing_attribute = $this->attributes[ $comparable_name ];1871 $this->lexical_updates[ $ name ] = new WP_HTML_Text_Replacement(1871 $existing_attribute = $this->attributes[ $comparable_name ]; 1872 $this->lexical_updates[ $comparable_name ] = new WP_HTML_Text_Replacement( 1872 1873 $existing_attribute->start, 1873 1874 $existing_attribute->end, -
branches/6.2/tests/phpunit/tests/html-api/wpHtmlTagProcessor.php
r55469 r55662 911 911 'Existing attribute was not updated' 912 912 ); 913 } 914 915 /** 916 * Ensures that when setting an attribute multiple times that only 917 * one update flushes out into the updated HTML. 918 * 919 * @ticket 58146 920 * 921 * @covers WP_HTML_Tag_Processor::set_attribute 922 */ 923 public function test_set_attribute_with_case_variants_updates_only_the_original_first_copy() { 924 $p = new WP_HTML_Tag_Processor( '<div data-enabled="5">' ); 925 $p->next_tag(); 926 $p->set_attribute( 'DATA-ENABLED', 'canary' ); 927 $p->set_attribute( 'Data-Enabled', 'canary' ); 928 $p->set_attribute( 'dATa-EnABled', 'canary' ); 929 930 $this->assertSame( '<div data-enabled="canary">', strtolower( $p->get_updated_html() ) ); 913 931 } 914 932
Note: See TracChangeset
for help on using the changeset viewer.