Bug 169600 - innerText setter inserts empty text node if value starts with newline
Summary: innerText setter inserts empty text node if value starts with newline
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:
Blocks:
 
Reported: 2017-03-14 06:53 PDT by Simon Pieters (:zcorpan)
Modified: 2017-03-18 12:51 PDT (History)
10 users (show)

See Also:


Attachments
WIP patch (3.96 KB, patch)
2017-03-17 12:09 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (6.99 KB, patch)
2017-03-17 12:43 PDT, 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) 2017-03-14 06:53:07 PDT
+++ This bug was initially created as a clone of Bug #160971 +++

<!DOCTYPE html>
<body>
<script>document.body.innerText = '\nfoo'</script>

The body will have 3 children (empty text node, <br>, text node "foo"), expect 2 (<br>, text node "foo").


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: https://github.com/w3c/web-platform-tests/pull/3492

Fail	Start with CR	assert_not_equals: Should not have empty text nodes got disallowed value ""
Fail	Start with LF	assert_not_equals: Should not have empty text nodes got disallowed value ""
Fail	Start with CRLF	assert_not_equals: Should not have empty text nodes got disallowed value ""
Comment 1 Chris Dumez 2017-03-17 10:47:34 PDT
http://w3c-test.org/innerText/setter.html
Comment 2 Chris Dumez 2017-03-17 12:09:55 PDT
Created attachment 304806 [details]
WIP patch
Comment 3 Chris Dumez 2017-03-17 12:43:35 PDT
Created attachment 304810 [details]
Patch
Comment 4 WebKit Commit Bot 2017-03-18 12:51:51 PDT
Comment on attachment 304810 [details]
Patch

Clearing flags on attachment: 304810

Committed r214136: <http://trac.webkit.org/changeset/214136>
Comment 5 WebKit Commit Bot 2017-03-18 12:51:59 PDT
All reviewed patches have been landed.  Closing bug.