1

With reference to the answers available under following question - What character represents a new line in a text area

The newline character in a textarea should be CRLF though entering data in a textarea with newline generates only \n as can be seen in the snippet below -

<textarea id="one" onchange="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)"></textarea>
<button onclick="document.getElementById('contentdiv').innerText=JSON.stringify(document.getElementById('one').value)">Read Content</button>
<div id="contentdiv"></div>

Are there references/changes in the defined standards for the textarea with respect to the changed behavior seen here?

SoftEngi
  • 407
  • 4
  • 14
  • Its not entirely clear on what you are asking and where you are trying to go. Look at the reference you provided. Look at the HTML5 spec details in the answers below. – zipzit Apr 01 '22 at 18:03
  • The HTML5 spec says the newline character should be CRLF thought the current browsers are producing only CR as the newline character. – SoftEngi Apr 01 '22 at 18:09

1 Answers1

0

The link you've provided actually has an answer.

The textarea element value exists in three variants:

  1. the raw value as entered by the user, unnormalized; it may contain CR, LF, or CR LF pair;
  2. the internal value, called “API value”, where line breaks are normalized to LF (only);
  3. the submission value, where line breaks are normalized to CR LF pairs, as per Internet conventions.

Your case is number 2

Ocean Overflow
  • 339
  • 2
  • 14