Changeset 58992
- Timestamp:
- 09/04/2024 07:23:48 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/html-api/class-wp-html-open-elements.php
r58867 r58992 531 531 532 532 /** 533 * Pops nodes off of the stack of open elements until one with the given tagname has been popped.533 * Pops nodes off of the stack of open elements until an HTML tag with the given name has been popped. 534 534 * 535 535 * @since 6.4.0 … … 537 537 * @see WP_HTML_Open_Elements::pop 538 538 * 539 * @param string $ tag_name Name of tag that needs to be popped off of the stack of open elements.539 * @param string $html_tag_name Name of tag that needs to be popped off of the stack of open elements. 540 540 * @return bool Whether a tag of the given name was found and popped off of the stack of open elements. 541 541 */ 542 public function pop_until( string $ tag_name ): bool {542 public function pop_until( string $html_tag_name ): bool { 543 543 foreach ( $this->walk_up() as $item ) { 544 if ( 'context-node' === $item->bookmark_name ) {545 return true;546 }547 548 544 $this->pop(); 549 545 546 if ( 'html' !== $item->namespace ) { 547 continue; 548 } 549 550 550 if ( 551 '(internal: H1 through H6 - do not use)' === $ tag_name &&551 '(internal: H1 through H6 - do not use)' === $html_tag_name && 552 552 in_array( $item->node_name, array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ), true ) 553 553 ) { … … 555 555 } 556 556 557 if ( $ tag_name === $item->node_name ) {557 if ( $html_tag_name === $item->node_name ) { 558 558 return true; 559 559 } -
trunk/src/wp-includes/html-api/class-wp-html-processor.php
r58985 r58992 5429 5429 } 5430 5430 5431 // All of the following rules are for matching HTML elements. 5432 if ( 'html' !== $node->namespace ) { 5433 continue; 5434 } 5435 5431 5436 switch ( $node->node_name ) { 5432 5437 /* … … 5444 5449 if ( ! $last ) { 5445 5450 foreach ( $this->state->stack_of_open_elements->walk_up( $node ) as $ancestor ) { 5451 if ( 'html' !== $ancestor->namespace ) { 5452 continue; 5453 } 5454 5446 5455 switch ( $ancestor->node_name ) { 5447 5456 /* -
trunk/tests/phpunit/tests/html-api/wpHtmlProcessor.php
r58985 r58992 522 522 523 523 /** 524 * Ensures that the HTML Processor correctly handles TEMPLATE tag closing and namespaces. 525 * 526 * This is a tricky test case that corresponds to the html5lib tests "template/line1466". 527 * 528 * When the `</template>` token is reached it is in the HTML namespace (thanks to the 529 * SVG `foreignObject` element). It is not handled as foreign content; therefore, it 530 * closes the open HTML `TEMPLATE` element (the first `<template>` token) - _not_ the 531 * SVG `TEMPLATE` element (the second `<template>` token). 532 * 533 * The test is included here because it may show up as unsupported markup and be skipped by 534 * the html5lib test suite. 535 * 536 * @ticket 61576 537 */ 538 public function test_template_tag_closes_html_template_element() { 539 $processor = WP_HTML_Processor::create_fragment( '<template><svg><template><foreignObject><div></template><div>' ); 540 541 $this->assertTrue( $processor->next_tag( 'DIV' ) ); 542 $this->assertSame( array( 'HTML', 'BODY', 'TEMPLATE', 'SVG', 'TEMPLATE', 'FOREIGNOBJECT', 'DIV' ), $processor->get_breadcrumbs() ); 543 $this->assertTrue( $processor->next_tag( 'DIV' ) ); 544 $this->assertSame( array( 'HTML', 'BODY', 'DIV' ), $processor->get_breadcrumbs() ); 545 } 546 547 /** 524 548 * Ensures that the tag processor is case sensitive when removing CSS classes in no-quirks mode. 525 549 *
Note: See TracChangeset
for help on using the changeset viewer.