HTML API: Fix three small type-related bugs.

This applies three fixes that appeared as part of
adding type annotations to the HTML API.

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

Props jonsurrell.
See #61399.
Follow-up to [55203], [56274].

Built from https://develop.svn.wordpress.org/trunk@58364


git-svn-id: http://core.svn.wordpress.org/trunk@57813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-06-08 11:12:11 +00:00
parent 4b8fa1bc8b
commit cf2a88a397
3 changed files with 6 additions and 4 deletions

View File

@ -543,7 +543,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
// Avoid sending close events for elements which don't expect a closing.
if (
WP_HTML_Stack_Event::POP === $this->current_element->operation &&
! static::expects_closer( $this->current_element->token->node_name )
! static::expects_closer( $this->current_element->token )
) {
return $this->next_token();
}

View File

@ -2265,7 +2265,7 @@ class WP_HTML_Tag_Processor {
* @param int $shift_this_point Accumulate and return shift for this position.
* @return int How many bytes the given pointer moved in response to the updates.
*/
private function apply_attributes_updates( $shift_this_point = 0 ) {
private function apply_attributes_updates( $shift_this_point ) {
if ( ! count( $this->lexical_updates ) ) {
return 0;
}
@ -2787,6 +2787,8 @@ class WP_HTML_Tag_Processor {
case self::STATE_FUNKY_COMMENT:
return '#funky-comment';
}
return null;
}
/**
@ -3195,7 +3197,7 @@ class WP_HTML_Tag_Processor {
* Keep track of the position right before the current tag. This will
* be necessary for reparsing the current tag after updating the HTML.
*/
$before_current_tag = $this->token_starts_at;
$before_current_tag = $this->token_starts_at ?? 0;
/*
* 1. Apply the enqueued edits and update all the pointers to reflect those changes.

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-beta1-58363';
$wp_version = '6.6-beta1-58364';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.