Open jwestbrook opened 10 years ago
Currently the update() method purges all event listeners on the descendants of the called element. In your example because the span is a descendant of $('test') the 2nd update purges all the content in $('test') to make sure there are no memory leaks or dangling event listeners. I believe that checking if the current content is exactly equal to the new content then fail silently would be the best route.
Marking this as an enhancement just because I have no idea what we should do in this scenario.
previous lighthouse ticket #1692 by Hero Wanders
Calling two times element.update(content) in a row causes event handlers registered on parts of the content via
.observe()
to vanish.Handlers directly registered via .addEventListener or .onclick etc. are not affected.
Live example: Failing double update: http://jsfiddle.net/nH6PG/ Working single update: http://jsfiddle.net/BUJyt/