Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Blob constructor a tiny bit #125

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 8 additions & 14 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ Further normative definition of <a>snapshot state</a> can be found for {{File}}s
<xmp class="idl">
[Exposed=(Window,Worker), Serializable]
interface Blob {
constructor(optional sequence<BlobPart> blobParts,
constructor(optional sequence<BlobPart> blobParts = [],
optional BlobPropertyBag options = {});

readonly attribute unsigned long long size;
Expand Down Expand Up @@ -287,28 +287,22 @@ which runs these steps:
## Constructors ## {#constructorBlob}

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

1. If invoked with zero parameters,
return a new {{Blob}} object consisting of 0 bytes,
with {{Blob/size}} set to 0,
and with {{Blob/type}} set to the empty string.

1. Let |bytes| be the result of [=processing blob parts=] given {{blobParts}} and {{Blob/Blob(blobParts, options)/options}}.

1. If the {{BlobPropertyBag/type}} member of the {{Blob/Blob(blobParts, options)/options}} argument is not the empty string,
run the following sub-steps:
1. Let |t| be the empty string.

1. If {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"] does not contain any characters outside the range U+0020 to U+007E, inclusive, then:

1. Set |t| to {{Blob/Blob(blobParts, options)/options}}["{{BlobPropertyBag/type}}"].

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

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

</div>

Expand Down Expand Up @@ -1769,6 +1763,6 @@ This specification was originally developed by the SVG Working Group. Many thank

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

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

Thanks to the W3C WebApps WG, and to participants on the public-webapps@w3.org listserv