Changeset 59694
- Timestamp:
- 01/23/2025 06:35:15 PM (8 weeks ago)
- Location:
- branches/6.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.7
-
branches/6.7/src/wp-includes/html-api/class-wp-html-processor.php
r59535 r59694 805 805 'html' === $token_name || 806 806 // Void elements. 807 self::is_void( $token_name) ||807 ( 'html' === $token_namespace && self::is_void( $token_name ) ) || 808 808 // Special atomic elements. 809 809 ( 'html' === $token_namespace && in_array( $token_name, array( 'IFRAME', 'NOEMBED', 'NOFRAMES', 'SCRIPT', 'STYLE', 'TEXTAREA', 'TITLE', 'XMP' ), true ) ) || -
branches/6.7/tests/phpunit/tests/html-api/wpHtmlProcessor.php
r59535 r59694 563 563 564 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 } 587 } 588 589 /** 565 590 * Ensures that self-closing foreign SCRIPT elements are properly found. 566 591 *
Note: See TracChangeset
for help on using the changeset viewer.