Re: arsd.dom appenChild method gives assertion message

2016-12-12 Thread Erdem via Digitalmars-d-learn
On Sunday, 11 December 2016 at 22:11:51 UTC, Adam D. Ruppe wrote: On Sunday, 11 December 2016 at 17:52:29 UTC, Erdem wrote: [...] Try something like: content.appendChild(firstElements[0].removeFromTree()); Thanks this method also works. foreach (element; firstElements) {

Re: arsd.dom appenChild method gives assertion message

2016-12-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 11 December 2016 at 18:30:53 UTC, Erdem wrote: element.parentNode = null; content.appendChild(element); That works too, but could lead to data corruption later because the other document thinks it still owns the element, but the element doesn't know that. So if you

Re: arsd.dom appenChild method gives assertion message

2016-12-11 Thread Adam D. Ruppe via Digitalmars-d-learn
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:

Re: arsd.dom appenChild method gives assertion message

2016-12-11 Thread Erdem via Digitalmars-d-learn
Ok this seems to work as expected. import arsd.dom; import std.stdio; void main() { auto document = new Document(); document.parseGarbage(` Test Document1 This is the first paragraph of our href="test.html">test document. This second paragraph also has a

arsd.dom appenChild method gives assertion message

2016-12-11 Thread Erdem via Digitalmars-d-learn
I would like to add first documents content inside a div element like this. import arsd.dom; import std.stdio; void main() { auto document = new Document(); document.parseGarbage(` Test Document1 This is the first paragraph of our href="test.html">test