Bug 173878

Summary: Match newly-clarified spec on textarea defaultValue/value/child text content
Product: WebKit Reporter: Domenic Denicola <d>
Component: FormsAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, darin, sam, webkit-bug-importer, wenson_hsieh
Priority: P2    
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP Patch
none
Patch
none
Patch none

Description Domenic Denicola 2017-06-27 09:21:51 PDT
In https://github.com/whatwg/html/issues/2752 and https://github.com/whatwg/html/issues/2750 it was discovered that various aspects of the textarea spec were confusing and did not match browser behavior (which was generally not interoperable).

In https://github.com/whatwg/html/pull/2766 we settled on a reasonable set of semantics that matched most browsers in most aspects and was simple to implement. The main changes are:

> The child text content change steps for textarea elements must, if the element's dirty value flag is false, set the element's raw value to its child text content.

> The defaultValue IDL attribute must, on getting, return the element's child text content. On setting, it must act as the setter for the element's textContent IDL attribute.

These are tested by the tests at http://w3c-test.org/submissions/6256/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html (which will eventually end up at http://w3c-test.org/html/semantics/forms/the-textarea-element/value-defaultValue-textContent.html when https://github.com/w3c/web-platform-tests/pull/6256 is merged).

Safari Tech Preview matches most aspects of the new semantics, with the following exceptions:

- The defaultValue getter should reflect the child text content, not the textContent (= "descendant text content"). This harmonizes it with what is actually rendered, and with the value property.
- The defaultValue setter should act as the textContent setter, i.e. it should wipe out all child nodes in addition to adding a new text node.
Comment 1 Chris Dumez 2017-08-04 10:21:26 PDT
Created attachment 317255 [details]
WIP Patch
Comment 2 Chris Dumez 2017-08-04 11:26:19 PDT
Created attachment 317261 [details]
Patch
Comment 3 Chris Dumez 2017-08-04 11:29:29 PDT
Created attachment 317262 [details]
Patch
Comment 4 WebKit Commit Bot 2017-08-04 13:49:56 PDT
Comment on attachment 317262 [details]
Patch

Clearing flags on attachment: 317262

Committed r220290: <http://trac.webkit.org/changeset/220290>
Comment 5 WebKit Commit Bot 2017-08-04 13:49:58 PDT
All reviewed patches have been landed.  Closing bug.