The HTMLRewriter() API gives us the ability to use jQuery-style element selectors to attach to HTML elements in raw page source to run JavaScript from that foothold.
Please visit Search Engine Land for the full article.
Source: Search Engine Land
Link: Functions for Core Web Vitals Tactics with Cloudflare’s HTMLRewriter