mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 18:10:27 +00:00
Fixed problem with element child nodes being created during cloning
This commit is contained in:
parent
52a6b1036c
commit
ff8ef8b8d2
@ -17,7 +17,7 @@ var Element = function(type,attributes,children) {
|
||||
if(this instanceof Element) {
|
||||
this.type = type;
|
||||
this.attributes = attributes || {};
|
||||
this.children = children || [];
|
||||
this.children = children;
|
||||
} else {
|
||||
return new Element(type,attributes,children);
|
||||
}
|
||||
@ -27,17 +27,22 @@ Element.prototype = new Node();
|
||||
Element.prototype.constructor = Element;
|
||||
|
||||
Element.prototype.clone = function() {
|
||||
var childClones = [];
|
||||
var childClones;
|
||||
if(this.children) {
|
||||
childClones = [];
|
||||
for(var t=0; t<this.children.length; t++) {
|
||||
childClones.push(this.children[t].clone());
|
||||
}
|
||||
}
|
||||
return new Element(this.type,this.attributes,childClones);
|
||||
};
|
||||
|
||||
Element.prototype.execute = function(parents,tiddlerTitle) {
|
||||
if(this.children) {
|
||||
for(var t=0; t<this.children.length; t++) {
|
||||
this.children[t].execute(parents,tiddlerTitle);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Element.prototype.render = function(type) {
|
||||
|
Loading…
Reference in New Issue
Block a user