Motivation
This issue is to investigate an alternative approach for finding big pipe replacements using a MutationObserver.
To improve the perceived loading speed of pages, the big pipe module on the server-side replaces the dynamic parts of html pages with placeholders while printing and flushing the output of their replacements just after the static part. During page load on the client-side those placeholders are being replaced with their replacements.
For the placholders <span data-big-pipe-placeholder-id="…"> elements are being used, for their replacements a <script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id> element per placeholder.
The replacement of the placeholders is done using Javascript. To find the replacements during page load a setTimeout() callback is being used with a short interval of 50ms (20 times per second). The callback starts looking for replacement script elements once a special <script type="application/vnd.drupal-ajax" data-big-pipe-event="stop"> element is printed and found. The interval is stopped once a <script type="application/vnd.drupal-ajax" data-big-pipe-event="stop"> element is printed and found or on the page load event.
This interval is not very efficient. For example the callback needs to account for newly found replacement elements not having fully arrived yet; parsing their content would fail.
Now we no longer have to support IE10 we can start using a MutationObserver to find the big pipe replacements.
As we no longer have to account for partial big pipe replacement elements we can also immediately remove these elements on processing. This allows us to remove the dependency upon jquery.once and jquery all together.
As a second step we can also remove big pipe's start and stop signals as they are no longer needed to start and stop the interval to look for replacement elements.
Remaining tasks
Test, refactor, decide.
API changes
Big pipe's replacement detection process will work totally different, but this can be considered internal.