Re: [whatwg/encoding] Static methods for TextEncoder and TextDecoder (PR #284)

@annevk commented on this pull request.



> @@ -1333,6 +1333,10 @@ dictionary TextDecoderOptions {
   boolean ignoreBOM = false;
 };
 
+dictionary TextDecoderOptionsWithLabel : TextDecoderOptions {
+  DOMString label = "utf-8";

I wonder if we can get away with just supporting UTF-8 here. If you need more, you get the streaming API. Perhaps not even support `fatal` or `ignoreBOM`. Also makes it easier to implement without a lot of IDL bridging.

> @@ -1351,13 +1357,17 @@ TextDecoder includes TextDecoderCommon;
 initially false.
 
 <dl class=domintro>
+ <dt>{{TextDecoder}} . <a method for=TextDecoder lt=decode()>decode([<var>input</var> [, <var>options</var>]])</a></code>

```suggestion
 <dt><code><a>TextDecoder</a> . <a method for=TextDecoder lt=decode()>decode([<var>input</var> [, <var>options</var>]])</a></code>
```

> @@ -1351,13 +1357,17 @@ TextDecoder includes TextDecoderCommon;
 initially false.
 
 <dl class=domintro>
+ <dt>{{TextDecoder}} . <a method for=TextDecoder lt=decode()>decode([<var>input</var> [, <var>options</var>]])</a></code>
+ <dd>
+  <p>Returns the result of running <a for=TextDecoderCommon>encoding</a>'s <a for=/>decoder</a>.

Below this should probably be prefixed with _decoder_'s and here it needs some rewording as there is no instance to speak of.

> @@ -1528,11 +1588,7 @@ requires buffering of scalar values.
  <var>destination</var>.
 </dl>
 
-<p>The
-<dfn constructor for=TextEncoder lt=TextEncoder() id=dom-textencoder><code>new TextEncoder()</code></dfn>
-constructor steps are to do nothing.
-
-<p>The <dfn method for=TextEncoder><code>encode(<var>input</var>)</code></dfn> method steps are:
+<p>To <a>encode an input</a> given a <a>USVString</a> <var>input</var>, run the following steps:

Needs `<dfn>`.

> @@ -1563,9 +1619,8 @@ constructor steps are to do nothing.
   </ol>
 </ol>
 
-<p>The
-<dfn method for=TextEncoder><code>encodeInto(<var>source</var>, <var>destination</var>)</code></dfn>
-method steps are:
+<p>To <a>encode a source into a destination</a> given a <a>USVString</a> <var>source</var>, and a

Needs `<dfn>`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/pull/284#pullrequestreview-1339128620
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/encoding/pull/284/review/1339128620@github.com>

Received on Tuesday, 14 March 2023 12:21:22 UTC