Skip to content
Merged
Changes from all commits
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
43 changes: 31 additions & 12 deletions encoding.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,23 +1851,41 @@ 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>".

<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><a>Set up a text decoder stream</a> with <a>this</a>, <var>encoding</var>,
<var>errorMode</var>, and <var>options</var>["{{TextDecoderOptions/ignoreBOM}}"].
</ol>
</div>

<li><p>Set <a>this</a>'s <a for=TextDecoderCommon>ignore BOM</a> to
<var>options</var>["{{TextDecoderOptions/ignoreBOM}}"].
<div algorithm>
<p>To <dfn export>set up a text decoder stream</dfn> given a {{TextDecoderStream}} object
<var>stream</var>, an optional [=/encoding=] <var>encoding</var> (default <a>UTF-8</a>), 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:

<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>.
<ol>
Comment thread
noamr marked this conversation as resolved.
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.

Newline above this ol.

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.

Fixed

<li><p><a>Assert</a>: <var>encoding</var> is not <a>replacement</a>.

<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>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>.

<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>.
<li><p>Let <var>flushAlgorithm</var> be an algorithm which takes no arguments and runs the <a>flush
and enqueue</a> algorithm with <var>stream</var>.

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

Expand All @@ -1877,7 +1895,8 @@ 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=GenericTransformStream>transform</a> to
<var>transformStream</var>.
</ol>
</div>

Expand Down