From 4e315738ce019f8631e40cf68b8bf3eb5f4b3494 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Mon, 12 Jul 2021 18:24:31 +0100 Subject: [PATCH] Fix: Term element in content value gets parsed (#1414) * Fix: Term element in content value gets parsed * Remove duplicate css and change check --- lib/processor.js | 3 +++ test/autoprefixer.test.ts | 16 ++++++++++++++++ test/cases/content.css | 3 +++ 3 files changed, 22 insertions(+) create mode 100644 test/cases/content.css diff --git a/lib/processor.js b/lib/processor.js index 040342600..c6ae4aabf 100644 --- a/lib/processor.js +++ b/lib/processor.js @@ -497,6 +497,9 @@ class Processor { return true } } + if (node.type === 'decl' && node.prop === 'content') { + return true + } return this.disabled(node, result) } diff --git a/test/autoprefixer.test.ts b/test/autoprefixer.test.ts index 0844732b1..a5b7a927a 100644 --- a/test/autoprefixer.test.ts +++ b/test/autoprefixer.test.ts @@ -86,6 +86,15 @@ let clipper = autoprefixer({ let example = autoprefixer({ overrideBrowserslist: ['defaults'] }) +let content = autoprefixer({ + overrideBrowserslist: [ + '> 2%', + 'last 2 years', + 'ie 11', + 'not ie_mob > 0', + 'not dead' + ] +}) function prefixer(name: string): Plugin { if ( @@ -162,6 +171,8 @@ function prefixer(name: string): Plugin { return supporter } else if (name === 'transition-spec') { return transitionSpec + } else if (name === 'content') { + return content } else { return compiler } @@ -370,6 +381,11 @@ it('transition on vendor specific rule', () => { it('ignore prefix in vendor at rules', () => { check('at-rules') }) +it('ignore content property', () => { + let input = read('content') + let result = postcss([prefixer('scope')]).process(input) + expect(result.css).toEqual(input) +}) it('uses control comments to whole scope', () => { let input = read('scope') diff --git a/test/cases/content.css b/test/cases/content.css new file mode 100644 index 000000000..865631591 --- /dev/null +++ b/test/cases/content.css @@ -0,0 +1,3 @@ +a { + content: "Element 'div' not allowed as child of element 'span' in this context."; +}