@@ -54726,10 +54726,30 @@ MIT Room 32-G524
5472654726
5472754727 <p>For <code>input</code> elements, these APIs must operate on the element's <span
5472854728 data-x="concept-fe-value">value</span>. For <code>textarea</code> elements, these APIs must
54729- operate on the element's <span data-x="concept-textarea-raw -value">raw value</span>. In the below
54729+ operate on the element's <span data-x="concept-fe-api -value">API value</span>. In the below
5473054730 algorithms, we call the value string being operated on the <dfn
5473154731 data-x="concept-textarea/input-relevant-value">relevant value</dfn>.</p>
5473254732
54733+ <div class="example">
54734+ <p>The use of <span data-x="concept-fe-api-value">API value</span> instead of <span
54735+ data-x="concept-textarea-raw-value">raw value</span> for <code>textarea</code> elements means
54736+ that U+000D (CR) characters are normalized away. For example,
54737+
54738+ <pre><textarea id="demo"></textarea>
54739+ <script>
54740+ demo.value = "A\r\nB";
54741+ demo.setRangeText("replaced", 0, 2);
54742+ assert(demo.value === "replacedB");
54743+ </script></pre>
54744+
54745+ <p>If we had operated on the <span data-x="concept-textarea-raw-value">raw value</span> of "<code
54746+ data-x="">A\r\nB</code>", then we would have replaced the characters "<code
54747+ data-x="">A\r</code>", ending up with a result of "<code data-x="">replaced\nB</code>". But since
54748+ we used the <span data-x="concept-fe-api-value">API value</span> of "<code
54749+ data-x="">A\nB</code>", we replaced the characters "<code data-x="">A\n</code>", giving "<code
54750+ data-x="">replacedB</code>".</p>
54751+ </div>
54752+
5473354753 <p>Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as
5473454754 characters. Thus, for instance, the selection can include just an invisible character, and the
5473554755 text insertion cursor can be placed to one side or another of such a character.</p>
0 commit comments