@@ -437,14 +437,16 @@ public function spawn_fragment_parser( string $html ): ?self {
437
437
return null ;
438
438
}
439
439
440
+ $ namespace = $ this ->get_namespace ();
441
+
440
442
/*
441
443
* Prevent creating fragments at "self-contained" nodes.
442
444
*
443
445
* @see https://github.com/WordPress/wordpress-develop/pull/7141
444
446
* @see https://github.com/WordPress/wordpress-develop/pull/7198
445
447
*/
446
448
if (
447
- 'html ' === $ this -> get_namespace () &&
449
+ 'html ' === $ namespace &&
448
450
in_array ( $ this ->get_tag (), array ( 'IFRAME ' , 'NOEMBED ' , 'NOFRAMES ' , 'SCRIPT ' , 'STYLE ' , 'TEXTAREA ' , 'TITLE ' , 'XMP ' ), true )
449
451
) {
450
452
return null ;
@@ -453,19 +455,17 @@ public function spawn_fragment_parser( string $html ): ?self {
453
455
$ fragment_processor = self ::create_fragment ( $ html );
454
456
$ fragment_processor ->compat_mode = $ this ->compat_mode ;
455
457
456
- $ context_element = array ( $ this ->get_tag (), array () );
458
+
459
+ $ fragment_processor ->context_node = clone $ this ->state ->current_token ;
460
+ $ fragment_processor ->context_node ->bookmark_name = 'context-node ' ;
461
+ $ fragment_processor ->context_node ->on_destroy = null ;
462
+
463
+ $ context_element = array ( $ fragment_processor ->context_node ->node_name , array () );
457
464
foreach ( $ this ->get_attribute_names_with_prefix ( '' ) as $ name => $ value ) {
458
465
$ context_element [1 ][ $ name ] = $ value ;
459
466
}
460
467
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
-
468
- $ fragment_processor ->state ->context_node = $ context_element ;
468
+ $ fragment_processor ->breadcrumbs = array ();
469
469
470
470
if ( 'TEMPLATE ' === $ context_element [0 ] ) {
471
471
$ fragment_processor ->state ->stack_of_template_insertion_modes [] = WP_HTML_Processor_State::INSERTION_MODE_IN_TEMPLATE ;
0 commit comments