proper subclass on cloned

This commit is contained in:
Adam D. Ruppe 2013-06-21 21:41:55 -04:00
parent 7f6c62458e
commit dddd9d1b22
1 changed files with 8 additions and 2 deletions

10
dom.d
View File

@ -1866,7 +1866,10 @@ class Element {
body { body {
+/ +/
{ {
auto e = new Element(parentDocument, tagName, attributes.dup, selfClosed); auto e = Element.make(this.tagName);
e.parentDocument = this.parentDocument;
e.attributes = this.attributes.dup;
e.selfClosed = this.selfClosed;
foreach(child; children) { foreach(child; children) {
e.appendChild(child.cloned); e.appendChild(child.cloned);
} }
@ -1880,7 +1883,10 @@ class Element {
return this.cloned; return this.cloned;
// shallow clone // shallow clone
auto e = new Element(parentDocument, tagName, attributes.dup, selfClosed); auto e = Element.make(this.tagName);
e.parentDocument = this.parentDocument;
e.attributes = this.attributes.dup;
e.selfClosed = this.selfClosed;
return e; return e;
} }