mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 12:07:19 +00:00
Improve the Widget.prototype.removeChildDomNodes() method so that most subclasses won't need to override it
This commit is contained in:
parent
e2d7c7aea5
commit
6f1c9d88cc
@ -63,16 +63,6 @@ BrowseWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
BrowseWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.browse = BrowseWidget;
|
exports.browse = BrowseWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -136,16 +136,6 @@ ButtonWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
ButtonWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.button = ButtonWidget;
|
exports.button = ButtonWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -103,16 +103,6 @@ CheckboxWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
CheckboxWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.checkbox = CheckboxWidget;
|
exports.checkbox = CheckboxWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -66,16 +66,6 @@ CountWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
CountWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.count = CountWidget;
|
exports.count = CountWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -175,16 +175,6 @@ DropZoneWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
DropZoneWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.dropzone = DropZoneWidget;
|
exports.dropzone = DropZoneWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -94,16 +94,6 @@ EditBitmapWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
EditBitmapWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
EditBitmapWidget.prototype.loadCanvas = function() {
|
EditBitmapWidget.prototype.loadCanvas = function() {
|
||||||
var tiddler = this.wiki.getTiddler(this.editTitle),
|
var tiddler = this.wiki.getTiddler(this.editTitle),
|
||||||
currImage = new Image();
|
currImage = new Image();
|
||||||
|
@ -247,16 +247,6 @@ EditTextWidget.prototype.saveChanges = function(text) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
EditTextWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["edit-text"] = EditTextWidget;
|
exports["edit-text"] = EditTextWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -70,16 +70,6 @@ ElementWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return this.refreshChildren(changedTiddlers) || hasChangedAttributes;
|
return this.refreshChildren(changedTiddlers) || hasChangedAttributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
ElementWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.element = ElementWidget;
|
exports.element = ElementWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -70,16 +70,6 @@ EncryptWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
EncryptWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.encrypt = EncryptWidget;
|
exports.encrypt = EncryptWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -47,16 +47,6 @@ EntityWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
EntityWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.entity = EntityWidget;
|
exports.entity = EntityWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -98,16 +98,6 @@ FieldsWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
FieldsWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.fields = FieldsWidget;
|
exports.fields = FieldsWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -169,16 +169,6 @@ LinkWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return this.refreshChildren(changedTiddlers);
|
return this.refreshChildren(changedTiddlers);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
LinkWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.link = LinkWidget;
|
exports.link = LinkWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -77,16 +77,6 @@ PasswordWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
PasswordWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.password = PasswordWidget;
|
exports.password = PasswordWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -190,16 +190,6 @@ RevealWidget.prototype.updateState = function() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
RevealWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.reveal = RevealWidget;
|
exports.reveal = RevealWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -48,16 +48,6 @@ TextNodeWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
TextNodeWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.text = TextNodeWidget;
|
exports.text = TextNodeWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -170,16 +170,6 @@ ViewWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget
|
|
||||||
*/
|
|
||||||
ViewWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.view = ViewWidget;
|
exports.view = ViewWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
@ -450,9 +450,18 @@ Widget.prototype.findFirstDomNode = function() {
|
|||||||
Remove any DOM nodes created by this widget or its children
|
Remove any DOM nodes created by this widget or its children
|
||||||
*/
|
*/
|
||||||
Widget.prototype.removeChildDomNodes = function() {
|
Widget.prototype.removeChildDomNodes = function() {
|
||||||
$tw.utils.each(this.children,function(childWidget) {
|
// 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
|
||||||
childWidget.removeChildDomNodes();
|
if(this.domNodes.length > 0) {
|
||||||
});
|
$tw.utils.each(this.domNodes,function(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();
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.widget = Widget;
|
exports.widget = Widget;
|
||||||
|
10
plugins/tiddlywiki/d3/barwidget.js
vendored
10
plugins/tiddlywiki/d3/barwidget.js
vendored
@ -199,16 +199,6 @@ BarWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
BarWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.d3bar = BarWidget;
|
exports.d3bar = BarWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
10
plugins/tiddlywiki/d3/cloudwidget.js
vendored
10
plugins/tiddlywiki/d3/cloudwidget.js
vendored
@ -128,16 +128,6 @@ CloudWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
Remove any DOM nodes created by this widget or its children
|
|
||||||
*/
|
|
||||||
CloudWidget.prototype.removeChildDomNodes = function() {
|
|
||||||
$tw.utils.each(this.domNodes,function(domNode) {
|
|
||||||
domNode.parentNode.removeChild(domNode);
|
|
||||||
});
|
|
||||||
this.domNodes = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.d3cloud = CloudWidget;
|
exports.d3cloud = CloudWidget;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user