[whatwg] Proposal: Add HTMLElement.innerText
w3c at adambarth.com
Sat Aug 14 17:17:25 PDT 2010
On Sat, Aug 14, 2010 at 5:04 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Sat, 14 Aug 2010, Adam Barth wrote:
>> We should expose a property on HTMLElement similar to innerHTML called
>> innerText. When assigning a string to innerText, the string is placed
>> in a text node (and is not parsed as HTML).
> How would this differ from textContent?
Looks like main difference is newline normalization and what gets
included when you read the property. Well, that and I didn't know
about textContent. :)
>> HTMLElement.innerText appears to be deployed in Internet Explorer,
>> Chrome, Safari, and Opera. However, the API is missing from Firefox and
>> the HTML5 spec. (Note the existing implementations of the API seem to
>> do some work around newline normalization, which we should consider when
>> adding the API to the specification.)
> I'm happy to add it if it's needed for compat, but the feature itself is
> already available in the DOM. Is it needed for compat?
That's difficult to say given that it's supported in most browsers.
We'd need to look for folks complaining to Mozilla. There's a tree of
duplicate bug reports that lead to
<https://bugzilla.mozilla.org/show_bug.cgi?id=264412>, but none since
2006. In 2006, you said you'd probably add it to HTML5:
I doubt that IE or WebKit will remove support at this point, which
leaves this as an inviting interoperability trap for developers who
don't test in every browser.
More information about the whatwg