Skip to content
Browse files

remove userdata and expose opts instead

the problem was that asyncxml deep_merges its opts which can leed to
infinitive recursion when passed an object which contains an reference
to the template again.
  • Loading branch information...
1 parent 371794e commit 88f6665c597620f8ae2e6cfc3eee5f84e9c36c89 @dodo committed
Showing with 2 additions and 4 deletions.
  1. +1 −1 package.json
  2. +1 −3 src/template.coffee
View
2 package.json
@@ -13,7 +13,7 @@
, "dependencies": {
"bufferstream": ">= 0.5.1",
"dt-stream": ">= 0.1.2",
- "asyncxml": ">= 0.4.4"}
+ "asyncxml": ">= 0.4.5"}
, "devDependencies": {
"browserify": "1.6.1",
"scopify": ">= 0.2.1",
View
4 src/template.coffee
@@ -31,8 +31,7 @@ class Template extends EventEmitter
constructor: (opts = {}, template) ->
# options
[template, opts] = [opts, {}] if typeof opts is 'function'
- userdata = opts.userdata
- opts.userdata = null # prevent infinite recursion
+ @opts = opts
# defaults
opts.encoding ?= 'utf-8'
opts.doctype ?= off
@@ -55,7 +54,6 @@ class Template extends EventEmitter
# instantiate
@xml = new ExtendedBuilder opts
@xml.template = this
- @xml.userdata = userdata
# override query
old_query = @xml.query
@xml.query = (type, tag, key) ->

0 comments on commit 88f6665

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