PERF: Refactor decorateCooked to run in a detached DOM (PR #9517)

This means that the HTML can be modified without triggering the download of remote resources (e.g. images)

In some rare cases (e.g. IntersectionObservers in Chromium), decorating needs to happen in the real DOM. For this, pass afterAdopt: true to decorateCooked


can’t this be:


we want to move away from sending jquery object in decorate cooked, I understand you do this for consistency… but I’m unsure, maybe we should just give regular object? Wha do you think @eviltrout ?

Minor but this method doesn’t access any instance variables and could be more private by putting it at the top of the module as a regular function.

This is going to be called a LOT and the filter is the same result every time.

I would recommend making separate _beforeAdoptDecorators and _afterAdoptDecorators so you needn’t filter every time.

Nice! I removed a lot of JQuery but missed this one. Updated :+1:

:+1: done, thanks. I also refactored so that the detached document is re-used, rather than recreating each time

Good idea, thanks :heart:

Looks awesome! Excited to see how it works.