<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - innerText setter inserts empty text node if value starts with newline"
   href="https://bugs.webkit.org/show_bug.cgi?id=169600">169600</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>innerText setter inserts empty text node if value starts with newline
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>HTML DOM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zcorpan&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>buildbot&#64;hotmail.com, cdumez&#64;apple.com, commit-queue&#64;webkit.org, darin&#64;apple.com, d&#64;domenic.me, rniwa&#64;webkit.org, sam&#64;webkit.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>+++ This bug was initially created as a clone of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Align the innerText setter with the HTML spec and Gecko"
   href="show_bug.cgi?id=160971">Bug #160971</a> +++

&lt;!DOCTYPE html&gt;
&lt;body&gt;
&lt;script&gt;document.body.innerText = '\nfoo'&lt;/script&gt;

The body will have 3 children (empty text node, &lt;br&gt;, text node &quot;foo&quot;), expect 2 (&lt;br&gt;, text node &quot;foo&quot;).


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

Spec at <a href="https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute">https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute</a>

Tests: <a href="https://github.com/w3c/web-platform-tests/pull/3492">https://github.com/w3c/web-platform-tests/pull/3492</a>

Fail    Start with CR    assert_not_equals: Should not have empty text nodes got disallowed value &quot;&quot;
Fail    Start with LF    assert_not_equals: Should not have empty text nodes got disallowed value &quot;&quot;
Fail    Start with CRLF    assert_not_equals: Should not have empty text nodes got disallowed value &quot;&quot;</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>