Skip to content

Commit 9c49ede

Browse files
authored
Make PaintOptions example a better role model
Do not have members that are both optional and nullable. Fixes #1204.
1 parent 106f261 commit 9c49ede

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

index.bs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5036,8 +5036,8 @@ No [=extended attributes=] are applicable to dictionaries.
50365036
};
50375037

50385038
dictionary PaintOptions {
5039-
DOMString? fillPattern = "black";
5040-
DOMString? strokePattern = null;
5039+
DOMString fillPattern = "black";
5040+
DOMString strokePattern;
50415041
Point position;
50425042
};
50435043

@@ -5059,10 +5059,12 @@ No [=extended attributes=] are applicable to dictionaries.
50595059
ctx.drawRectangle(300, 200, { fillPattern: "red", position: new Point(10, 10) });
50605060
</pre>
50615061

5062-
Both fillPattern and strokePattern are given [=dictionary member/default values=],
5063-
so if they are omitted, the definition of drawRectangle can assume that they
5064-
have the given default values and not include explicit wording to handle
5065-
their non-presence.
5062+
The members of <code class="idl">PaintOptions</code> are [=dictionary member/optional=].
5063+
If <code class="idl">fillPattern</code> is omitted, the definition of
5064+
<code class="idl">drawRectangle</code> can assume that it has the given default values
5065+
and not include explicit wording to handle its omission.
5066+
<code class="idl">drawRectangle</code> needs to explicitly handle the case where
5067+
<code class="idl">strokePattern</code> and <code class="idl">position</code> are omitted.
50665068

50675069
</div>
50685070

0 commit comments

Comments
 (0)