W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Proposal: Add HTMLElement.innerText

From: Adam Barth <w3c@adambarth.com>
Date: Sat, 14 Aug 2010 17:17:25 -0700
Message-ID: <AANLkTinsydXw2SwA9ttKn-H0_AqrBh1g+NC94V4uaimn@mail.gmail.com>
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:
https://bugzilla.mozilla.org/show_bug.cgi?id=343357#c2.  :)

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.

Adam
Received on Saturday, 14 August 2010 17:17:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:00 UTC