Skip to content

Commit 6ed2409

Browse files
committed
HTML API: Remove unused processor state context_node property
The HTML Processor State `context_node` is redundant and can be deprecated. The property has been superseded by `WP_HTML_Processor->context_node` since [58304]. Props jonsurrell, gziolo. Fixes #62518. git-svn-id: https://develop.svn.wordpress.org/trunk@59463 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 520e61d commit 6ed2409

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

src/wp-includes/html-api/class-wp-html-processor-state.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,9 @@ class WP_HTML_Processor_State {
360360
* Context node initializing fragment parser, if created as a fragment parser.
361361
*
362362
* @since 6.4.0
363+
* @deprecated 6.8.0 WP_HTML_Processor tracks the context_node internally.
363364
*
364-
* @see https://html.spec.whatwg.org/#concept-frag-parse-context
365-
*
366-
* @var [string, array]|null
365+
* @var null
367366
*/
368367
public $context_node = null;
369368

src/wp-includes/html-api/class-wp-html-processor.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
298298
}
299299

300300
$processor = new static( $html, self::CONSTRUCTOR_UNLOCK_CODE );
301-
$processor->state->context_node = array( 'BODY', array() );
302301
$processor->state->insertion_mode = WP_HTML_Processor_State::INSERTION_MODE_IN_BODY;
303302
$processor->state->encoding = $encoding;
304303
$processor->state->encoding_confidence = 'certain';
@@ -317,7 +316,7 @@ public static function create_fragment( $html, $context = '<body>', $encoding =
317316

318317
$context_node = new WP_HTML_Token(
319318
'context-node',
320-
$processor->state->context_node[0],
319+
'BODY',
321320
false
322321
);
323322

@@ -492,15 +491,6 @@ public function create_fragment_at_current_node( string $html ) {
492491
$fragment_processor->context_node->bookmark_name = 'context-node';
493492
$fragment_processor->context_node->on_destroy = null;
494493

495-
$fragment_processor->state->context_node = array( $fragment_processor->context_node->node_name, array() );
496-
497-
$attribute_names = $this->get_attribute_names_with_prefix( '' );
498-
if ( null !== $attribute_names ) {
499-
foreach ( $attribute_names as $name ) {
500-
$fragment_processor->state->context_node[1][ $name ] = $this->get_attribute( $name );
501-
}
502-
}
503-
504494
$fragment_processor->breadcrumbs = array( 'HTML', $fragment_processor->context_node->node_name );
505495

506496
if ( 'TEMPLATE' === $fragment_processor->context_node->node_name ) {

0 commit comments

Comments
 (0)