Element.visibleText

string visibleText() const

Gets the element's visible text, similar to how it would look assuming the document was HTML being displayed by a browser. This means it will attempt whitespace normalization (unless it is a <pre> tag), add \n characters for <br> tags, and I reserve the right to make it process additional css and tags in the future.

If you need specific output, use the more stable [textContent] property or iterate yourself with [tree] or a recursive function with [children].

History

Added March 25, 2022 (dub v10.8)