Skip to content

Commit 4a210ea

Browse files
Editorial: slice blob should use nullable args (#184)
SHA: d134dae Reason: push, by mkruisselbrink Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b3c637f commit 4a210ea

File tree

1 file changed

+30
-25
lines changed

1 file changed

+30
-25
lines changed

index.html

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta content="ED" name="w3c-status">
77
<meta content="Bikeshed version 63e66730b, updated Tue Oct 25 12:35:05 2022 -0700" name="generator">
88
<link href="https://www.w3.org/TR/FileAPI/" rel="canonical">
9-
<meta content="3ee8d2313cace7be8decd5b1b595eb51000b09ba" name="document-revision">
9+
<meta content="d134dae48ccdad3ad1d5fb6b1df16aa73fb0a4d4" name="document-revision">
1010
<style>/* style-autolinks */
1111

1212
.css.css, .property.property, .descriptor.descriptor {
@@ -519,7 +519,7 @@
519519
<div class="head">
520520
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
521521
<h1 class="p-name no-ref" id="title">File API</h1>
522-
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2022-11-14">14 November 2022</time></p>
522+
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2022-11-30">30 November 2022</time></p>
523523
<details open>
524524
<summary>More details about this document</summary>
525525
<div data-fill-with="spec-metadata">
@@ -818,37 +818,33 @@ <h2 class="heading settled" data-level="2" id="terminology"><span class="secno">
818818
(or 1970-01-01T00:00:00Z ISO 8601);
819819
this is the same time that is conceptually "<code>0</code>" in ECMA-262 <a data-link-type="biblio" href="#biblio-ecma-262">[ECMA-262]</a>.</p>
820820
<div class="algorithm" data-algorithm="slice blob">
821-
The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="slice-blob">slice blob</dfn> algorithm given a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑧">Blob</a></code> <var>blob</var>,
822-
an optional parameter <var>start</var>, an optional parameter <var>end</var>,
823-
and an optional parameter <var>contentType</var> is used to refer to the following
821+
The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="slice-blob">slice blob</dfn> algorithm given a <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑧">Blob</a></code> <var>blob</var>, <var>start</var>, <var>end</var>, and <var>contentType</var> is used to refer to the following
824822
steps and returns a new <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob⑨">Blob</a></code> containing the bytes ranging from the <var>start</var> parameter
825823
up to but not including the <var>end</var> parameter. It must act as follows:
826824
<ol>
827825
<li data-md>
828826
<p>Let <var>originalSize</var> be <var>blob</var>’s <code class="idl"><a data-link-type="idl" href="#dfn-size" id="ref-for-dfn-size">size</a></code>.</p>
829827
<li data-md>
830-
<p>The optional <var>start</var> parameter is a value for the start point of a <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob">slice blob</a> call, and must be treated as a byte-order position, with the zeroth position representing the
828+
<p>The <var>start</var> parameter, if non-null, is a value for the start point of a <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob">slice blob</a> call, and must be treated as a byte-order position, with the zeroth position representing the
831829
first byte. User agents must normalize <var>start</var> according to the following:</p>
832830
<ol type="a">
833-
<li>If the optional <var>start</var> parameter is not used as a parameter when making this call,
834-
let <var>relativeStart</var> be 0.
831+
<li>If <var>start</var> is null, let <var>relativeStart</var> be 0.
835832
<li>If <var>start</var> is negative, let <var>relativeStart</var> be <code>max((<var>originalSize</var> + <var>start</var>), 0)</code>.
836833
<li>Otherwise, let <var>relativeStart</var> be <code>min(<var>start</var>, <var>originalSize</var>)</code>.
837834
</ol>
838835
<li data-md>
839-
<p>The optional <var>end</var> parameter is a value for the end point of a <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob①">slice blob</a> call.
840-
User agents must normalize <var>end</var> according to the following:</p>
836+
<p>The <var>end</var> parameter, if non-null. is a value for the end point of a <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob①">slice blob</a> call. User agents must normalize <var>end</var> according to the following:</p>
841837
<ol type="a">
842-
<li>If the optional <var>end</var> parameter is not used as a parameter when making this call,
843-
let <var>relativeEnd</var> be <var>originalSize</var>.
838+
<li>If <var>end</var> is null, let <var>relativeEnd</var> be <var>originalSize</var>.
844839
<li>If <var>end</var> is negative, let <var>relativeEnd</var> be <code>max((<var>originalSize</var> + <var>end</var>), 0)</code>.
845-
<li>Else, let <var>relativeEnd</var> be <code>min(<var>end</var>, <var>originalSize</var>)</code>.
840+
<li>Otherwise, let <var>relativeEnd</var> be <code>min(<var>end</var>, <var>originalSize</var>)</code>.
846841
</ol>
847842
<li data-md>
848-
<p>The optional <var>contentType</var> parameter is used to set the ASCII-encoded string in lower
849-
case representing the media type of the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⓪">Blob</a></code>. User agents must normalize <var>contentType</var> according to the following:</p>
843+
<p>The <var>contentType</var> parameter, if non-null, is used to set the ASCII-encoded string in
844+
lower case representing the media type of the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob①⓪">Blob</a></code>. User agents must normalize <var>contentType</var> according to the following:</p>
850845
<ol type="a">
851-
<li>If the <var>contentType</var> parameter is not provided, let <var>relativeContentType</var> be set to the empty string.
846+
<li>If <var>contentType</var> is null, let <var>relativeContentType</var> be set to the empty
847+
string.
852848
<li>
853849
Otherwise, let <var>relativeContentType</var> be set to <var>contentType</var> and run the
854850
substeps below:
@@ -1262,17 +1258,25 @@ <h4 class="heading settled" data-level="3.3.1" id="slice-method-algo"><span clas
12621258
</div>
12631259
</div>
12641260
</div>
1265-
<p>The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export data-lt="slice(start, end, contentType)|slice(start, end)|slice(start)|slice()|slice(start, end, contentType), slice(start, end), slice(start), slice()" id="dfn-slice"><code>slice()</code></dfn> method
1261+
<div class="algorithm" data-algorithm="slice(start, end, contentType), slice(start, end), slice(start), slice()" data-algorithm-for="Blob">
1262+
The <dfn class="dfn-paneled idl-code" data-dfn-for="Blob" data-dfn-type="method" data-export data-lt="slice(start, end, contentType)|slice(start, end)|slice(start)|slice()|slice(start, end, contentType), slice(start, end), slice(start), slice()" id="dfn-slice"><code>slice()</code></dfn> method
12661263
returns a new <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③①">Blob</a></code> object with bytes ranging from the optional <var>start</var> parameter
12671264
up to but not including the optional <var>end</var> parameter, and with a <code class="idl"><a data-link-type="idl" href="#dfn-type" id="ref-for-dfn-type①⓪">type</a></code> attribute
1268-
that is the value of the optional <var>contentType</var> parameter. It must act as follows:</p>
1269-
<ol>
1270-
<li data-md>
1271-
<p>Return the result of <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob②">slice blob</a> given <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>, <var>start</var>, <var>end</var>,
1272-
and <var>contentType</var>.</p>
1273-
</ol>
1274-
<div class="example" id="example-0ffe45c5">
1275-
<a class="self-link" href="#example-0ffe45c5"></a> The examples below illustrate the different types of <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice③">slice()</a></code> calls possible. Since the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑦">File</a></code> interface inherits from the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③②">Blob</a></code> interface, examples are based on the use of the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑧">File</a></code> interface.
1265+
that is the value of the optional <var>contentType</var> parameter. It must act as follows:
1266+
<ol>
1267+
<li data-md>
1268+
<p>Let <var>sliceStart</var>, <var>sliceEnd</var>, and <var>sliceContentType</var> be null.</p>
1269+
<li data-md>
1270+
<p>If <var>start</var> is given, set <var>sliceStart</var> to <var>start</var>.</p>
1271+
<li data-md>
1272+
<p>If <var>end</var> is given, set <var>sliceEnd</var> to <var>end</var>.</p>
1273+
<li data-md>
1274+
<p>If <var>contentType</var> is given, set <var>sliceContentType</var> to <var>contentType</var>.</p>
1275+
<li data-md>
1276+
<p>Return the result of <a data-link-type="dfn" href="#slice-blob" id="ref-for-slice-blob②">slice blob</a> given <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this">this</a>, <var>sliceStart</var>, <var>sliceEnd</var>, and <var>sliceContentType</var>.</p>
1277+
</ol>
1278+
<div class="example" id="example-0ffe45c5">
1279+
<a class="self-link" href="#example-0ffe45c5"></a> The examples below illustrate the different types of <code class="idl"><a data-link-type="idl" href="#dfn-slice" id="ref-for-dfn-slice③">slice()</a></code> calls possible. Since the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑦">File</a></code> interface inherits from the <code class="idl"><a data-link-type="idl" href="#dfn-Blob" id="ref-for-dfn-Blob③②">Blob</a></code> interface, examples are based on the use of the <code class="idl"><a data-link-type="idl" href="#dfn-file" id="ref-for-dfn-file⑧">File</a></code> interface.
12761280
<pre class="lang-javascript highlight"><c- c1>// obtain input element through DOM</c->
12771281

12781282
<c- a>var</c-> file <c- o>=</c-> document<c- p>.</c->getElementById<c- p>(</c-><c- t>'file'</c-><c- p>).</c->files<c- p>[</c-><c- mf>0</c-><c- p>];</c->
@@ -1298,6 +1302,7 @@ <h4 class="heading settled" data-level="3.3.1" id="slice-method-algo"><span clas
12981302
<c- a>var</c-> fileNoMetadata <c- o>=</c-> file<c- p>.</c->slice<c- p>(</c-><c- mf>0</c-><c- p>,</c-> <c- o>-</c-><c- mf>150</c-><c- p>,</c-> <c- u>"application/experimental"</c-><c- p>);</c->
12991303
<c- p>}</c->
13001304
</pre>
1305+
</div>
13011306
</div>
13021307
<h4 class="heading settled" data-level="3.3.2" id="stream-method-algo"><span class="secno">3.3.2. </span><span class="content">The <code class="idl"><a data-link-type="idl" href="#dom-blob-stream" id="ref-for-dom-blob-stream①">stream()</a></code> method</span><a class="self-link" href="#stream-method-algo"></a></h4>
13031308
<div class="mdn-anno wrapped">

0 commit comments

Comments
 (0)