   count = 0
   getHandle = -> "go#{++count}"
 
-  if container.setImmediate
+  if container.setImmediate and container.clearImmediate
     Batman.setImmediate = container.setImmediate
     Batman.clearImmediate = container.clearImmediate
-  else if container.msSetImmediate
+  else if container.msSetImmediate and container.msClearImmediate
     Batman.setImmediate = msSetImmediate
     Batman.clearImmediate = msClearImmediate
   else if canUsePostMessage()

    node = node.parentNode
  false

Batman.setImmediate = Batman.clearImmediate = null
_implementImmediates = (container) ->
  canUsePostMessage = ->
    return false unless container.postMessage

    Batman.setImmediate = (f) -> setTimeout(f, 0)
    Batman.clearImmediate = (handle) -> clearTimeout(handle)

Batman.setImmediate = ->
  _implementImmediates(Batman.container)
  Batman.setImmediate.apply(@, arguments)
