- Unsurpported in Firefox
- Supported in Chrome
- Supported in Safari
- Supported in IE
- Supported in Opera
innerText is a non-standard proprietary property introduced by
Internet Explorer and then copied by other browsers. It is not part of HTML5
or the WC3 DOM specification. Its aim is to provide a HTML to plain text conversion, as such it is
not the same as the
Each browser has implemented this property in different ways.
- Firefox does not support
- Opera does have the
innerTextproperty, but its output is completely different to IE and more like the output from the
textContentproperty, but with extra line returns.
- Chrome and Safari have a more advanced version of the
innerTextproperty, which takes into account the effects of CSS
white-spaceproperties when converting the DOM to plain text. As such they too can produce quite different outputs to the original IE functionality. IE is aware of some CSS properties but does not aways reflow the content like the webkit browsers.
Exported text from body.innerText
|The original HTML||html5elements.html||Chrome 23.0||chrome-innertext.txt|
The effects of CSS
white-space properties on the output body.innerText
|The original HTML||html5css.html||Chrome 23.0||chrome-innertext.txt|
You can use a tool such as quickdiff to compare the text files and find differences in the properties output across browsers
Note: You should exclude text encoding issues and also allow for the fact that text block’s may have been trimmed when the text was copied out of the browsers into these files
Object, method and property compatibility
|Firefox 17.0.1||Chrome 23.0||Safari 6.0.2||IE 9.0||Opera 12.11|
I found claims on the web for support for the
innerText property in IE 5.5, Opera 8, Chrome 4 and Safari 4 onwards. Support may well be found in earlier versons of these browsers. Firefox has never supported this property.