-styleProperties =
+jQuery.styleProperties =
   name: 'webkitAnimationName'
   delay: 'webkitAnimationDelay'
   direction: 'webkitAnimationDirection'

  fillStyle: 'webkitAnimationFillStyle'
  iterations: 'webkitAnimationIterationCount'

eventNames =
  animationEnd: 'webkitAnimationEnd'

jQuery.cssAnimations =

  else
    time

compileAnimations = (animations) ->
  {}.tap (css) ->
    for own propertyName, styleName of jQuery.styleProperties
      css[styleName] = (
        for own name, animation of animations
          value = animation[propertyName]
          if propertyName == 'delay' or propertyName is 'duration'
            makeCSSTime value, 0
          else
            value ? 'initial'
      ).join ', '

jQuery.event.props.push 'animationName'

jQuery.fn.cssFadeOut = (speed, easing, callback) ->
  {fadeIn, fadeOut} = jQuery.cssAnimations
  {animationEnd} = jQuery.eventNames
  
  hideCallback = (event) ->
    if event.animationName is fadeOut
      $(this)
      .css(display: 'none')
      .unbind(event.type, hideCallback)
  
  $(this)
  .cssStop(fadeIn)
  .cssAnimate(fadeOut, speed, easing, callback)
  .bind(animationEnd, hideCallback)

jQuery.fn.cssFadeIn = (speed, easing, callback) ->
  {fadeIn, fadeOut} = jQuery.cssAnimations
