diff --git a/core/lib/Drupal/Core/Render/BigPipe.php b/core/lib/Drupal/Core/Render/BigPipe.php index 07a8958..9119e18 100644 --- a/core/lib/Drupal/Core/Render/BigPipe.php +++ b/core/lib/Drupal/Core/Render/BigPipe.php @@ -63,8 +63,10 @@ public function sendContent($content, array $placeholders) { print $page_parts[0]; - // Print the start signal. - print ' ' . "\n"; + // Print a container and the start signal. + print "\n"; + print '
' . "\n"; + print ' ' . "\n"; ob_end_flush(); flush(); @@ -100,9 +102,9 @@ public function sendContent($content, array $placeholders) { $json = $response->getContent(); $output = << - $json - + EOF; print $output; @@ -111,7 +113,8 @@ public function sendContent($content, array $placeholders) { } // Send the stop signal. - print ' ' . "\n"; + print ' ' . "\n"; + print '
' . "\n"; // Now that we have processed all the placeholders, attach the behaviors // on the page again. diff --git a/core/misc/big_pipe.js b/core/misc/big_pipe.js index 65be516..489a5f5 100644 --- a/core/misc/big_pipe.js +++ b/core/misc/big_pipe.js @@ -21,8 +21,14 @@ } function BigPipeProcessPlaceholders(context) { + var $container = jQuery('[data-big-pipe-container=1]', context); + + if (!$container.length) { + return; + } + // Process BigPipe inlined ajax responses. - $('[data-drupal-ajax-processor="big_pipe"]', context).each(function() { + $container.find('script[data-drupal-ajax-processor="big_pipe"]').each(function() { var placeholder = $(this).data('big-pipe-placeholder'); // Ignore any placeholders that are not in the known placeholder list. @@ -38,13 +44,13 @@ }); // Check for start signal to attachBehaviors. - $('[data-big-pipe-start="1"]', context).each(function() { + $container.find('script[data-big-pipe-start="1"]').each(function() { $(this).remove(); Drupal.attachBehaviors(); }); // Check for stop signal to stop checking. - $('[data-big-pipe-stop="1"]', context).each(function() { + $container.find('script[data-big-pipe-stop="1"]').each(function() { $(this).remove(); BigPipeClearInterval(); });