This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 10301 - HTMLOptionElement.text should not be identical to .textContent - causes interop issues with web content
Summary: HTMLOptionElement.text should not be identical to .textContent - causes inter...
Status: CLOSED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://dev.w3.org/html5/spec/Overview...
Whiteboard:
Keywords: NE
Depends on:
Blocks:
 
Reported: 2010-08-05 23:10 UTC by Adrian Bateman [MSFT]
Modified: 2010-10-21 18:35 UTC (History)
5 users (show)

See Also:


Attachments
Test case (1.29 KB, text/html)
2010-08-05 23:10 UTC, Adrian Bateman [MSFT]
Details

Description Adrian Bateman [MSFT] 2010-08-05 23:10:30 UTC
Created attachment 906 [details]
Test case

The spec says:

  The text IDL attribute, on getting, must return the same value
  as the textContent IDL attribute on the element, and on setting,
  must act as if the textContent IDL attribute on the element had
  been set to the new value.

In IE9 Preview 4 we have implemented support for HTMLOptionElement.text by following this requirement. We have discovered that it causes interop issues related to whitespace on existing content on the web. Other browsers do not follow this behaviour.

We propose that "The text IDL attribute, on getting, must return the same value as the textContent IDL attribute on the element" be replaced as follows:

  The text IDL attribute, on getting, must run the following
  algorithm:

  1. Let value be a concatenation of the data of all the
     descendant text nodes of the option element, in tree
     order

  2. Replace any sequence of one or more consecutive space
     characters in value with a single U+0020 SPACE character.

  3. Remove any leading or trailing space characters in value.

  4. Return value.

This change appears to be compatible with current browser implementations.
Comment 1 Ian 'Hixie' Hickson 2010-09-10 22:39:02 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Good catch, thanks!
Comment 2 contributor 2010-09-10 22:39:27 UTC
Checked in as WHATWG revision r5466.
Check-in comment: HTMLOptionElement.text collapses spaces.
http://html5.org/tools/web-apps-tracker?from=5465&to=5466