Rocket Loader is not ignoring `onload` attributes

Hi,

I need Rocket Loader to ignore tags containing onload attribute. However, data-cfasync="false" has no effect in such cases. For example, consider following code which is a technique to deffer css files:

<link rel="preload" href="/css/app.css" as="style">
<link rel="stylesheet" href="/css/app.css" media="print" data-cfasync="false" onload="this.media='all'">
<noscript><link rel="stylesheet" href="/css/app.css"></noscript>

onload on the second one causes Rocket Loader to be injected:

It sounds like to be a bug since I’m intentionally telling it to ignore the tag.

OK, I’m using the following workaround for now:

    <script data-cfasync="false">
        document.getElementsByTagName('head')[0].insertAdjacentHTML(
            'beforeend',
            '<link rel="preload" href="/css/app.css" as="style">' +
            '<link rel="stylesheet" href="/css/app.css" media="print" onload="this.media=\'all\'">'
        );
    </script>
    <noscript><link rel="stylesheet" href="/css/app.css"></noscript>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.