Skip to content

Commit 6d4f3db

Browse files
authored
update data for text-decoration (#1478)
1 parent f478661 commit 6d4f3db

File tree

5 files changed

+118
-11
lines changed

5 files changed

+118
-11
lines changed

data/prefixes.js

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,12 +659,18 @@ f(prefixPointer, browsers =>
659659
// Text decoration
660660
let prefixDecoration = require('caniuse-lite/data/features/text-decoration')
661661

662-
f(prefixDecoration, browsers =>
662+
f(prefixDecoration, { match: /x.*#[235]/ }, browsers =>
663+
prefix(['text-decoration-skip', 'text-decoration-skip-ink'], {
664+
feature: 'text-decoration',
665+
browsers
666+
})
667+
)
668+
669+
let prefixDecorationShorthand = require('caniuse-lite/data/features/mdn-text-decoration-shorthand')
670+
671+
f(prefixDecorationShorthand, browsers =>
663672
prefix(
664673
[
665-
'text-decoration-style',
666-
'text-decoration-color',
667-
'text-decoration-line',
668674
'text-decoration'
669675
],
670676
{
@@ -674,11 +680,46 @@ f(prefixDecoration, browsers =>
674680
)
675681
)
676682

677-
f(prefixDecoration, { match: /x.*#[235]/ }, browsers =>
678-
prefix(['text-decoration-skip', 'text-decoration-skip-ink'], {
679-
feature: 'text-decoration',
680-
browsers
681-
})
683+
let prefixDecorationColor = require('caniuse-lite/data/features/mdn-text-decoration-color')
684+
685+
f(prefixDecorationColor, browsers =>
686+
prefix(
687+
[
688+
'text-decoration-color'
689+
],
690+
{
691+
feature: 'text-decoration',
692+
browsers
693+
}
694+
)
695+
)
696+
697+
let prefixDecorationLine = require('caniuse-lite/data/features/mdn-text-decoration-line')
698+
699+
f(prefixDecorationLine, browsers =>
700+
prefix(
701+
[
702+
'text-decoration-line'
703+
],
704+
{
705+
feature: 'text-decoration',
706+
browsers
707+
}
708+
)
709+
)
710+
711+
let prefixDecorationStyle = require('caniuse-lite/data/features/mdn-text-decoration-style')
712+
713+
f(prefixDecorationStyle, browsers =>
714+
prefix(
715+
[
716+
'text-decoration-style'
717+
],
718+
{
719+
feature: 'text-decoration',
720+
browsers
721+
}
722+
)
682723
)
683724

684725
// Text Size Adjust

test/autoprefixer.test.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ let example = autoprefixer({
9090
let autofiller = autoprefixer({
9191
overrideBrowserslist: ['Chrome > 90', 'Firefox >= 82']
9292
})
93+
let textDecorator = autoprefixer({
94+
overrideBrowserslist: ['Chrome >= 57', 'Firefox >= 36', 'Safari >= 12.1']
95+
})
9396
let content = autoprefixer({
9497
overrideBrowserslist: [
9598
'> 2%',
@@ -137,6 +140,8 @@ function prefixer(name) {
137140
name === 'at-rules'
138141
) {
139142
return intrinsicer
143+
} else if (name === 'text-decoration-shorthand') {
144+
return textDecorator
140145
} else if (name === 'selectors' || name === 'placeholder') {
141146
return selectorer
142147
} else if (name === 'selectors' || name === 'file-selector-button') {
@@ -1139,17 +1144,29 @@ test('add prefix for backface-visibility for Safari 9', () => {
11391144

11401145
test('supports text-decoration', () => {
11411146
let input = read('text-decoration')
1147+
let output = read('text-decoration.out')
11421148
let instance = prefixer('text-decoration')
11431149
let result = postcss([instance]).process(input)
1150+
1151+
equal(universalizer(result.css), universalizer(output))
11441152
equal(
11451153
result.warnings().map(i => i.toString()),
11461154
[
1147-
'autoprefixer: <css input>:26:3: Replace text-decoration-skip: ink ' +
1155+
'autoprefixer: <css input>:32:3: Replace text-decoration-skip: ink ' +
11481156
'to text-decoration-skip-ink: auto, because spec had been changed'
11491157
]
11501158
)
11511159
})
11521160

1161+
test('supports text-decoration shorthand', () => {
1162+
let input = read('text-decoration')
1163+
let output = read('text-decoration.shorthand.out')
1164+
let instance = prefixer('text-decoration-shorthand')
1165+
let result = postcss([instance]).process(input)
1166+
1167+
equal(universalizer(result.css), universalizer(output))
1168+
})
1169+
11531170
test('supports -webkit-line-clamp', () => {
11541171
let input = read('webkit-line-clamp')
11551172
let result = postcss([cleaner]).process(input)

test/cases/text-decoration.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
text-decoration: overline double red;
33
}
44

5+
.shorthand-single-value {
6+
text-decoration: underline;
7+
}
8+
59
.full {
10+
text-decoration-color: green;
11+
text-decoration-line: line-through;
612
text-decoration-style: double;
713
}
814

test/cases/text-decoration.out.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
.shorthand {
22
-webkit-text-decoration: overline double red;
3-
-moz-text-decoration: overline double red;
43
text-decoration: overline double red;
54
}
65

6+
.shorthand-single-value {
7+
text-decoration: underline;
8+
}
9+
710
.full {
11+
-webkit-text-decoration-color: green;
12+
-moz-text-decoration-color: green;
13+
text-decoration-color: green;
14+
-webkit-text-decoration-line: line-through;
15+
-moz-text-decoration-line: line-through;
16+
text-decoration-line: line-through;
817
-webkit-text-decoration-style: double;
918
-moz-text-decoration-style: double;
1019
text-decoration-style: double;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.shorthand {
2+
-webkit-text-decoration: overline double red;
3+
text-decoration: overline double red;
4+
}
5+
6+
.shorthand-single-value {
7+
text-decoration: underline;
8+
}
9+
10+
.full {
11+
text-decoration-color: green;
12+
text-decoration-line: line-through;
13+
text-decoration-style: double;
14+
}
15+
16+
.old {
17+
text-decoration: underline;
18+
}
19+
20+
.global {
21+
text-decoration: unset;
22+
}
23+
24+
.skip {
25+
text-decoration-skip: spaces;
26+
}
27+
28+
.ink {
29+
text-decoration-skip-ink: auto;
30+
}
31+
32+
.old-ink {
33+
text-decoration-skip: ink;
34+
}

0 commit comments

Comments
 (0)