Skip to content
@drupflare/spool v1.0.0 GitHub
    Preparing search index...

    Function rewriteLazy

    • Adds loading="lazy" and decoding="async" to the <img> tags of html after the first skip, and loading="lazy" to <iframe> tags with iframes, and says how many tags changed. Tags inside <head>, <noscript> or an HTML comment are neither counted nor edited. A tag that has loading, fetchpriority, data-src, data-srcset or a data-lazy* attribute, that sits inside a <header>, or whose src a <link rel="preload" as="image"> names, is counted toward skip and left alone. A tag that already has decoding keeps it. Everything outside the edited start tags stays byte for byte, and the edits are ASCII.

      Parameters

      Returns { html: string; rewritten: number }