Element.innerText

Get the inner text of this element (ignoring html tags)

  1. string innerText [@property getter]
  2. string innerText [@property setter]
    struct Element
    @property
    void
    innerText
    (
    string text
    )

Examples

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);

Meta