arsd.dom appenChild method gives assertion message

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Dec 11 14:11:51 PST 2016


On Sunday, 11 December 2016 at 17:52:29 UTC, Erdem wrote:
>    content.appendChild(firstElements[0]);
> How should one use appendChild or similiar methods
> of arsd.dom library?

You need to remove the element from the first document before 
trying to append it to another.

Try something like:

content.appendChild(firstElements[0].removeFromTree());


removeFromTree is a convenience method to do 
parentNode.removeChild(this).


Since an element can only exist in one place in a tree at a time, 
it will give the assert error if you try to add it to two places 
at once.




More information about the Digitalmars-d-learn mailing list