Changeset 59450
- Timestamp:
- 11/22/2024 12:50:48 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r59444 r59450 465 465 */ 466 466 public function create_fragment_at_current_node( string $html ) { 467 if ( $this->get_token_type() !== '#tag' ) {467 if ( $this->get_token_type() !== '#tag' || $this->is_tag_closer() ) { 468 468 return null; 469 469 } -
trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php
r59444 r59450 1105 1105 1106 1106 /** 1107 * @ticket 62357 1108 */ 1109 public function test_prevent_fragment_creation_on_closers() { 1110 $processor = WP_HTML_Processor::create_full_parser( '<p></p>' ); 1111 $processor->next_tag( 'P' ); 1112 $processor->next_tag( 1113 array( 1114 'tag_name' => 'P', 1115 'tag_closers' => 'visit', 1116 ) 1117 ); 1118 $this->assertSame( 'P', $processor->get_tag() ); 1119 $this->assertTrue( $processor->is_tag_closer() ); 1120 $this->assertNull( $processor->create_fragment_at_current_node( '<i>fragment HTML</i>' ) ); 1121 } 1122 1123 /** 1107 1124 * Ensure that lowercased tag_name query matches tags case-insensitively. 1108 1125 *
Note: See TracChangeset
for help on using the changeset viewer.