mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 02:20:28 +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) {
|
if(this instanceof Element) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.attributes = attributes || {};
|
this.attributes = attributes || {};
|
||||||
this.children = children || [];
|
this.children = children;
|
||||||
} else {
|
} else {
|
||||||
return new Element(type,attributes,children);
|
return new Element(type,attributes,children);
|
||||||
}
|
}
|
||||||
@ -27,17 +27,22 @@ Element.prototype = new Node();
|
|||||||
Element.prototype.constructor = Element;
|
Element.prototype.constructor = Element;
|
||||||
|
|
||||||
Element.prototype.clone = function() {
|
Element.prototype.clone = function() {
|
||||||
var childClones = [];
|
var childClones;
|
||||||
|
if(this.children) {
|
||||||
|
childClones = [];
|
||||||
for(var t=0; t<this.children.length; t++) {
|
for(var t=0; t<this.children.length; t++) {
|
||||||
childClones.push(this.children[t].clone());
|
childClones.push(this.children[t].clone());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return new Element(this.type,this.attributes,childClones);
|
return new Element(this.type,this.attributes,childClones);
|
||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.execute = function(parents,tiddlerTitle) {
|
Element.prototype.execute = function(parents,tiddlerTitle) {
|
||||||
|
if(this.children) {
|
||||||
for(var t=0; t<this.children.length; t++) {
|
for(var t=0; t<this.children.length; t++) {
|
||||||
this.children[t].execute(parents,tiddlerTitle);
|
this.children[t].execute(parents,tiddlerTitle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Element.prototype.render = function(type) {
|
Element.prototype.render = function(type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user