Bug 160971 - Align the innerText setter with the HTML spec and Gecko
Summary: Align the innerText setter with the HTML spec and Gecko
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 167023 167024
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-18 13:40 PDT by Simon Pieters (:zcorpan)
Modified: 2017-01-14 09:37 PST (History)
7 users (show)

See Also:


Attachments
WIP Patch (5.53 KB, patch)
2017-01-13 15:41 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (1.05 MB, application/zip)
2017-01-13 17:21 PST, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-elcapitan (828.47 KB, application/zip)
2017-01-13 17:30 PST, Build Bot
no flags Details
Archive of layout-test-results from ews115 for mac-elcapitan (1.65 MB, application/zip)
2017-01-13 17:32 PST, Build Bot
no flags Details
Archive of layout-test-results from ews125 for ios-simulator-wk2 (deleted)
2017-01-13 17:38 PST, Build Bot
no flags Details
Patch (17.24 KB, patch)
2017-01-13 19:05 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters (:zcorpan) 2016-08-18 13:40:20 PDT
See https://github.com/whatwg/html/issues/1679

WebKit throws for <br>.innerText = "x" etc, The spec and Gecko do not.

WebKit will update existing text node's data if element has just 1 text node.
The HTML spec and Gecko always replace with a new text node.

If the assigned value starts with a newline, WebKit/Chromium inserts an empty text node, the spec/Gecko/IE don't.

Spec at https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute

Tests at https://github.com/w3c/web-platform-tests/tree/master/innerText (these might get moved to html/ or something later)
Comment 1 Chris Dumez 2016-08-18 13:55:32 PDT
Thanks, I'll take a look.
Comment 3 Chris Dumez 2016-08-19 09:33:54 PDT
Simon, unfortunately the bugs you are reporting do not seem to be covered by the web platforms tests under innerText/? WebKit is passing 100% of the innerText setter checks.
Comment 4 Chris Dumez 2016-08-19 09:34:54 PDT
(In reply to comment #3)
> Simon, unfortunately the bugs you are reporting do not seem to be covered by
> the web platforms tests under innerText/? WebKit is passing 100% of the
> innerText setter checks.

Oh, I see now that you have PRs that have not landed yet and cover this.
Comment 5 Simon Pieters (:zcorpan) 2016-08-22 01:25:00 PDT
Yep. :-) Feel free to review the PRs.
Comment 6 Chris Dumez 2016-09-15 10:46:29 PDT
Looks like the reason <br>.innerText = "x" throws in WebKit because we were trying to match IE.
Comment 7 Chris Dumez 2016-09-15 10:49:59 PDT
(In reply to comment #6)
> Looks like the reason <br>.innerText = "x" throws in WebKit because we were
> trying to match IE.

Looks like Chrome agrees with us here.
Comment 8 Simon Pieters (:zcorpan) 2016-11-29 04:38:21 PST
Also see:
innerText: include parentheses around <rt> if there's no <rp>
https://github.com/whatwg/html/issues/1801
Comment 9 Domenic Denicola 2017-01-10 14:17:40 PST
Tests have landed for innerText (and createContextualFragment) to remove the blocklist, per https://github.com/whatwg/html/issues/2222:

- http://w3c-test.org/innerText/setter.html
- http://w3c-test.org/domparsing/createContextualFragment.html

We should probably continue to work on landing the rest of Simon's tests...
Comment 10 Chris Dumez 2017-01-13 15:41:09 PST
Created attachment 298798 [details]
WIP Patch
Comment 11 Build Bot 2017-01-13 17:21:27 PST
Comment on attachment 298798 [details]
WIP Patch

Attachment 298798 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/2885038

New failing tests:
imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
Comment 12 Build Bot 2017-01-13 17:21:30 PST
Created attachment 298813 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 13 Build Bot 2017-01-13 17:30:14 PST
Comment on attachment 298798 [details]
WIP Patch

Attachment 298798 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/2885089

New failing tests:
imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
Comment 14 Build Bot 2017-01-13 17:30:18 PST
Created attachment 298816 [details]
Archive of layout-test-results from ews101 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 15 Build Bot 2017-01-13 17:32:42 PST
Comment on attachment 298798 [details]
WIP Patch

Attachment 298798 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/2885065

New failing tests:
imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
Comment 16 Build Bot 2017-01-13 17:32:45 PST
Created attachment 298817 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 17 Build Bot 2017-01-13 17:38:25 PST
Comment on attachment 298798 [details]
WIP Patch

Attachment 298798 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2885076

New failing tests:
imported/w3c/web-platform-tests/domparsing/createContextualFragment.html
Comment 18 Build Bot 2017-01-13 17:38:30 PST
Created attachment 298819 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 19 Chris Dumez 2017-01-13 19:05:38 PST
Created attachment 298828 [details]
Patch
Comment 20 WebKit Commit Bot 2017-01-14 09:37:03 PST
Comment on attachment 298828 [details]
Patch

Clearing flags on attachment: 298828

Committed r210767: <http://trac.webkit.org/changeset/210767>
Comment 21 WebKit Commit Bot 2017-01-14 09:37:08 PST
All reviewed patches have been landed.  Closing bug.