Browse files

Move RenderContext's windowWrapper to one singleton object on the pro…

  • Loading branch information...
1 parent 77a0c97 commit 42ca26cd082a4b6d6ce6840943dfeddbc966928d @airhorns airhorns committed Mar 9, 2012
Showing with 6 additions and 4 deletions.
  1. +4 −3 lib/batman.js
  2. +2 −1 src/

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -4149,6 +4149,8 @@ class Batman.RenderContext
+ windowWrapper: {window}

chrixian Mar 11, 2012


shouldn't this be windowWrapper: Batman.container


airhorns Mar 11, 2012


When in the browser window is the value of Batman.container but in node Batman.container is node's global object. If you are in node and using something like jsdom you might have a window variable so I figured that it would be better to explicitly reference the window so the view renders in the context you expect. This assumes however the window var is available globally so Batman can even reference so it's a bit of a longshot.

Has this broken something for you? I suppose someone could actually want to wrap node's global object if they are doing rendering in node...

constructor: (@object, @parent) ->
findKey: (key) ->
@@ -4163,7 +4165,6 @@ class Batman.RenderContext
return [val, currentNode.object].map(@constructor.deProxy)
currentNode = currentNode.parent
- @windowWrapper ||= window: Batman.container
[$get(@windowWrapper, key), @windowWrapper]
get: (key) -> @findKey(key)[0]

2 comments on commit 42ca26c


chrixian replied Mar 11, 2012

ya the batman cli tool stopped working for me, complaining window didn't exist


chrixian replied Mar 11, 2012

perhaps change it to windowWrapper: window?

Please sign in to comment.