• Resolved joedev91

    (@joedev91)


    Hi,

    I realized that when Minify HTML it’s enabled all double quotes from head are removed, this is valid in HTML5 but it’s not recommended. It’s possible to enable minify and disable double quotes removal?

    for example:

    Without HTML Minify:
    <link rel=”alternate” hreflang=”es” href=”https://mytest.com/&#8221; />

    With HTML Minify:
    <link rel=alternate hreflang=es href=https://mytest.com/ />

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,

    The HTML is valid and this feature makes page load even smaller, so faster and better for mobile visitors. Not all quotes are removed as HTML requires quotes when there’s a space in the value. Maybe you don’t like it, but nobody cares how the HTML looks, they only care about your website working fast.
    Once again please check the article from google chrome engine project => https://mathiasbynens.be/notes/unquoted-attribute-values

    I have come across a bug.

    Example input
    <a href="https://example.com/page/2/">Test</a>

    Gets minified as
    <a href=https://example.com/page/2/>Test</a>

    Anchor tag gets interpreted by Chrome as a self closing tag.
    <a href=https://example.com/page/2></a>Test

    Notice the effect of trailing slash in the URL.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @pratham2003,

    Can you please replace the following lines:
    In wp-content/plugins/w3-total-cache/lib/Minify/Minify/HTML.php replace lines 346 and 347 with
    $m[2] = preg_replace( '/([a-z0-9]=)\'([^"\'\\s=]+[^"\'\\s=\\/])\'(\\s(?!\\/)|>)/i', '$1$2$3', $m[2] );

    $m[2] = preg_replace( '/([a-z0-9]=)"([^"\'\\s=]+[^"\'\\s=\\/])"(\\s(?!\\/)|>)/i', '$1$2$3', $m[2] );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HTML Minify removes double quotes from HTML’ is closed to new replies.