Skip to content

Commit

Permalink
remove children when removing parent
Browse files Browse the repository at this point in the history
  • Loading branch information
dodo committed Jul 20, 2012
1 parent c9439fb commit f9bddb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/xml.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ connect_tags = (parent, child) ->
if (listener = listeners[event])?
child.removeListener?(event, listener)
listeners[event] = undefined
remove = (soft) ->
remove = (soft, noremove) ->
if this is child
parent.removeListener('removed', remove)
parent.removeListener('replaced', replace)
Expand All @@ -43,9 +43,10 @@ connect_tags = (parent, child) ->
parent.removeListener('replaced', replace)
child.removeListener('replaced', replace)
dispose()
child.remove() unless noremove
replace = (tag) ->
if this is child
remove.call(parent)
remove.call(parent, no, yes)
child = tag
wire()
else
Expand Down

0 comments on commit f9bddb9

Please sign in to comment.