fallentext

A mimic implementation of [`HTMLElement.innerText`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText)

Usage no npm install needed!

<script type="module">
  import fallentext from 'https://cdn.skypack.dev/fallentext';
</script>

README

npm Node.js CI

🍂fallentext

A mimic implementation of HTMLElement.innerText

Important notes:

  • Does not take CSS styling or layout into account .
  • Treats <title> value as text, if given <html> as the root node.
  • Treats alt attribute values as text.
  • Treats SVG <title>, <desc>, <text> values as text, regardless if contained in <defs>.
  • Treats MathML <mtext> values as text.
  • Can be used with jsdom, for use with Node.js