Skip to content
Browse files

Minor cleanup

  • Loading branch information...
1 parent 7d0ca6d commit c2d498372f1dc3c364076d75673e46d6c0ff6d46 @assaf committed Aug 22, 2012
Showing with 6 additions and 5 deletions.
  1. +5 −4 lib/zombie/eventloop.coffee
  2. +1 −1 package.json
View
9 lib/zombie/eventloop.coffee
@@ -38,19 +38,17 @@ class EventLoop
# the time in `timer.next`. We need to clear `next` after the timer fires or when cancelled.
window.setTimeout = (fn, delay)=>
return unless fn
- index = EventLoop.timer = (EventLoop.timer || 0) + 1
timer =
handle: null
timeout: true
# Resume timer: when created, and when entering browser.wait again.
resume: =>
return if timer.handle
timer.next = Date.now() + Math.max(delay || 0, 0)
- delay = timer.next - Date.now()
if delay <= 0
@perform (done)=>
- remove(timer)
process.nextTick =>
+ remove(timer)
@_browser.log "Firing timeout after #{delay}ms delay"
window._evaluate fn
done()
@@ -130,7 +128,10 @@ class EventLoop
dispatch: (target, event)->
preventDefault = false
@perform (done)->
- window = (target.ownerDocument || target.document).window
+ if target._evaluate
+ window = target
+ else
+ window = (target.ownerDocument || target.document).window
window._evaluate ->
preventDefault = target.dispatchEvent(event)
done()
View
2 package.json
@@ -37,7 +37,7 @@
"highlight": "~0.2.2",
"mocha": "~1.3.2",
"replay": "~1.5.3",
- "requirejs": "~2.0.6",
+ "requirejs": "~2.0.5",
"ronn": "~0.3.8"
},
"repository": {

0 comments on commit c2d4983

Please sign in to comment.
Something went wrong with that request. Please try again.