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. Built from https://develop.svn.wordpress.org/trunk@59364 git-svn-id: http://core.svn.wordpress.org/trunk@58750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3a4341abf4
commit
ba9fe05e26
|
@ -616,7 +616,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
* @return bool Whether a token was parsed.
|
* @return bool Whether a token was parsed.
|
||||||
*/
|
*/
|
||||||
public function next_token(): bool {
|
public function next_token(): bool {
|
||||||
return $this->_next_token();
|
return $this->next_visitable_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -627,13 +627,18 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
* semantic rules for text nodes. For access to the raw tokens consider using
|
* semantic rules for text nodes. For access to the raw tokens consider using
|
||||||
* WP_HTML_Tag_Processor instead.
|
* WP_HTML_Tag_Processor instead.
|
||||||
*
|
*
|
||||||
* @since 6.7.1 Added for internal support; do not use.
|
* Note that this method may call itself recursively. This is why it is not
|
||||||
|
* implemented as {@see WP_HTML_Processor::next_token()}, which instead calls
|
||||||
|
* this method similarly to how {@see WP_HTML_Tag_Processor::next_token()}
|
||||||
|
* calls the {@see WP_HTML_Tag_Processor::base_class_next_token()} method.
|
||||||
|
*
|
||||||
|
* @since 6.7.1 Added for internal support.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function _next_token(): bool {
|
private function next_visitable_token(): bool {
|
||||||
$this->current_element = null;
|
$this->current_element = null;
|
||||||
|
|
||||||
if ( isset( $this->last_error ) ) {
|
if ( isset( $this->last_error ) ) {
|
||||||
|
@ -651,7 +656,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
* tokens works in the meantime and isn't obviously wrong.
|
* tokens works in the meantime and isn't obviously wrong.
|
||||||
*/
|
*/
|
||||||
if ( empty( $this->element_queue ) && $this->step() ) {
|
if ( empty( $this->element_queue ) && $this->step() ) {
|
||||||
return $this->_next_token();
|
return $this->next_visitable_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the next event on the queue.
|
// Process the next event on the queue.
|
||||||
|
@ -662,7 +667,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty( $this->element_queue ) ? false : $this->_next_token();
|
return empty( $this->element_queue ) ? false : $this->next_visitable_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
$is_pop = WP_HTML_Stack_Event::POP === $this->current_element->operation;
|
$is_pop = WP_HTML_Stack_Event::POP === $this->current_element->operation;
|
||||||
|
@ -673,7 +678,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
* the breadcrumbs.
|
* the breadcrumbs.
|
||||||
*/
|
*/
|
||||||
if ( 'root-node' === $this->current_element->token->bookmark_name ) {
|
if ( 'root-node' === $this->current_element->token->bookmark_name ) {
|
||||||
return $this->_next_token();
|
return $this->next_visitable_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust the breadcrumbs for this event.
|
// Adjust the breadcrumbs for this event.
|
||||||
|
@ -685,7 +690,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
|
||||||
|
|
||||||
// Avoid sending close events for elements which don't expect a closing.
|
// Avoid sending close events for elements which don't expect a closing.
|
||||||
if ( $is_pop && ! $this->expects_closer( $this->current_element->token ) ) {
|
if ( $is_pop && ! $this->expects_closer( $this->current_element->token ) ) {
|
||||||
return $this->_next_token();
|
return $this->next_visitable_token();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.8-alpha-59362';
|
$wp_version = '6.8-alpha-59364';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue