Skip to content

Commit

Permalink
Warn on old crisp-edges value
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed May 16, 2015
1 parent 3948475 commit 804c4d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions lib/hacks/image-rendering.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ class ImageRendering extends Declaration
normalize: (prop) ->
'image-rendering'

# Warn on old value
process: (node, result) ->
if @name == 'image-rendering' and node.value == 'crisp-edges'
result.warn('There is no browsers with crisp-edges rendering support.' +
'Maybe you mean pixelated?', node: node)

super

module.exports = ImageRendering
2 changes: 1 addition & 1 deletion lib/processor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Processor

prefix = @prefixes.add[decl.prop]
if prefix and prefix.prefixes
prefix.process(decl) if not @disabled(decl)
prefix.process(decl, result) if not @disabled(decl)

# Values
css.eachDecl (decl) =>
Expand Down
11 changes: 10 additions & 1 deletion test/autoprefixer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ describe 'Autoprefixer', ->
it 'ignores some 3D transforms', -> test('3d-transform')
it 'supports background-size', -> test('background-size')
it 'supports background-clip', -> test('background-clip')
it 'supports image-rendering', -> test('image-rendering')
it 'supports logical properties', -> test('logical')
it 'supports appearance', -> test('appearance')

Expand All @@ -203,6 +202,16 @@ describe 'Autoprefixer', ->
['autoprefixer: <css input>:1:1: Selector ::placeholder is ' +
'unofficial. Use :placeholder-shown instead.'])

it 'supports image-rendering', ->
input = read('image-rendering')
output = read('image-rendering.out')
result = postcss([prefixer('image-rendering')]).process(input)

result.css.should.eql(output)
result.warnings().map( (i) -> i.toString() ).should.eql(
['autoprefixer: <css input>:2:5: There is no browsers with ' +
'crisp-edges rendering support.Maybe you mean pixelated?'])

it 'warn on old flexbox display', ->
result = postcss([flexboxer]).process('a{ display: box; }')
result.css.should.eql('a{ display: box; }')
Expand Down

0 comments on commit 804c4d1

Please sign in to comment.