Permalink
Browse files

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

…totype.
  • 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/batman.coffee
View

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

Oops, something went wrong.
View
@@ -4149,6 +4149,8 @@ class Batman.RenderContext
Batman.currentApp.get('_renderContext')
else
@base
+
+ windowWrapper: {window}
@chrixian

chrixian Mar 11, 2012

Contributor

shouldn't this be windowWrapper: Batman.container

@airhorns

airhorns Mar 11, 2012

Contributor

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

Contributor

chrixian replied Mar 11, 2012

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

Contributor

chrixian replied Mar 11, 2012

perhaps change it to windowWrapper: window?

Please sign in to comment.