1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 23:40:45 +00:00

Refactor name of "findNextSiblingDomNode()" method for consistency

This commit is contained in:
Jeremy Ruston 2013-10-22 18:14:16 +01:00
parent 40c6b6cb8f
commit 6f2dbd0978
2 changed files with 6 additions and 6 deletions

View File

@ -142,7 +142,7 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
return this.refreshChildren(changedTiddlers); return this.refreshChildren(changedTiddlers);
} else { } else {
// Replace the previous content with the empty message // Replace the previous content with the empty message
var nextSibling = this.findNextSibling(); var nextSibling = this.findNextSiblingDomNode();
this.removeChildDomNodes(); this.removeChildDomNodes();
this.makeChildWidgets(this.getEmptyMessage()); this.makeChildWidgets(this.getEmptyMessage());
this.renderChildren(this.parentDomNode,nextSibling); this.renderChildren(this.parentDomNode,nextSibling);
@ -200,9 +200,9 @@ Insert a new list item at the specified index
*/ */
ListWidget.prototype.insertListItem = function(index,title) { ListWidget.prototype.insertListItem = function(index,title) {
var newItem = this.makeChildWidget(this.makeItemTemplate(title)); var newItem = this.makeChildWidget(this.makeItemTemplate(title));
newItem.parentDomNode = this.parentDomNode; // Hack to enable findNextSibling() to work newItem.parentDomNode = this.parentDomNode; // Hack to enable findNextSiblingDomNode() to work
this.children.splice(index,0,newItem); this.children.splice(index,0,newItem);
var nextSibling = newItem.findNextSibling(); var nextSibling = newItem.findNextSiblingDomNode();
newItem.render(this.parentDomNode,nextSibling); newItem.render(this.parentDomNode,nextSibling);
return true; return true;
}; };

View File

@ -356,7 +356,7 @@ Widget.prototype.refresh = function(changedTiddlers) {
Rebuild a previously rendered widget Rebuild a previously rendered widget
*/ */
Widget.prototype.refreshSelf = function() { Widget.prototype.refreshSelf = function() {
var nextSibling = this.findNextSibling(); var nextSibling = this.findNextSiblingDomNode();
this.removeChildDomNodes(); this.removeChildDomNodes();
this.render(this.parentDomNode,nextSibling); this.render(this.parentDomNode,nextSibling);
}; };
@ -376,7 +376,7 @@ Widget.prototype.refreshChildren = function(changedTiddlers) {
/* /*
Find the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node Find the next sibling in the DOM to this widget. This is done by scanning the widget tree through all next siblings and their descendents that share the same parent DOM node
*/ */
Widget.prototype.findNextSibling = function(startIndex) { Widget.prototype.findNextSiblingDomNode = function(startIndex) {
// Refer to this widget by its index within its parents children // Refer to this widget by its index within its parents children
var parent = this.parentWidget, var parent = this.parentWidget,
index = startIndex !== undefined ? startIndex : parent.children.indexOf(this); index = startIndex !== undefined ? startIndex : parent.children.indexOf(this);
@ -394,7 +394,7 @@ if(index === -1) {
var grandParent = parent.parentWidget; var grandParent = parent.parentWidget;
if(grandParent && parent.parentDomNode === this.parentDomNode) { if(grandParent && parent.parentDomNode === this.parentDomNode) {
index = grandParent.children.indexOf(parent); index = grandParent.children.indexOf(parent);
return parent.findNextSibling(index); return parent.findNextSiblingDomNode(index);
} }
return null; return null;
}; };