1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Fix problem with insertBefore() on Win7/IE10

The problem is that insertBefore() on Win7/IE10 crashes if the second
parameter is undefined, rather than behaving as if the parameter is
missing, as all other browsers do. Aaargh.
This commit is contained in:
Jeremy Ruston 2013-08-24 23:28:17 +01:00
parent acac9b4452
commit d0dff80d6d

View File

@ -354,7 +354,13 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
if(index === undefined) {
// The list element isn't there, so we need to insert it
this.children.splice(t,0,this.renderer.renderTree.createRenderer(this.renderer,this.createListElement(this.list[t])));
this.renderer.domNode.insertBefore(this.children[t].renderInDom(),this.renderer.domNode.childNodes[t]);
var before = this.renderer.domNode.childNodes[t],
newNode = this.children[t].renderInDom();
if(before) {
this.renderer.domNode.insertBefore(newNode,before);
} else {
this.renderer.domNode.appendChild(newNode);
}
// Ask the listview to animate the insertion
if(this.listview && this.listview.insert) {
this.listview.insert(t);