Changeset 59392
- Timestamp:
- 11/12/2024 12:56:37 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r59391 r59392 822 822 'html' === $token_name || 823 823 // Void elements. 824 self::is_void( $token_name) ||824 ( 'html' === $token_namespace && self::is_void( $token_name ) ) || 825 825 // Special atomic elements. 826 826 ( 'html' === $token_namespace && in_array( $token_name, array( 'IFRAME', 'NOEMBED', 'NOFRAMES', 'SCRIPT', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP' ), true ) ) || -
trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php
r59391 r59392 560 560 $this->assertSame( 'MATH', $processor->get_tag() ); 561 561 $this->assertTrue( $processor->expects_closer() ); 562 } 563 564 /** 565 * Ensures that expects_closer works for void-like elements in foreign content. 566 * 567 * For example, `<svg><input>text` creates an `svg:input` that contains a text node. 568 * This input should not be treated as a void tag and _should_ expect a close tag. 569 * 570 * @dataProvider data_void_tags 571 * 572 * @ticket 62363 573 */ 574 public function test_expects_closer_foreign_content_not_void( string $void_tag ) { 575 $processor = WP_HTML_Processor::create_fragment( "<svg><{$void_tag}>" ); 576 577 $this->assertTrue( $processor->next_tag( $void_tag ) ); 578 579 // Some void-like tags will close the SVG element and be HTML tags. 580 if ( $processor->get_namespace() === 'svg' ) { 581 $this->assertSame( array( 'HTML', 'BODY', 'SVG', $void_tag ), $processor->get_breadcrumbs() ); 582 $this->assertTrue( $processor->expects_closer() ); 583 } else { 584 $this->assertSame( array( 'HTML', 'BODY', $void_tag ), $processor->get_breadcrumbs() ); 585 $this->assertFalse( $processor->expects_closer() ); 586 } 562 587 } 563 588
Note: See TracChangeset
for help on using the changeset viewer.