Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE8 doesn't support anything useful #110

Merged
merged 1 commit into from Sep 2, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 21 additions & 3 deletions dist/wow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/wow.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/wow.coffee
Expand Up @@ -46,6 +46,18 @@ MutationObserver = @MutationObserver or @WebkitMutationObserver or @MozMutationO

observe: ->

# getComputedStyle shim, from http://stackoverflow.com/a/21797294
getComputedStyle = @getComputedStyle or \
(el, pseudo) ->
@getPropertyValue = (prop) ->
prop = 'styleFloat' if prop is 'float'
prop.replace(getComputedStyleRX, (_, char)->
char.toUpperCase()
) if getComputedStyleRX.test prop
el.currentStyle?[prop] or null
@
getComputedStyleRX = /(\-([a-z]){1})/g

class @WOW
defaults:
boxClass: 'wow'
Expand Down Expand Up @@ -151,7 +163,7 @@ class @WOW
elem["#{name}"] = value
elem["#{vendor}#{name.charAt(0).toUpperCase()}#{name.substr 1}"] = value for vendor in @vendors
vendorCSS: (elem, property) ->
style = window.getComputedStyle(elem)
style = getComputedStyle(elem)
result = style.getPropertyCSSValue(property)
result = result or style.getPropertyCSSValue("-#{vendor}-#{property}") for vendor in @vendors
result
Expand All @@ -160,7 +172,7 @@ class @WOW
try
animationName = @vendorCSS(box, 'animation-name').cssText
catch # Opera, fall back to plain property value
animationName = window.getComputedStyle(box).getPropertyValue('animation-name')
animationName = getComputedStyle(box).getPropertyValue('animation-name')
if animationName is 'none'
'' # SVG/Firefox, unable to get animation name?
else
Expand Down