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
{{ message }}
Repository navigation
Commit 2e999c1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(html): minify by what a value decodes to, and close the tags that print (#22110)
* fix(html): rewrite a value the source spelled with character references
The rewrites ran on the source text, so a value carrying a reference was
skipped whole: `srcset` and `imagesrcset` kept their list whitespace, a
viewport `content` its spaces, an enumerated value its case, a URL its
padding. The grammars read what the value decodes to, which the printer
already had for spelling it back, so the rewrite runs on that. `style` keeps
its own decoded path. 91 findings to 59 in the sweep.
* fix(html): read a boolean attribute's presence decoded too
`checked="checked"` is the bare name; `checked="checked"`
spells the same presence and was kept whole. The decode already ran a few
lines below for spelling the value back, so it moves ahead of this check —
still guarded on the `&`, so a value without one pays nothing.
* fix(html): close a held-back start tag the printer ended up writing
An implied `<html>` / `<body>` prints in pieces: its start tag is held back
and settled only once the first piece turns out to open with whitespace, but
its end tag was decided before that, as the transparent element's. So a page
whose body starts with whitespace printed `<body>` with no `</body>`, and a
second pass added one. Both closes are worked out up front and the one that
matches the tag actually written is emitted.
* fix(html): write a rewritten value the quoting switch cannot spell
`normalizeAttributeQuotes: false` freezes the quoting, and `_writeAttribute`
answers nothing when neither the minimal nor the bare spelling is open to it
— so a referenced value the rewrite had changed fell back to the source and
kept its entity spelling. It is escaped and quoted instead, since the value
it holds is not what the switch froze.
0 commit comments