1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-12 12:59:57 +00:00

Robustify widget.removeLocalDomNodes

Otherwise we get crashes if the DOM nodes generated by a widget have been subsequently modified by something like MathJax – see https://talk.tiddlywiki.org/t/tw-5-3-0-js-exception/7488/2
This commit is contained in:
jeremy@jermolene.com 2023-07-06 09:56:39 +01:00
parent 0c64b58cfb
commit 29b5b064d6

View File

@ -750,7 +750,9 @@ 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.
if(this.domNodes.length > 0) { if(this.domNodes.length > 0) {
$tw.utils.each(this.domNodes,function(domNode) { $tw.utils.each(this.domNodes,function(domNode) {
domNode.parentNode.removeChild(domNode); if(domNode.parentNode) {
domNode.parentNode.removeChild(domNode);
}
}); });
this.domNodes = []; this.domNodes = [];
} }