import std.array; Document doc = Document("<html><p>"); Element p = doc.byTagName("p").front; assert(p.descendants.empty); p.innerHTML = `<a href="uri">link</a>`; assert(p.descendants.front.name == "a"); assert(p.byTagName("a").front.innerText == "link"); p.byTagName("a").front.innerText = "hello"; assert(p.byTagName("a").front.innerText == "hello"); p.innerText = "plain text"; assert(p.descendants(true).front.name == "#text"); assert(p.innerText == "plain text"); assert(p.byTagName("a").empty);
Get the inner text of this element (ignoring html tags)