Automattic / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
3.1k stars 220 forks source link

crash on rule "-webkit-text;" #478

Open ValerioCietto opened 3 months ago

ValerioCietto commented 3 months ago

Minimal example:

<html>
<head>
<style>
        body {
            margin: 0 auto !important;
            padding: 0 !important;
            width: 100% !important;
            height: 100% !important;
            -webkit-text;
            size-adjust: 100%;
            -ms-text-size-adjust: 100%;
        }
    </style>
</head>
<body id="body" bgcolor="f5f5f5" style="margin: 0; padding: 0 !important;">
Test
</body>
</html>

By looking with debugger node_modules/juice/lib/inline.js:259

I can be solved with a try catch like

        try {
        // don't add css variables if we're resolving their values
        if (options.resolveCSSVariables && (prop.prop.indexOf('--') === 0) ) {
          return false;
        }

        } catch(error) {
          console.error(error)
        }

because it is a void CSS rule