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)
{
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
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:
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
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