mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +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:
parent
acac9b4452
commit
d0dff80d6d
@ -354,7 +354,13 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
|
|||||||
if(index === undefined) {
|
if(index === undefined) {
|
||||||
// The list element isn't there, so we need to insert it
|
// 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.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
|
// Ask the listview to animate the insertion
|
||||||
if(this.listview && this.listview.insert) {
|
if(this.listview && this.listview.insert) {
|
||||||
this.listview.insert(t);
|
this.listview.insert(t);
|
||||||
|
Loading…
Reference in New Issue
Block a user