Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A polyfill for .innerText, since it's nonstandard so Firefox does not include it.
Latest commit a548f87 @duckinator Clean up README a bit.
Failed to load latest commit information. Clean up README a bit.
innertext.js It actually works now.
test.html Add test.html

HTMLElement#innerText polyfill

I am well aware that innerText is nonstandard, and should generally be avoided. However, I've ran into a few situations where textContent is utterly useless, and innerHTML opens up the usual issues that arise with embedding user-supplied HTML.

So, I decided to make a polyfill for innerText, even though it probably shouldn't be used if there's an alternative available.

IE has had innerText for a long time, so we basically only need a polyfill for Firefox. This means we can take advantage of Selection. You can find out more information about Selection on the Mozilla Developer Network (MDN).

The code's pretty self explanatory, and commented, so read that if you want to figure out how it works.

Something went wrong with that request. Please try again.