Repository navigation
Commit ab83631
authored
fix(css,html): print input ending mid-construct and emptied inline CSS in the form a second pass keeps (#22290)
* fix(css,html): close what the input left open at its end
The invariants sweep now also asks idempotence of each source cut short,
since the end of the input is where the tokenizer and parser close what the
source left open, and a printer writing after it has to close it too. It
found:
- CSS: a custom property value, or text kept as written, that ran into
EOF inside a bracket, string, url, comment or after a `\` was echoed
open, and the rule's `}` printed after it was read inside it: Chromium
dropped the declaration, and each pass added another `}`. It is closed
in a stylesheet, and left as written in a `style=""`, where nothing is
printed after it and Chromium keeps it open.
- CSS: a url cut off at EOF was closed instead of normalized, so a second
pass lowercased or trimmed it; a `\` it ended on escaped its `)`.
- HTML: a kept comment or `<?…` left open at EOF swallowed the
`</body></html>` printed after it; it is closed from its data.
- HTML: an end tag the input ended inside (`</p`, `</br`) was emitted,
building the element a stray one inserts; §13.2.5.8 drops it, as the
start tag case already did. Not in raw text, which reads it as text.
- HTML: `sortAttributes` stopped short on an attribute the print drops,
which had no rank, so a second pass finished the sort.
The cuts add about two seconds to the CSS sweep: each keeps only the
top-level construct it falls in, the first one small enough. Three HTML
findings in the same family — `removeEmptyElements` and `mergeStyles`
decide on the source before the renderer has emptied or closed a body —
are recorded as owed expectations rather than fixed here.
* fix(html): decide style emptiness and merging on the rendered CSS
removeEmptyElements, removeEmptyAttributes and mergeStyles judged a <style>
or style attribute on its source, so one the renderer minified to nothing, or
closed, only changed on a second pass. The async path prints again with the
answers in hand when one overturns such a choice.
* fix(html): close a <!-- comment ending in > at end of input
A <!-- comment reads > as data, so one the input ended inside after a > was
left open and swallowed the end tags printed after it. Also reprint when a
deferred sheet answer leaves open a sheet its source closed, cut the CSS sweep
inside comments, and fold the changesets into one.
* test: read a held value last in the syntax-equivalence probe
A value left open swallowed the declaration written after it, so the raw side
set nothing once the printer started closing what the input left open.
* test: file WebKit's paint() read through the custom property probe
The two values WebKit already has filed for the unimplemented paint() now
reach the var() path too, since the printer closes what they leave open.1 parent 8735b62 commit ab83631
40 files changed
Lines changed: 1299 additions & 356 deletions
File tree
- .changeset
- lib
- css
- html
- util
- test
- configCases/html
- minimize-empty-elements
- __snapshots__
- minimize-end-of-input
- __snapshots__
- cases
- minimize-merge-styles
- __snapshots__
- minimize-sort
- __snapshots__
- specCases
- unitCases
- tooling
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10961 | 10961 | | |
10962 | 10962 | | |
10963 | 10963 | | |
10964 | | - | |
10965 | | - | |
10966 | | - | |
10967 | | - | |
10968 | | - | |
10969 | | - | |
10970 | | - | |
10971 | | - | |
10972 | | - | |
10973 | | - | |
10974 | | - | |
10975 | | - | |
10976 | | - | |
10977 | | - | |
10978 | | - | |
10979 | | - | |
| 10964 | + | |
| 10965 | + | |
| 10966 | + | |
| 10967 | + | |
| 10968 | + | |
| 10969 | + | |
10980 | 10970 | | |
10981 | 10971 | | |
10982 | 10972 | | |
10983 | 10973 | | |
10984 | | - | |
| 10974 | + | |
10985 | 10975 | | |
10986 | 10976 | | |
10987 | 10977 | | |
| |||
10992 | 10982 | | |
10993 | 10983 | | |
10994 | 10984 | | |
10995 | | - | |
10996 | | - | |
| 10985 | + | |
| 10986 | + | |
| 10987 | + | |
| 10988 | + | |
| 10989 | + | |
| 10990 | + | |
| 10991 | + | |
| 10992 | + | |
| 10993 | + | |
| 10994 | + | |
| 10995 | + | |
| 10996 | + | |
| 10997 | + | |
10997 | 10998 | | |
10998 | 10999 | | |
10999 | 11000 | | |
11000 | 11001 | | |
11001 | 11002 | | |
11002 | 11003 | | |
11003 | 11004 | | |
11004 | | - | |
| 11005 | + | |
| 11006 | + | |
| 11007 | + | |
11005 | 11008 | | |
11006 | 11009 | | |
11007 | 11010 | | |
| |||
13221 | 13224 | | |
13222 | 13225 | | |
13223 | 13226 | | |
| 13227 | + | |
| 13228 | + | |
| 13229 | + | |
| 13230 | + | |
| 13231 | + | |
| 13232 | + | |
| 13233 | + | |
| 13234 | + | |
| 13235 | + | |
| 13236 | + | |
| 13237 | + | |
| 13238 | + | |
| 13239 | + | |
| 13240 | + | |
| 13241 | + | |
| 13242 | + | |
| 13243 | + | |
| 13244 | + | |
| 13245 | + | |
| 13246 | + | |
| 13247 | + | |
| 13248 | + | |
| 13249 | + | |
| 13250 | + | |
| 13251 | + | |
| 13252 | + | |
| 13253 | + | |
| 13254 | + | |
| 13255 | + | |
| 13256 | + | |
| 13257 | + | |
| 13258 | + | |
| 13259 | + | |
| 13260 | + | |
| 13261 | + | |
| 13262 | + | |
| 13263 | + | |
| 13264 | + | |
| 13265 | + | |
| 13266 | + | |
| 13267 | + | |
| 13268 | + | |
| 13269 | + | |
| 13270 | + | |
| 13271 | + | |
| 13272 | + | |
| 13273 | + | |
| 13274 | + | |
| 13275 | + | |
| 13276 | + | |
| 13277 | + | |
| 13278 | + | |
| 13279 | + | |
| 13280 | + | |
| 13281 | + | |
| 13282 | + | |
| 13283 | + | |
| 13284 | + | |
| 13285 | + | |
| 13286 | + | |
| 13287 | + | |
| 13288 | + | |
| 13289 | + | |
| 13290 | + | |
| 13291 | + | |
| 13292 | + | |
| 13293 | + | |
| 13294 | + | |
| 13295 | + | |
| 13296 | + | |
| 13297 | + | |
| 13298 | + | |
| 13299 | + | |
| 13300 | + | |
| 13301 | + | |
| 13302 | + | |
| 13303 | + | |
| 13304 | + | |
| 13305 | + | |
| 13306 | + | |
| 13307 | + | |
| 13308 | + | |
| 13309 | + | |
| 13310 | + | |
| 13311 | + | |
| 13312 | + | |
| 13313 | + | |
| 13314 | + | |
| 13315 | + | |
| 13316 | + | |
| 13317 | + | |
| 13318 | + | |
| 13319 | + | |
| 13320 | + | |
| 13321 | + | |
| 13322 | + | |
| 13323 | + | |
| 13324 | + | |
| 13325 | + | |
| 13326 | + | |
| 13327 | + | |
| 13328 | + | |
| 13329 | + | |
| 13330 | + | |
| 13331 | + | |
13224 | 13332 | | |
13225 | 13333 | | |
13226 | 13334 | | |
| |||
15118 | 15226 | | |
15119 | 15227 | | |
15120 | 15228 | | |
| 15229 | + | |
15121 | 15230 | | |
15122 | 15231 | | |
15123 | 15232 | | |
| |||
15137 | 15246 | | |
15138 | 15247 | | |
15139 | 15248 | | |
| 15249 | + | |
15140 | 15250 | | |
15141 | 15251 | | |
15142 | 15252 | | |
| |||
15161 | 15271 | | |
15162 | 15272 | | |
15163 | 15273 | | |
| 15274 | + | |
15164 | 15275 | | |
15165 | 15276 | | |
15166 | 15277 | | |
| |||
0 commit comments