Skip to content

Commit 9ca5aca

Browse files
committed
Fix the processor context_node
1 parent f6caa32 commit 9ca5aca

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,18 @@ private function spawn_fragment_parser( string $html ): ?self {
453453
$fragment_processor = self::create_fragment( $html );
454454
$fragment_processor->compat_mode = $this->compat_mode;
455455

456-
// @todo The context element probably needs a namespace{
457456
$context_element = array( $this->get_tag(), array() );
458457
foreach ( $this->get_attribute_names_with_prefix( '' ) as $name => $value ) {
459458
$context_element[1][ $name ] = $value;
460459
}
460+
461+
$fragment_processor->context_node = new WP_HTML_Token(
462+
'context-node',
463+
$context_element[0],
464+
$this->has_self_closing_flag()
465+
);
466+
$fragment_processor->context_node->namespace = $this->get_namespace();
467+
461468
$fragment_processor->state->context_node = $context_element;
462469

463470
if ( 'TEMPLATE' === $context_element[0] ) {

0 commit comments

Comments
 (0)