Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions encoding.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,23 +1851,31 @@ constructor steps are:

<li><p>If <var>encoding</var> is failure or <a>replacement</a>, then <a>throw</a> a {{RangeError}}.

<li><p>Set <a>this</a>'s <a for=TextDecoderCommon>encoding</a> to <var>encoding</var>.
<li><p>Let <var>errorMode</var> be <code>fatal</code> if <var>options</var>["{{TextDecoderOptions/fatal}}"] is true; otherwise <code>replacement</code>.
Comment thread
noamr marked this conversation as resolved.
Outdated

<li><p>If <var>options</var>["{{TextDecoderOptions/fatal}}"] is true, then set <a>this</a>'s
<a for=TextDecoderCommon>error mode</a> to "<code>fatal</code>".
<li><p>Let <var>ignoreBOM</var> be true if <var>options</var>["{{TextDecoderOptions/ignoreBOM}}"] is true; otherwise false.
Comment thread
noamr marked this conversation as resolved.
Outdated

<li><p>Set <a>this</a>'s <a for=TextDecoderCommon>ignore BOM</a> to
<var>options</var>["{{TextDecoderOptions/ignoreBOM}}"].
<li><p>Call <a>set up a text decoder stream</a> with <a>this</a>, <var>encoding</var>, <var>errorMode</var>, and <var>ignoreBOM</var>.
Comment thread
noamr marked this conversation as resolved.
Outdated

</ol>
</div>

<li><p>Set <a>this</a>'s <a for=TextDecoderCommon>decoder</a> to a new instance of <a>this</a>'s
<a for=TextDecoderCommon>encoding</a>'s <a for=/>decoder</a>, and set <a>this</a>'s
<a for=TextDecoderCommon>I/O queue</a> to a new <a for=/>I/O queue</a>.
<div algorithm>
<p>To <dfn export>set up a text decoder stream</dfn> <var>stream</var>, given an optional [=/encoding=] <var>encoding</var> (default <a>UTF-8</a>),
Comment thread
noamr marked this conversation as resolved.
Outdated
an optional <a for=/>error mode</a> <var>errorMode</var> (default <code>replacement</code>), and an optional boolean <var>ignoreBOM</var> (default false), run these steps:
Comment thread
noamr marked this conversation as resolved.
Outdated

<ol>
Comment thread
noamr marked this conversation as resolved.
<li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>encoding</a> to <var>encoding</var>.

<li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>error mode</a> to <var>errorMode</var>.

<li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>ignore BOM</a> to <var>ignoreBOM</var>.

<li><p>Let <var>transformAlgorithm</var> be an algorithm which takes a <var>chunk</var> argument
and runs the <a>decode and enqueue a chunk</a> algorithm with <a>this</a> and <var>chunk</var>.
and runs the <a>decode and enqueue a chunk</a> algorithm with <var>stream</var> and <var>chunk</var>.

<li><p>Let <var>flushAlgorithm</var> be an algorithm which takes no arguments and runs the
<a>flush and enqueue</a> algorithm with <a>this</a>.
<a>flush and enqueue</a> algorithm with <var>stream</var>.

<li><p>Let <var>transformStream</var> be a [=new=] {{TransformStream}}.

Expand All @@ -1877,7 +1885,11 @@ constructor steps are:
<a for="TransformStream/set up"><var ignore>flushAlgorithm</var></a> set to
<var>flushAlgorithm</var>.

<li><p>Set <a>this</a>'s <a for=GenericTransformStream>transform</a> to <var>transformStream</var>.
<li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>decoder</a> to a new instance of <var>encoding</var>'s <a for=/>decoder</a>.

<li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>I/O queue</a> to a new <a for=/>I/O queue</a>.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason to move these two steps further down? Making them separate steps makes sense, but it would be nicer for the diff if they are in the same place still.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done


<li><p>Set <var>stream</var>'s <a for=GenericTransformStream>transform</a> to <var>transformStream</var>.
</ol>
</div>

Expand Down