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 e6f8598
Browse filesBrowse the repository at this point in the historyBrowse files
fix(css): keep a fallback when its overriding value is read by no engine
A later declaration only overrides an earlier one where the targets read
it. The gradient check accepted any keyword anywhere, so an invalid
`radial-gradient(red at center, blue)` dropped a valid fallback under a
browserslist target, and `dropOverriddenDeclarations` without one
assumed every later value is read. The browser equivalence suite now
also runs the corpora with that option and with sorted attributes and
token lists.
Keep a CSS fallback when the declaration overriding it is invalid or read by no shipping engine, with a browserslist target or `dropOverriddenDeclarations`.
* Drop a declaration a later one in the same block overrides even where nothing states that the target can read the later value. Off by default. With a `browserslist` target this is already done wherever every browser it names is known to read the later value, so the option only widens the case where no target is selected and there are no engines to name — which is what csso and cssnano do unconditionally. What it gives up is the fallback pair: `color:#c65d06;color:lab(50% 100 -100)` loses the hex, so an engine that cannot read `lab()` is left with nothing. A selection naming a browser the compat tables do not cover is still answered for the whole of it rather than by this option, since naming a browser states a target the option does not override.
3175
+
* Drop a declaration a later one in the same block overrides even where no target is selected, assuming the engines shipping today: wherever Chromium, Gecko and WebKit each read the later value. Off by default. With a `browserslist` target this is already done wherever every browser it names is known to read the later value, so the option only widens the case where no target is selected and there are no engines to name — which is what csso and cssnano do unconditionally. What it gives up is the fallback pair: `color:#c65d06;color:lab(50% 100 -100)` loses the hex, so an engine that cannot read `lab()` is left with nothing. A selection naming a browser the compat tables do not cover is still answered for the whole of it rather than by this option, since naming a browser states a target the option does not override.
* @property {boolean=} convertLengthUnits rewrite a length into a shorter unit it is exactly equal in (`16px` -> `1pc`); off by default because it earns nothing once the asset is compressed, and only read while printing. A time is always rewritten
4451
4451
* @property {boolean=} convertApproximateColors write a polar or Lab color as the nearest hex even where that hex only approximates it: a channel too near a `.5` boundary for two engines to round it alike, and a color outside the sRGB gamut, which hex can only clip. Off by default, and only read while printing; a space engines read through transfers of their own (`a98-rgb`, `prophoto-rgb`) is left alone either way
4452
4452
* @property {boolean=} mergeDistantRules give a rule the selectors of a later one printing the same block, and an at-rule the block of a later one stating the same condition, past the rules between them; off by default, since it reorders the cascade and is sound only where nothing between declares what the block being moved does for an element it can match — a condition between counting for what its own rules declare
4453
-
* @property {boolean=} dropOverriddenDeclarations drop a declaration a later one in the same block overrides even where nothing states that the target can read the later value; off by default, and only read while printing. With a `browserslist` selection the drop is already made wherever every browser it names is known to read the later value, so this widens the case where no target is selected — a selection naming a browser the tables do not cover still answers for the whole of it
4453
+
* @property {boolean=} dropOverriddenDeclarations drop a declaration a later one in the same block overrides even where no target is selected, wherever Chromium, Gecko and WebKit each read the later value; off by default, and only read while printing. With a `browserslist` selection the drop is already made wherever every browser it names is known to read the later value, so this widens the case where no target is selected — a selection naming a browser the tables do not cover still answers for the whole of it
4454
4454
* @property {boolean=} rewriteCustomProperties shorten a custom property's value the way any other value is shortened (`--x:#ffffff` -> `#fff`); off by default because `getPropertyValue()` hands that text back, and only read while printing. What it may rewrite is what any other value's tokens may be, a color in a substitution's fallback included — that being the property's value rather than the function's own argument
4455
4455
* @property {EmbeddedSourceRenderer=} renderEmbeddedSource renders source this stylesheet embeds: the payload of a `url()` `data:` URL whose media type names a language webpack knows (SVG, CSS, HTML, JSON, JavaScript). Absent, a data URL is emitted exactly as written
4456
4456
* @property {{ [name: string]: string }=} pseudoClasses each pseudo-class to write as a class instead (`{ "focus-visible": "focus-visible" }`), so a script can apply it where the engine does not. Only read while printing
Copy file name to clipboardExpand all lines: schemas/WebpackOptions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4125,7 +4125,7 @@
4125
4125
"added": "5.112.0"
4126
4126
},
4127
4127
"dropOverriddenDeclarations": {
4128
-
"description": "Drop a declaration a later one in the same block overrides even where nothing states that the target can read the later value. Off by default. With a `browserslist` target this is already done wherever every browser it names is known to read the later value, so the option only widens the case where no target is selected and there are no engines to name — which is what csso and cssnano do unconditionally. What it gives up is the fallback pair: `color:#c65d06;color:lab(50% 100 -100)` loses the hex, so an engine that cannot read `lab()` is left with nothing. A selection naming a browser the compat tables do not cover is still answered for the whole of it rather than by this option, since naming a browser states a target the option does not override.",
4128
+
"description": "Drop a declaration a later one in the same block overrides even where no target is selected, assuming the engines shipping today: wherever Chromium, Gecko and WebKit each read the later value. Off by default. With a `browserslist` target this is already done wherever every browser it names is known to read the later value, so the option only widens the case where no target is selected and there are no engines to name — which is what csso and cssnano do unconditionally. What it gives up is the fallback pair: `color:#c65d06;color:lab(50% 100 -100)` loses the hex, so an engine that cannot read `lab()` is left with nothing. A selection naming a browser the compat tables do not cover is still answered for the whole of it rather than by this option, since naming a browser states a target the option does not override.",
Copy file name to clipboardExpand all lines: test/configCases/css/minimize-drop-overridden-declarations/__snapshots__/ConfigCacheTest.snap
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,5 +12,7 @@ Array [
12
12
engine and the earlier goes whatever this option says */.t12{--x:lab(50%100-100)}",
13
13
"/*! a rule between them parts the two, so neither overrides the other */.t13{color:red;& .inner{color:lime}color:blue}",
14
14
"/*! a keyframe ignores \`!important\`, so one there stands over nothing */@keyframes t14{0%{color:red!important;color:blue}}",
15
+
"/*! no shipping engine reads a later value that is invalid or names what none
16
+
of them has, so the earlier one is what they all use and stays */.t15{background-image:linear-gradient(red,blue);background-image:radial-gradient(redatcenter,blue)}.t16{color:red;color:device-cmyk(0110)}",
Copy file name to clipboardExpand all lines: test/configCases/css/minimize-drop-overridden-declarations/__snapshots__/ConfigTest.snap
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -12,5 +12,7 @@ Array [
12
12
engine and the earlier goes whatever this option says */.t12{--x:lab(50%100-100)}",
13
13
"/*! a rule between them parts the two, so neither overrides the other */.t13{color:red;& .inner{color:lime}color:blue}",
14
14
"/*! a keyframe ignores \`!important\`, so one there stands over nothing */@keyframes t14{0%{color:red!important;color:blue}}",
15
+
"/*! no shipping engine reads a later value that is invalid or names what none
16
+
of them has, so the earlier one is what they all use and stays */.t15{background-image:linear-gradient(red,blue);background-image:radial-gradient(redatcenter,blue)}.t16{color:red;color:device-cmyk(0110)}",
0 commit comments