Make WordPress Core

Changeset 58676

Timestamp:
07/04/2024 11:14:44 PM (5 weeks ago)
Author:
dmsnell
Message:

HTML API: Add current_node_is() helper method to stack of open elements.

As part of work to add more spec support to the HTML API, this new method
will make it easier to implement the logic when in the SELECT and TABLE
insertion modes.

Developed in https://github.com/WordPress/wordpress-develop/pull/6968
Discussed in https://core.trac.wordpress.org/ticket/51576

Props dmsnell, jonsurrell.
See #61576.

Location:
trunk/src/wp-includes/html-api
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-open-elements.php

    r58588 r58676  
    146146
    147147    /**
     148
     149
     150
     151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
    148190     * Returns whether an element is in a specific scope.
    149191     *
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r58656 r58676  
    10301030
    10311031                $this->generate_implied_end_tags();
    1032                 if ( $this->state->stack_of_open_elements->current_node()->node_name !== $token_name ) {
     1032                if ( ) {
    10331033                    // @todo Record parse error: this error doesn't impact parsing.
    10341034                }
     
    10951095                $this->generate_implied_end_tags();
    10961096
    1097                 if ( $this->state->stack_of_open_elements->current_node()->node_name !== $token_name ) {
     1097                if ( ) {
    10981098                    // @todo Record parse error: this error doesn't impact parsing.
    10991099                }
     
    11211121                    $node_name = $is_li ? 'LI' : $node->node_name;
    11221122                    $this->generate_implied_end_tags( $node_name );
    1123                     if ( $node_name !== $this->state->stack_of_open_elements->current_node()->node_name ) {
     1123                    if ( ) {
    11241124                        // @todo Indicate a parse error once it's possible. This error does not impact the logic here.
    11251125                    }
     
    11981198                $this->generate_implied_end_tags( $token_name );
    11991199
    1200                 if ( $token_name !== $this->state->stack_of_open_elements->current_node()->node_name ) {
     1200                if ( ) {
    12011201                    // @todo Indicate a parse error once it's possible. This error does not impact the logic here.
    12021202                }
Note: See TracChangeset for help on using the changeset viewer.