Skip to content

Commit 1663534

Browse files
fix(css): write both text-size-adjust spellings for EdgeHTML
BCD records `-webkit-` for the feature; caniuse marks the version prefixed and resolves the name from a browser-wide `-ms-` default, which is what autoprefixer and lightningcss write. No engine is reachable to settle which EdgeHTML parsed, and one extra declaration is cheaper than a single wrong one losing the property, so both go out for 12-18.
1 parent c9a4e53 commit 1663534

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

‎lib/css/data.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5653,7 +5653,13 @@ const PREFIXED_PROPERTIES = new Map([
56535653
["firefox", 1400000, Infinity]
56545654
]
56555655
],
5656-
["-ms-text-size-adjust", [["ie_mob", 1000000, 1200000]]]
5656+
[
5657+
"-ms-text-size-adjust",
5658+
[
5659+
["ie_mob", 1000000, 1200000],
5660+
["edge", 1200000, 1900000]
5661+
]
5662+
]
56575663
]
56585664
],
56595665
[

‎test/CssSyntax.unittest.js‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5308,14 +5308,23 @@ describe("CssSyntax minify — vendor prefixes (target selection)", () => {
53085308
);
53095309
});
53105310

5311-
it("writes the spelling BCD records for old Edge, not the one its browser-wide default implies", () => {
5312-
// caniuse marks every EdgeHTML version `-ms-`, so autoprefixer and
5313-
// lightningcss both write `-ms-text-size-adjust`; BCD records the spelling
5314-
// per feature, and desktop IE — where an `-ms-` one would come from — never
5315-
// had the property at all.
5311+
it("writes both spellings for old Edge, which the two datasets disagree over", () => {
5312+
// BCD records `-webkit-` for the feature; caniuse marks the version prefixed
5313+
// and resolves the name from a browser-wide `-ms-` default, which is what
5314+
// autoprefixer and lightningcss write. Neither says why, so both go out.
53165315
expect(minifyFor("a{text-size-adjust:100%}", ["edge 15"])).toBe(
5317-
"a{-webkit-text-size-adjust:100%;text-size-adjust:100%}"
5316+
"a{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;text-size-adjust:100%}"
53185317
);
5318+
// Chromium-era Edge reads the unprefixed one, so neither is written.
5319+
expect(minifyFor("a{text-size-adjust:100%}", ["edge 79"])).toBe(
5320+
"a{text-size-adjust:100%}"
5321+
);
5322+
// And a source carrying the `-ms-` one loses it once no target needs it.
5323+
expect(
5324+
minifyFor("a{-ms-text-size-adjust:100%;text-size-adjust:100%}", [
5325+
"edge 79"
5326+
])
5327+
).toBe("a{text-size-adjust:100%}");
53195328
});
53205329

53215330
it("skips a browser no dataset covers, as lightningcss's target mapping does", () => {

‎tooling/generate-css-data.js‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4303,10 +4303,22 @@ const PREFIX_SUPPLEMENT = new Map([
43034303
// all — so a Firefox target losing the `-moz-` one is left with a declaration
43044304
// Gecko cannot parse. Desktop shares Android's style system, and so its
43054305
// version.
4306+
// EdgeHTML gets both spellings, because the two datasets name different ones
4307+
// and neither states why: BCD records `-webkit-` per feature, while caniuse
4308+
// only marks the version prefixed and resolves the spelling from a
4309+
// browser-wide `-ms-` default it applies to every feature. No engine is
4310+
// reachable to settle it, and the pair costs one declaration where a wrong
4311+
// single one costs the property.
43064312
[
43074313
"text-size-adjust",
43084314
[
4309-
["-ms-text-size-adjust", [["ie_mob", "10", "12"]]],
4315+
[
4316+
"-ms-text-size-adjust",
4317+
[
4318+
["ie_mob", "10", "12"],
4319+
["edge", "12", "19"]
4320+
]
4321+
],
43104322
["-moz-text-size-adjust", [["firefox", "14", Infinity]]]
43114323
]
43124324
],

0 commit comments

Comments
 (0)