diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 1e6beae25..6c3997179 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -719,46 +719,23 @@ Widget.prototype.findFirstDomNode = function() { }; /* -Entry into destroy procedure -*/ -Widget.prototype.destroyChildren = function() { - $tw.utils.each(this.children,function(childWidget) { - childWidget.destroy(); - }); -}; -/* -Legacy entry into destroy procedure +Remove any DOM nodes created by this widget or its children */ Widget.prototype.removeChildDomNodes = function() { - this.destroy(); -}; -/* -Default destroy -*/ -Widget.prototype.destroy = function() { - // call children to remove their resources - this.destroyChildren(); - // remove our resources - this.children = []; - this.removeLocalDomNodes(); -}; - -/* -Remove any DOM nodes created by this widget -*/ -Widget.prototype.removeLocalDomNodes = function() { - // If this widget has directly created DOM nodes, delete them and exit. + // If this widget has directly created DOM nodes, delete them and exit. This assumes that any child widgets are contained within the created DOM nodes, which would normally be the case if(this.domNodes.length > 0) { $tw.utils.each(this.domNodes,function(domNode) { - if(domNode.parentNode) { - domNode.parentNode.removeChild(domNode); - } + domNode.parentNode.removeChild(domNode); }); this.domNodes = []; + } else { + // Otherwise, ask the child widgets to delete their DOM nodes + $tw.utils.each(this.children,function(childWidget) { + childWidget.removeChildDomNodes(); + }); } }; - /* Invoke the action widgets that are descendents of the current widget. */ diff --git a/editions/prerelease/tiddlers/Release 5.3.1.tid b/editions/prerelease/tiddlers/Release 5.3.1.tid index b950ef3f7..9e1d1e29f 100644 --- a/editions/prerelease/tiddlers/Release 5.3.1.tid +++ b/editions/prerelease/tiddlers/Release 5.3.1.tid @@ -9,6 +9,9 @@ type: text/vnd.tiddlywiki ! Overview of v5.3.1 +! Reversions of v5.3.0 Changes + +* Reverted adding the `widget.destroy()` method because of performance concerns (see https://github.com/Jermolene/TiddlyWiki5/pull/7468) ! Plugin Improvements