Skip to content

Commit

Permalink
Fix: Term element in content value gets parsed (#1414)
Browse files Browse the repository at this point in the history
* Fix: Term element in content value gets parsed

* Remove duplicate css and change check
  • Loading branch information
lukewarlow authored Jul 12, 2021
1 parent 006146d commit 4e31573
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ class Processor {
return true
}
}
if (node.type === 'decl' && node.prop === 'content') {
return true
}

return this.disabled(node, result)
}
Expand Down
16 changes: 16 additions & 0 deletions test/autoprefixer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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')
Expand Down
3 changes: 3 additions & 0 deletions test/cases/content.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a {
content: "Element 'div' not allowed as child of element 'span' in this context.";
}

0 comments on commit 4e31573

Please sign in to comment.