Refactor name of "findNextSiblingDomNode()" method for consistency

print-window-tiddler
Jeremy Ruston 2013-10-22 18:14:16 +01:00
rodzic 40c6b6cb8f
commit 6f2dbd0978
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -142,7 +142,7 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
return this.refreshChildren(changedTiddlers);
} else {
// Replace the previous content with the empty message
var nextSibling = this.findNextSibling();
var nextSibling = this.findNextSiblingDomNode();
this.removeChildDomNodes();
this.makeChildWidgets(this.getEmptyMessage());
this.renderChildren(this.parentDomNode,nextSibling);
@ -200,9 +200,9 @@ Insert a new list item at the specified index
*/
ListWidget.prototype.insertListItem = function(index,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);
var nextSibling = newItem.findNextSibling();
var nextSibling = newItem.findNextSiblingDomNode();
newItem.render(this.parentDomNode,nextSibling);
return true;
};

Wyświetl plik

@ -356,7 +356,7 @@ Widget.prototype.refresh = function(changedTiddlers) {
Rebuild a previously rendered widget
*/
Widget.prototype.refreshSelf = function() {
var nextSibling = this.findNextSibling();
var nextSibling = this.findNextSiblingDomNode();
this.removeChildDomNodes();
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
*/
Widget.prototype.findNextSibling = function(startIndex) {
Widget.prototype.findNextSiblingDomNode = function(startIndex) {
// Refer to this widget by its index within its parents children
var parent = this.parentWidget,
index = startIndex !== undefined ? startIndex : parent.children.indexOf(this);
@ -394,7 +394,7 @@ if(index === -1) {
var grandParent = parent.parentWidget;
if(grandParent && parent.parentDomNode === this.parentDomNode) {
index = grandParent.children.indexOf(parent);
return parent.findNextSibling(index);
return parent.findNextSiblingDomNode(index);
}
return null;
};