8000 "Remove space between attributes when after a quoted value" results in invalid HTML · Issue #342 · tdewolff/minify · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
"Remove space between attributes when after a quoted value" results in invalid HTML #342
Closed
@ghost

Description

After updating from 2.9.4 to a newer version, we observed that we get invalid HTML. This is likely related to the change "HTML: remove space between attributes when after a quoted value" in 2.9.5.

Raw HTML

    <meta property="og:locale" content="en_US" />
    <meta property="og:site_name" content="InfoSec Handbook – information security blog" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="InfoSec Handbook – information security blog" />
    <meta property="og:description" content="A non-profit information security blog, operated by a community of InfoSec professionals – no ads, no tracking, free and secure." />
    <meta property="og:url" content="https://infosec-handbook.eu/" />
    <meta property="og:image" content="https://infosec-handbook.eu/img/l128.pn" />

Expected result (prior to 2.9.5)

<meta property="og:locale" content="en_US"><meta property="og:site_name" content="InfoSec Handbook – information security blog"><meta property="og:type" content="website"><meta property="og:title" content="InfoSec Handbook – information security blog"><meta property="og:description" content="A non-profit information security blog, operated by a community of InfoSec professionals – no ads, no tracking, free and secure."><meta property="og:url" content="https://infosec-handbook.eu/"><meta property="og:image" content="https://infosec-handbook.eu/img/l128.png">

Actual result (2.9.5 and newer)

<meta property="og:locale"content="en_US"><meta property="og:site_name"content="InfoSec Handbook – information security blog"><meta property="og:type"content="website"><meta property="og:title"content="InfoSec Handbook – information security blog"><meta property="og:description"content="A non-profit information security blog, operated by a community of InfoSec professionals – no ads, no tracking, free and secure."><meta property="og:url"content="https://infosec-handbook.eu/"><meta property="og:image"content="https://infosec-handbook.eu/img/l128.png">

In this example, minify removes whitespaces between …" content…, resulting in …"content….

Problem

The nu HTML checker and the developer mode of web browsers (e.g., Firefox) detect this as invalid HTML:

Error: No space between attributes.
At line 1, column 846
rty="og:locale"content="en_US"

There is no minify option to disable this new behavior, introduced in 2.9.5. --html-keep-whitespace doesn't disable the behavior.

Workaround

Downgrade to minify 2.9.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0