Skip to content

Commit

Permalink
add comment why we have to set opts.view to null
Browse files Browse the repository at this point in the history
  • Loading branch information
dodo committed Jun 7, 2012
1 parent 1dbd185 commit f38762b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/template.coffee
Expand Up @@ -31,10 +31,8 @@ class Template extends EventEmitter
constructor: (opts = {}, template) -> constructor: (opts = {}, template) ->
# options # options
[template, opts] = [opts, {}] if typeof opts is 'function' [template, opts] = [opts, {}] if typeof opts is 'function'
view = null view = opts.view
if typeof(opts.view) is not "undefined" opts.view = null # prevent infinite recursion
view = opts.view
opts.view = null
# defaults # defaults
opts.encoding ?= 'utf-8' opts.encoding ?= 'utf-8'
opts.doctype ?= off opts.doctype ?= off
Expand All @@ -57,7 +55,7 @@ class Template extends EventEmitter
# instantiate # instantiate
@xml = new ExtendedBuilder opts @xml = new ExtendedBuilder opts
@xml.template = this @xml.template = this
@xml.view = view @xml.view = view
# override query # override query
old_query = @xml.query old_query = @xml.query
@xml.query = (type, tag, key) -> @xml.query = (type, tag, key) ->
Expand Down

0 comments on commit f38762b

Please sign in to comment.