From a46a0c41dc471747c9bc931dfa16934c04153f98 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Tue, 7 Feb 2017 10:57:48 +0100 Subject: [PATCH] Editorial: fix formatting of code and add new to a constructor Fixes #90. --- encoding.bs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/encoding.bs b/encoding.bs index 4f96693..a77457f 100644 --- a/encoding.bs +++ b/encoding.bs @@ -981,7 +981,8 @@ this API. UTF-8 encoded string data, the length of the second string (as a {{Uint32Array}}), the string data, and so on. -
function encodeArrayOfStrings(strings) {
+ 

+function encodeArrayOfStrings(strings) {
   var encoder, encoded, len, bytes, view, offset;
 
   encoder = new TextEncoder();
@@ -1014,7 +1015,8 @@ this API.
  format produced by the previous example, or an equivalent algorithm for encodings other than
  UTF-8, back into an array of strings.
 
- 
function decodeArrayOfStrings(buffer, encoding) {
+ 

+function decodeArrayOfStrings(buffer, encoding) {
   var decoder, view, offset, num_strings, strings, len;
 
   decoder = new TextDecoder(encoding);
@@ -1038,7 +1040,8 @@ this API.
 
 

Interface {{TextDecoder}}

-
dictionary TextDecoderOptions {
+
+dictionary TextDecoderOptions {
   boolean fatal = false;
   boolean ignoreBOM = false;
 };
@@ -1131,11 +1134,12 @@ control.
   stream. If the invocation without options's stream (or set to false) has
   no input, it's clearest to omit both arguments.
 
-  
var string = "", decoder = TextDecoder(encoding), buffer;
+  

+var string = "", decoder = new TextDecoder(encoding), buffer;
 while(buffer = next_chunk()) {
   string += decoder.decode(buffer, {stream:true});
 }
-string += decoder.decode(); // end-of-stream
+string += decoder.decode(); // end-of-stream

If the error mode is "fatal" and encoding's decoder returns error, throws a @@ -1226,7 +1230,8 @@ method, when invoked, must run these steps:

Interface {{TextEncoder}}

-
[Constructor,
+
+[Constructor,
  Exposed=(Window,Worker)]
 interface TextEncoder {
   readonly attribute DOMString encoding;