History

Improve css gradients feature detection

Thibaut committed 12 years ago

Commit 20b1c021 parent eb1141c1 file · +6 −1Browse files

Unified · Split

assets/javascripts/app/app.coffee+6−1
@@ -154,7 +154,7 @@ · 153 unmodified lines
154154 classList: !!document.body.classList
155155 insertAdjacentHTML: !!document.body.insertAdjacentHTML
156156 defaultPrevented: document.createEvent('CustomEvent').defaultPrevented is false
157− cssGradients: getComputedStyle(document.querySelector('._header')).backgroundImage isnt 'none'
157+ cssGradients: supportsCssGradients()
158158
159159 for key, value of features when not value
160160 Raven.captureMessage "unsupported/#{key}"
@@ -178,4 +178,9 @@ · 17 unmodified lines
178178 isInvalidLocation: ->
179179 @config.env is 'production' and location.host.indexOf(app.config.production_host) isnt 0
180180
181+supportsCssGradients = ->
182+ el = document.createElement('div')
183+ el.style.cssText = "background-image: -webkit-linear-gradient(top, #000, #fff); background-image: linear-gradient(to top, #000, #fff);"
184+ el.style.backgroundImage.indexOf('gradient') >= 0
185+
181186 $.extend app, Events