Skip to content

Commit

Permalink
Add hack for -webkit-line-clamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Jul 5, 2019
1 parent 4c7f00f commit 69ed8a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ class Processor {
notHack = true
}

if (decl.prop === '-webkit-box-orient') {
let hacks = { 'flex-direction': true, 'flex-flow': true }
if (!decl.parent.some(j => hacks[j.prop])) return
}

if (notHack && !this.withHackValue(decl)) {
if (decl.raw('before').indexOf('\n') > -1) {
this.reduceSpaces(decl)
Expand Down
7 changes: 7 additions & 0 deletions test/autoprefixer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,11 @@ describe('hacks', () => {
'to text-decoration-skip-ink: auto, because spec had been changed'
])
})

it('supports -webkit-line-clamp', () => {
let input = read('webkit-line-clamp')
let result = postcss([cleaner]).process(input)
expect(result.css).toEqual(input)
expect(result.warnings()).toHaveLength(0)
})
})
7 changes: 7 additions & 0 deletions test/cases/webkit-line-clamp.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.limit-text {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}

0 comments on commit 69ed8a0

Please sign in to comment.