1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-04 18:00:44 +00:00

Fixed bug with sliders

Faulty dependency checking logic
This commit is contained in:
Jeremy Ruston 2012-03-30 18:12:21 +01:00
parent 44c7aac419
commit 75279c2b13

View File

@ -145,29 +145,27 @@ exports.macro = {
return [content]; return [content];
}, },
refreshInDom: function(changes) { refreshInDom: function(changes) {
if(this.dependencies.hasChanged(changes,this.tiddlerTitle)) { var needContentRefresh = true; // Avoid refreshing the content nodes if we don't need to
var needContentRefresh = true; // Avoid refreshing the content nodes if we don't need to // If the state tiddler has changed then reset the open state
// If the state tiddler has changed then reset the open state if(this.hasParameter("state") && changes.hasOwnProperty(this.params.state)) {
if(this.hasParameter("state") && changes.hasOwnProperty(this.params.state)) { this.isOpen = getOpenState(this);
this.isOpen = getOpenState(this); }
} // Render the content if the slider is open and we don't have any content yet
// Render the content if the slider is open and we don't have any content yet if(this.isOpen && this.content[0].children[1].children.length === 0) {
if(this.isOpen && this.content[0].children[1].children.length === 0) { // Remove the existing dom node for the body
// Remove the existing dom node for the body this.content[0].domNode.removeChild(this.content[0].children[1].domNode);
this.content[0].domNode.removeChild(this.content[0].children[1].domNode); // Get the slider content and execute it
// Get the slider content and execute it this.content[0].children[1].children = getSliderContent(this);
this.content[0].children[1].children = getSliderContent(this); this.content[0].children[1].execute(this.parents,this.tiddlerTitle);
this.content[0].children[1].execute(this.parents,this.tiddlerTitle); this.content[0].children[1].renderInDom(this.content[0].domNode,null);
this.content[0].children[1].renderInDom(this.content[0].domNode,null); needContentRefresh = false; // Don't refresh the children if we've just created them
needContentRefresh = false; // Don't refresh the children if we've just created them }
} // Set the visibility of the slider content
// Set the visibility of the slider content this.content[0].children[1].domNode.style.display = this.isOpen ? "block" : "none";
this.content[0].children[1].domNode.style.display = this.isOpen ? "block" : "none"; // Refresh any children
// Refresh any children if(needContentRefresh) {
if(needContentRefresh) { for(var t=0; t<this.content.length; t++) {
for(var t=0; t<this.content.length; t++) { this.content[t].refreshInDom(changes);
this.content[t].refreshInDom(changes);
}
} }
} }
} }