question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

innerText implementation

See original GitHub issue

jsdom is a great tool for web scraping. However the textContent is a very inconvenient way to get readable text for html2text conversion.

There is a wonderful article about usefulness of negligible innerText in many cases:

http://perfectionkills.com/the-poor-misunderstood-innerText/

The author suggests getSelection().toString() as a very slow workaround, but getSelection is not implemented in the jsdom yet.

Could you consider an implementing of the innerText in the jsdom? The author has done a great exploration about it, he has even added a simple spec at the end.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:106
  • Comments:37 (15 by maintainers)

github_iconTop GitHub Comments

113reactions
domeniccommented, Sep 25, 2015

So, innerText is not standard, and not implemented in at least one major engine (Firefox). Without a standard, I don’t think we should implement it.

53reactions
Bnayacommented, Jan 25, 2018

Just use headless chrome 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript innerText | Syntax | Examples to Implement - eduCBA
innerText type property in JavaScript is majorly used for writing the dynamic text on any HTML document which will not only get interpreted...
Read more >
A JavaScript implementation of innerText (not innerHtml) for ...
A JavaScript implementation of innerText (not innerHtml) for FireFox and non-IE browsers. ... But, innerText is only available on IE. Poop.
Read more >
HTMLElement.innerText - Web APIs | MDN
The innerText property of the HTMLElement interface represents the rendered text content of a node and its descendants.
Read more >
HTML DOM Element innerText Property - W3Schools
innerHTML, innerText and textContent. The innerHTML property returns: The text content of the element, including all spacing and inner HTML tags. The innerText...
Read more >
innerText is undefined in jest test - javascript - Stack Overflow
If you are using the default testEnvironment, then you are using jsdom. You can check this issue to see why it is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found