[Bug 13145] New: Spec Element.innerText

http://www.w3.org/Bugs/Public/show_bug.cgi?id=13145

           Summary: Spec Element.innerText
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: Simetrical+w3cbug@gmail.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


As discussed in this whatwg thread in February:

http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-February/030179.html

I don't know what the status is of that thread, and don't see it at a glance on
the list of pending e-mail feedback, so I'm filing a bug so I get a clear
answer.

As I said in the thread, I recommend something like the following spec text for
now:

  1. Let s be the empty string.

  2. For each descendant of the context node in tree order:

     1. If the descendant is a text node, append its data to s.

     2. If the descendant is a <br> element, append "\n" to s.

  3. Return s.

Setting should work the same as textContent.  I would also recommend a note
encouraging authors to use textContent instead if available, because innerText
is supported inconsistently -- Gecko doesn't support it as of now, and the
other three browsers return very different values on getting for the same DOM.

As described in the thread: The behavior I suggest seems to basically match
Opera.  Gecko doesn't implement innerText at all, and I found sites that don't
work right in Gecko because of it.  I also found a site that sniffs for Firefox
and uses textContent for it and innerText for everyone else.  IE9 and WebKit
both do pretty-printing of the element contents, in a complicated and
inconsistent way.  I didn't find any site that would break if innerText was
defined the same as textContent, but Maciej said he was pretty sure some sites
would break without the <br>-to-\n conversion, and Opera seems to do that.

Boris said he guessed he could live with my proposed definition.  Maciej seemed
skeptical of WebKit changing.  I don't know what Microsoft thinks, but my
personal guess would be they won't mind implementing the change in their next
standards mode.

Gecko bug: https://bugzilla.mozilla.org/show_bug.cgi?id=264412

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Tuesday, 5 July 2011 15:29:38 UTC