Skip to content

Commit fb9508f

Browse files
committed
Modernize Blob constructor a tiny bit
All implementations do something different for new Blob(undefined, { type: "x/x" }). Let's do something simple. Fixes #54.
1 parent 795750f commit fb9508f

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

index.bs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ if any such underlying storage exists.
216216
Further normative definition of <a>snapshot state</a> can be found for {{File}}s.
217217

218218
<pre class="idl">
219-
[Constructor(optional sequence&lt;BlobPart> blobParts,
219+
[Constructor(optional sequence&lt;BlobPart> blobParts = [],
220220
optional BlobPropertyBag options),
221221
Exposed=(Window,Worker), Serializable]
222222
interface Blob {
@@ -278,29 +278,22 @@ which runs these steps:
278278
## Constructors ## {#constructorBlob}
279279

280280
<div algorithm="blob-constructor">
281-
The {{Blob()}} constructor can be invoked with zero or more parameters.
282281
When the {{Blob()}} constructor is invoked,
283282
user agents must run the following steps:
284283

285-
1. If invoked with zero parameters,
286-
return a new {{Blob}} object consisting of 0 bytes,
287-
with {{Blob/size}} set to 0,
288-
and with {{Blob/type}} set to the empty string.
289-
290284
1. Let |bytes| be the result of [=processing blob parts=] given {{blobParts}} and {{Blob/Blob(blobParts, options)/options}}.
291285

292-
1. If the {{BlobPropertyBag/type}} member of the optional {{Blob/Blob(blobParts, options)/options}} argument is provided
293-
and is not the empty string,
294-
run the following sub-steps:
286+
1. Let |t| be the empty string.
287+
288+
1. If {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"] does not contain any characters outside the range U+0020 to U+007E, inclusive, then:
289+
290+
1. Set |t| to {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"].
295291

296-
1. Let |t| be the {{BlobPropertyBag/type}} dictionary member.
297-
If |t| contains any characters outside the range U+0020 to U+007E,
298-
then set |t| to the empty string and return from these substeps.
299292
1. Convert every character in |t| to [=ASCII lowercase=].
300293

301294
1. Return a {{Blob}} object referring to |bytes| as its associated <a>byte</a> sequence,
302295
with its {{Blob/size}} set to the length of |bytes|,
303-
and its {{Blob/type}} set to the value of |t| from the substeps above.
296+
and its {{Blob/type}} set to |t|.
304297

305298
</div>
306299

@@ -1729,6 +1722,6 @@ This specification was originally developed by the SVG Working Group. Many thank
17291722

17301723
Thanks to Robin Berjon, Jonas Sicking and Vsevolod Shmyroff for editing the original specification.
17311724

1732-
Special thanks to Olli Pettay, Nikunj Mehta, Garrett Smith, Aaron Boodman, Michael Nordman, Jian Li, Dmitry Titov, Ian Hickson, Darin Fisher, Sam Weinig, Adrian Bateman and Julian Reschke.
1725+
Special thanks to Boris Zbarsky, Olli Pettay, Nikunj Mehta, Garrett Smith, Aaron Boodman, Michael Nordman, Jian Li, Dmitry Titov, Ian Hickson, Darin Fisher, Sam Weinig, Adrian Bateman, and Julian Reschke.
17331726

17341727
Thanks to the W3C WebApps WG, and to participants on the [email protected] listserv

0 commit comments

Comments
 (0)