Make WordPress Core


Ignore:
Timestamp:
11/06/2024 07:22:22 PM (7 months ago)
Author:
westonruter
Message:

HTML API: Improve private method name used by WP_HTML_Processor::next_token().

This renames the private _next_token method to next_visitable_token. It also removes irrelevant assertions from the unit test.

Follow-up to [59285].

Props dmsnell, jonsurrell, westonruter.
See #62269.

File:
1 edited

Legend:

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

    r59285 r59364  
    617617     */
    618618    public function next_token(): bool {
    619         return $this->_next_token();
     619        return $this->next_visitable_token();
    620620    }
    621621
     
    628628     * WP_HTML_Tag_Processor instead.
    629629     *
    630      * @since 6.7.1 Added for internal support; do not use.
     630     * Note that this method may call itself recursively. This is why it is not
     631     * implemented as {@see WP_HTML_Processor::next_token()}, which instead calls
     632     * this method similarly to how {@see WP_HTML_Tag_Processor::next_token()}
     633     * calls the {@see WP_HTML_Tag_Processor::base_class_next_token()} method.
     634     *
     635     * @since 6.7.1 Added for internal support.
    631636     *
    632637     * @access private
     
    634639     * @return bool
    635640     */
    636     private function _next_token(): bool {
     641    private function next_visitable_token(): bool {
    637642        $this->current_element = null;
    638643
     
    652657         */
    653658        if ( empty( $this->element_queue ) && $this->step() ) {
    654             return $this->_next_token();
     659            return $this->next_visitable_token();
    655660        }
    656661
     
    663668            }
    664669
    665             return empty( $this->element_queue ) ? false : $this->_next_token();
     670            return empty( $this->element_queue ) ? false : $this->next_visitable_token();
    666671        }
    667672
     
    674679         */
    675680        if ( 'root-node' === $this->current_element->token->bookmark_name ) {
    676             return $this->_next_token();
     681            return $this->next_visitable_token();
    677682        }
    678683
     
    686691        // Avoid sending close events for elements which don't expect a closing.
    687692        if ( $is_pop && ! $this->expects_closer( $this->current_element->token ) ) {
    688             return $this->_next_token();
     693            return $this->next_visitable_token();
    689694        }
    690695
Note: See TracChangeset for help on using the changeset viewer.