Make WordPress Core

Changeset 58898


Ignore:
Timestamp:
08/14/2024 09:17:22 PM (2 years ago)
Author:
dmsnell
Message:

HTML API: Make "reset insertion mode appropriately" algorithm private.

The algorithm is described and referred to in the specification as
"reset the insertion mode appropriately." This patch renames it to
more accurately reflect the specification, and it turns the public
method private. As an internal algorithm from the HTML specification
it should not be open to extension.

Developed in https://github.com/wordpress/wordpress-develop/pull/7194
Discussed in https://core.trac.wordpress.org/ticket/61549

Follow-up to [28656].
Props jonsurrell.
See #61549.

File:
1 edited

Legend:

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

    r58877 r58898  
    15021502                                $this->state->active_formatting_elements->clear_up_to_last_marker();
    15031503                                array_pop( $this->state->stack_of_template_insertion_modes );
    1504                                 $this->reset_insertion_mode();
     1504                                $this->reset_insertion_mode_appropriately();
    15051505                                return true;
    15061506                }
     
    29562956
    29572957                                $this->state->stack_of_open_elements->pop_until( 'TABLE' );
    2958                                 $this->reset_insertion_mode();
     2958                                $this->reset_insertion_mode_appropriately();
    29592959                                return $this->step( self::REPROCESS_CURRENT_NODE );
    29602960
     
    29692969
    29702970                                $this->state->stack_of_open_elements->pop_until( 'TABLE' );
    2971                                 $this->reset_insertion_mode();
     2971                                $this->reset_insertion_mode_appropriately();
    29722972                                return true;
    29732973
     
    37303730                                }
    37313731                                $this->state->stack_of_open_elements->pop_until( 'SELECT' );
    3732                                 $this->reset_insertion_mode();
     3732                                $this->reset_insertion_mode_appropriately();
    37333733                                return true;
    37343734
     
    37463746                                }
    37473747                                $this->state->stack_of_open_elements->pop_until( 'SELECT' );
    3748                                 $this->reset_insertion_mode();
     3748                                $this->reset_insertion_mode_appropriately();
    37493749                                return $this->step( self::REPROCESS_CURRENT_NODE );
    37503750
     
    38013801                                // @todo Indicate a parse error once it's possible.
    38023802                                $this->state->stack_of_open_elements->pop_until( 'SELECT' );
    3803                                 $this->reset_insertion_mode();
     3803                                $this->reset_insertion_mode_appropriately();
    38043804                                return $this->step( self::REPROCESS_CURRENT_NODE );
    38053805
     
    38203820                                }
    38213821                                $this->state->stack_of_open_elements->pop_until( 'SELECT' );
    3822                                 $this->reset_insertion_mode();
     3822                                $this->reset_insertion_mode_appropriately();
    38233823                                return $this->step( self::REPROCESS_CURRENT_NODE );
    38243824                }
     
    39553955                $this->state->active_formatting_elements->clear_up_to_last_marker();
    39563956                array_pop( $this->state->stack_of_template_insertion_modes );
    3957                 $this->reset_insertion_mode();
     3957                $this->reset_insertion_mode_appropriately();
    39583958                return $this->step( self::REPROCESS_CURRENT_NODE );
    39593959        }
     
    51015101         * @see https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately
    51025102         */
    5103         public function reset_insertion_mode(): void {
     5103        private function reset_insertion_mode_appropriately(): void {
    51045104                // Set the first node.
    51055105                $first_node = null;
Note: See TracChangeset for help on using the changeset viewer.