innerText implementation
See original GitHub issuejsdom 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:
- Created 8 years ago
- Reactions:106
- Comments:37 (15 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Just use headless chrome 😃