You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Remove space between attributes when after a quoted value results in invalid HTML
"Remove space between attributes when after a quoted value" results in invalid HTML
Oct 16, 2020
Thank you for the notice! This was an optimization taken from another minifier, and I was sure the spec allowed this. However, upon second inspection of the HTML spec at https://html.spec.whatwg.org/multipage/syntax.html#start-tags it becomes clear that "Attributes must be separated from each other by one or more ASCII whitespace".
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
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:
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.
The text was updated successfully, but these errors were encountered: