bezoerb / inline-critical

Inline critical path CSS and async load existing stylesheets
Other
115 stars 15 forks source link

Print stylesheet unexpectedly gets onload attribute #298

Closed bezoerb closed 1 year ago

bezoerb commented 1 year ago

Ported from https://github.com/addyosmani/critical/issues/552

If I understand #444 / 07be40bab23eb518bb689062b43f0db507c9a1f9 correctly, print stylesheets should be unaffected by the script. And that seems to actually be the case—the print stylesheet is not part of the extracted critical CSS.

However, the <link> tag still erroneously gets an onload attribute, which does not make sense.

Input HTML:

<link rel="stylesheet" href="css/print.css" media="print">

Expected output:

(unchanged)

Actual output:

<link rel="stylesheet" href="css/print.css" media="print" onload="this.media='print'">