Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove newline normalization in construct the entry list #6624

Merged
merged 3 commits into from May 20, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 7 additions & 32 deletions source
Expand Up @@ -56661,18 +56661,9 @@ fur
</ol>
</li>

<li>
<p>Otherwise, if the <var>field</var> element is a <code>textarea</code> element, <span>append
an entry</span> to <var>entry list</var> with <var>name</var> and the <span
data-x="concept-fe-value">value</span> of the <var>field</var> element, and the <var>prevent
line break normalization flag</var> set.</p>

<p class="note">In the case of the <span data-x="concept-fe-value">value</span> of
<code>textarea</code> elements, the line break normalization is already performed during the
conversion of the control's <span data-x="concept-textarea-raw-value">raw value</span> into
the control's <span data-x="concept-fe-value">value</span> (which also performs any necessary
line wrapping).</p>
</li>
<li><p>Otherwise, if the <var>field</var> element is a <code>textarea</code> element,
annevk marked this conversation as resolved.
Show resolved Hide resolved
<span>append an entry</span> to <var>entry list</var> with <var>name</var> and the <span
data-x="concept-fe-value">value</span> of the <var>field</var> element.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<textarea> is a bit of a special case in that, in the current spec text, rather than being CRLF-normalized in the "append an entry" algorithm, it's normalized before that in the textarea wrapping transformation. But on Firefox and Safari, <textarea> values as observed from the FormData constructor are LF-normalized instead. And Firefox doesn't seem to implement wrap="hard", but Safari implements it by inserting LF newlines. So the wrapping transformation would have to be changed as well, though I'm not sure how that might interact with things like minlength.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be a follow-up to adjust that algorithm accordingly or does form submission actually have to know the data came from a textarea?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it can be a follow-up.

cc @mfreed7 so they know they'll have to implement the follow-up as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's an existing issue with <textarea> it seems best separated from this. We should probably also do some cross-platform checks to ensure the LF behavior is used everywhere, if that's what we want to align on. (I'll make sure we track this in an issue before this is merged.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #6647.


<li><p>Otherwise, <span>append an entry</span> to <var>entry list</var> with <var>name</var>
and the <span data-x="concept-fe-value">value</span> of the <var>field</var> element.</p></li>
Expand Down Expand Up @@ -56717,31 +56708,15 @@ fur
<li><p>Return a <span data-x="list clone">clone</span> of <var>entry list</var>.</p></li>
</ol>

<p>To <dfn>append an entry</dfn> to <var>entry list</var>, given <var>name</var>,
<var>value</var>, and optional <var>prevent line break normalization flag</var>, run these
steps:</p>
<p>To <dfn>append an entry</dfn> to <var>entry list</var>, given <var>name</var> and
<var>value</var>, run these steps:</p>

<ol>
<li><p>For <var>name</var>, replace every occurrence of U+000D (CR) not followed by U+000A (LF),
and every occurrence of U+000A (LF) not preceded by U+000D (CR), by a string consisting of a
U+000D (CR) and U+000A (LF).</p></li>

<li><p>Set <var>name</var> to the result of <span data-x="convert">converting</span>
<var>name</var>.</p></li>
annevk marked this conversation as resolved.
Show resolved Hide resolved

<li>
<p>If <var>value</var> is not a <code>File</code> object, then:</p>

<ol>
<li><p>If the <var>prevent line break normalization flag</var> is unset, then replace every
occurrence of U+000D (CR) not followed by U+000A (LF), and every occurrence of U+000A (LF) not
preceded by U+000D (CR) in <var>value</var>, by a string consisting of a U+000D (CR) and
U+000A (LF).</p></li>

<li><p>Set <var>value</var> to the result of <span data-x="convert">converting</span>
<var>value</var>.</p></li>
</ol>
</li>
<li><p>If <var>value</var> is not a <code>File</code> object, then set <var>value</var> to the
result of <span data-x="convert">converting</span> <var>value</var>.</p></li>

<li><p><span>Create an entry</span> with <var>name</var> and <var>value</var>, and <span
data-x="list append">append</span> it to <var>entry list</var>.</p></li>
Expand Down