From 0d3f7592d7c0d15ba213b1c1a2a183e6e4e014a4 Mon Sep 17 00:00:00 2001 From: Herman Jensen Date: Wed, 7 Sep 2022 12:50:12 +0200 Subject: [PATCH 1/2] Remove text-decoration hack Fixes #1473 --- lib/hacks/text-decoration.js | 25 ------------------------- lib/prefixes.js | 2 -- test/cases/text-decoration.out.css | 8 ++++++-- 3 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 lib/hacks/text-decoration.js diff --git a/lib/hacks/text-decoration.js b/lib/hacks/text-decoration.js deleted file mode 100644 index 148d98a19..000000000 --- a/lib/hacks/text-decoration.js +++ /dev/null @@ -1,25 +0,0 @@ -let Declaration = require('../declaration') - -const BASIC = [ - 'none', - 'underline', - 'overline', - 'line-through', - 'blink', - 'inherit', - 'initial', - 'unset' -] - -class TextDecoration extends Declaration { - /** - * Do not add prefixes for basic values. - */ - check(decl) { - return decl.value.split(/\s+/).some(i => !BASIC.includes(i)) - } -} - -TextDecoration.names = ['text-decoration'] - -module.exports = TextDecoration diff --git a/lib/prefixes.js b/lib/prefixes.js index 2cd497a53..161d4998d 100644 --- a/lib/prefixes.js +++ b/lib/prefixes.js @@ -46,7 +46,6 @@ let hackFlexDirection = require('./hacks/flex-direction') let hackImageRendering = require('./hacks/image-rendering') let hackBackdropFilter = require('./hacks/backdrop-filter') let hackBackgroundClip = require('./hacks/background-clip') -let hackTextDecoration = require('./hacks/text-decoration') let hackJustifyContent = require('./hacks/justify-content') let hackBackgroundSize = require('./hacks/background-size') let hackGridRowColumn = require('./hacks/grid-row-column') @@ -105,7 +104,6 @@ Declaration.hack(hackFlexDirection) Declaration.hack(hackImageRendering) Declaration.hack(hackBackdropFilter) Declaration.hack(hackBackgroundClip) -Declaration.hack(hackTextDecoration) Declaration.hack(hackJustifyContent) Declaration.hack(hackBackgroundSize) Declaration.hack(hackGridRowColumn) diff --git a/test/cases/text-decoration.out.css b/test/cases/text-decoration.out.css index 87ee1f95a..fe5cc8057 100644 --- a/test/cases/text-decoration.out.css +++ b/test/cases/text-decoration.out.css @@ -11,11 +11,15 @@ } .old { - text-decoration: underline; + -webkit-text-decoration: underline; + -moz-text-decoration: underline; + text-decoration: underline; } .global { - text-decoration: unset; + -webkit-text-decoration: unset; + -moz-text-decoration: unset; + text-decoration: unset; } .skip { From 07f0c1e4a46ca131faf6ccae161c775987f65022 Mon Sep 17 00:00:00 2001 From: Herman Jensen Date: Wed, 7 Sep 2022 12:50:41 +0200 Subject: [PATCH 2/2] Update text-decoration test to verify output --- test/autoprefixer.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/autoprefixer.test.js b/test/autoprefixer.test.js index 4496564a7..d02bf39a8 100644 --- a/test/autoprefixer.test.js +++ b/test/autoprefixer.test.js @@ -1139,8 +1139,11 @@ test('add prefix for backface-visibility for Safari 9', () => { test('supports text-decoration', () => { let input = read('text-decoration') + let output = read('text-decoration.out') let instance = prefixer('text-decoration') let result = postcss([instance]).process(input) + + equal(universalizer(result.css), universalizer(output)) equal( result.warnings().map(i => i.toString()), [