Skip to content

Commit ec68b52

Browse files
authored
Preserve -webkit-box-orient when -webkit-line-clamp is present (#1511)
1 parent 46cd2cc commit ec68b52

File tree

4 files changed

+78
-2
lines changed

4 files changed

+78
-2
lines changed

lib/processor.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,13 @@ class Processor {
712712
* Some rare old values, which is not in standard
713713
*/
714714
withHackValue(decl) {
715-
return decl.prop === '-webkit-background-clip' && decl.value === 'text'
715+
return (
716+
(decl.prop === '-webkit-background-clip' && decl.value === 'text') ||
717+
// Do not remove -webkit-box-orient when -webkit-line-clamp is present.
718+
// https://github.com/postcss/autoprefixer/issues/1510
719+
(decl.prop === '-webkit-box-orient' &&
720+
decl.parent.some(d => d.prop === '-webkit-line-clamp'))
721+
)
716722
}
717723
}
718724

test/autoprefixer.test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,10 @@ test('supports text-decoration shorthand', () => {
11781178

11791179
test('supports -webkit-line-clamp', () => {
11801180
let input = read('webkit-line-clamp')
1181+
let output = read('webkit-line-clamp.out')
11811182
let result = postcss([cleaner]).process(input)
1182-
equal(result.css, input)
1183+
1184+
equal(universalizer(result.css), universalizer(output))
11831185
equal(result.warnings().length, 0)
11841186
})
11851187

test/cases/webkit-line-clamp.css

+31
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,34 @@
55
-webkit-box-orient: vertical;
66
-webkit-line-clamp: 2;
77
}
8+
9+
.simple-clamp {
10+
display: -webkit-box;
11+
-webkit-box-orient: vertical;
12+
-webkit-line-clamp: 2;
13+
}
14+
15+
.clamp-with-flex-direction {
16+
flex-direction: column;
17+
display: -webkit-box;
18+
-webkit-box-orient: vertical;
19+
-webkit-line-clamp: 2;
20+
}
21+
22+
.clamp-with-flex-direction-and-box-direction {
23+
flex-direction: column;
24+
display: -webkit-box;
25+
-webkit-box-orient: vertical;
26+
-webkit-box-direction: reverse;
27+
-webkit-line-clamp: 2;
28+
}
29+
30+
.clamp-display-webkit-box-only {
31+
display: -webkit-box;
32+
-webkit-line-clamp: 2;
33+
}
34+
35+
.clamp-display-webkit-box-orient-vertical-only {
36+
-webkit-box-orient: vertical;
37+
-webkit-line-clamp: 2;
38+
}

test/cases/webkit-line-clamp.out.css

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.limit-text {
2+
overflow: hidden;
3+
text-overflow: ellipsis;
4+
display: -webkit-box;
5+
-webkit-box-orient: vertical;
6+
-webkit-line-clamp: 2;
7+
}
8+
9+
.simple-clamp {
10+
display: -webkit-box;
11+
-webkit-box-orient: vertical;
12+
-webkit-line-clamp: 2;
13+
}
14+
15+
.clamp-with-flex-direction {
16+
flex-direction: column;
17+
display: -webkit-box;
18+
-webkit-box-orient: vertical;
19+
-webkit-line-clamp: 2;
20+
}
21+
22+
.clamp-with-flex-direction-and-box-direction {
23+
flex-direction: column;
24+
display: -webkit-box;
25+
-webkit-box-orient: vertical;
26+
-webkit-line-clamp: 2;
27+
}
28+
29+
.clamp-display-webkit-box-only {
30+
display: -webkit-box;
31+
-webkit-line-clamp: 2;
32+
}
33+
34+
.clamp-display-webkit-box-orient-vertical-only {
35+
-webkit-box-orient: vertical;
36+
-webkit-line-clamp: 2;
37+
}

0 commit comments

Comments
 (0)