Skip to content

Commit efc5676

Browse files
jpmedleyteoli2003rachelandrew
authored
Fix constructors with multiple sets of arguments. (mdn#8572)
* Fix constructors with multiple sets of arguments. * Fix http. * Update files/en-us/web/api/passwordcredential/passwordcredential/index.html Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com> * Update files/en-us/web/api/keyframeeffect/keyframeeffect/index.html Co-authored-by: Rachel Andrew <me@rachelandrew.co.uk> Co-authored-by: Jean-Yves Perrier <jypenator@gmail.com> Co-authored-by: Rachel Andrew <me@rachelandrew.co.uk>
1 parent 83c5afc commit efc5676

File tree

7 files changed

+59
-52
lines changed

7 files changed

+59
-52
lines changed

files/en-us/web/api/imagedata/imagedata/index.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,27 @@
2020

2121
<h2 id="Syntax">Syntax</h2>
2222

23-
<pre class="brush: js">new ImageData(<em>array</em>, <em>width</em> [, <em>height</em>]);
24-
new ImageData(<em>width</em>, <em>height</em>);
25-
</pre>
23+
<pre class="brush: js">new ImageData(width, height);
24+
new ImageData(width, height, settings);
25+
new ImageData(dataArray, width);
26+
new ImageData(dataArray, width, height);
27+
new ImageData(dataArray, width, height, settings);</pre>
2628

2729
<h3 id="Parameters">Parameters</h3>
2830

2931
<dl>
30-
<dt><code>array</code> {{optional_inline}}</dt>
31-
<dd>A {{jsxref("Uint8ClampedArray")}} containing the underlying pixel representation of
32-
the image. If no such array is given, an image with a transparent black rectangle of
33-
the specified <code>width</code> and <code>height</code> will be created.</dd>
3432
<dt><code>width</code></dt>
3533
<dd>An unsigned long representing the width of the image.</dd>
3634
<dt><code>height</code></dt>
3735
<dd>An unsigned long representing the height of the image. This value is optional if an
38-
array is given: the height will be inferred from the array's size and the given width.
36+
array is given: the height will be inferred from the array's size and the given width.</dd>
37+
<dt>settings {{optional_inline}}</dt>
38+
<dd>An object with the following values:
39+
<dt><code>colorSpace</code></dt>
40+
<dd>One of <code>"srgb"</code>, <code>"rec2020"</code>, or <code>"display-p3"</code>.</dd>
3941
</dd>
42+
<dt><code>dataArray</code> {{optional_inline}}</dt>
43+
<dd>An array containing the underlying pixel representation of the image, one of {{jsxref("Uint8ClampedArray")}}, {{jsxref("Uint16Array")}}, or {{jsxref("Float32Array")}}. If no such array is given, an image with a transparent black rectangle of the specified <code>width</code> and <code>height</code> will be created.</dd>
4044
</dl>
4145

4246
<h3 id="Return_value">Return value</h3>

files/en-us/web/api/keyframeeffect/keyframeeffect/index.html

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,54 +18,59 @@
1818

1919
<h2 id="Syntax">Syntax</h2>
2020

21-
<pre class="brush: js">var keyframes = new KeyframeEffect(<em>element</em>, <em>keyframeSet</em>, <em>keyframeOptions</em>);
22-
var keyframes = new KeyframeEffect(<em>sourceKeyFrames</em>);
21+
<pre class="brush: js">new KeyframeEffect(target, keyframes);
22+
new KeyframeEffect(target, keyframes, options)
23+
new KeyframeEffect(source)
2324
</pre>
2425

2526
<h3 id="Parameters">Parameters</h3>
2627

27-
<p>The first type of constructor (see above) creates a completely new {{domxref("KeyframeEffect")}} object instance. Its parameters are:</p>
28+
<p>The multi-argument constructor (see above) creates a completely new {{domxref("KeyframeEffect")}} object instance. Its parameters are:</p>
2829

2930
<dl>
30-
<dt>element</dt>
31+
<dt>target</dt>
3132
<dd>The DOM element to be animated, or <code>null</code>.</dd>
32-
<dt>keyframeSet</dt>
33-
<dd>An <a href="/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats">keyframe object</a> or <code>null</code>.</dd>
34-
<dt>keyframeOptions {{optional_inline}}</dt>
33+
<dt>keyframes</dt>
34+
<dd>A <a href="/en-US/docs/Web/API/Web_Animations_API/Keyframe_Formats">keyframes object</a> or <code>null</code>.</dd>
35+
<dt>options {{optional_inline}}</dt>
3536
<dd>
36-
<p>Either an integer representing the animation's duration (in milliseconds), or an {{domxref("EffectTiming", "Object")}} containing one or more of the following:</p>
37+
<p>Either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the following:</p>
3738

3839
<dl>
39-
<dt>{{domxref("EffectTiming.delay", "delay")}} {{optional_inline}}</dt>
40-
<dd>The number of milliseconds to delay the start of the animation. Defaults to 0.</dd>
41-
<dt>{{domxref("EffectTiming.direction", "direction")}} {{optional_inline}}</dt>
42-
<dd>Whether the animation runs forwards (<code>normal</code>), backwards (<code>reverse</code>), switches direction after each iteration (<code>alternate</code>), or runs backwards and switches direction after each iteration (<code>alternate-reverse</code>). Defaults to <code>"normal"</code>.</dd>
43-
<dt>{{domxref("EffectTiming.duration", "duration")}} {{optional_inline}}</dt>
44-
<dd>The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0.</dd>
45-
<dt>{{domxref("EffectTiming.easing", "easing")}} {{optional_inline}}</dt>
46-
<dd>The rate of the animation's change over time. Accepts the pre-defined values <code>"linear"</code>, <code>"ease"</code>, <code>"ease-in"</code>, <code>"ease-out"</code>, and <code>"ease-in-out"</code>, or a custom <code>"cubic-bezier"</code> value like <code>"cubic-bezier(0.42, 0, 0.58, 1)"</code>. Defaults to <code>"linear"</code>.</dd>
47-
<dt>{{domxref("EffectTiming.endDelay", "endDelay")}} {{optional_inline}}</dt>
40+
<dt><code>delay</code> {{optional_inline}}</dt>
41+
<dd>The number of milliseconds to delay the start of the animation. Defaults to 0.</dd>
42+
43+
<dt><code>direction</code> {{optional_inline}}</dt>
44+
<dd>Whether the animation runs forwards (<code>normal</code>), backwards (<code>reverse</code>), switches direction after each iteration (<code>alternate</code>), or runs backwards and switches direction after each iteration (<code>alternate-reverse</code>). Defaults to <code>"normal"</code>.</dd>
45+
46+
<dt><code>duration</code> {{optional_inline}}</dt>
47+
<dd>The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0.</dd>
48+
49+
<dt><code>easing</code> {{optional_inline}}</dt>
50+
<dd>The rate of the animation's change over time. Accepts the pre-defined values <code>"linear"</code>, <code>"ease"</code>, <code>"ease-in"</code>, <code>"ease-out"</code>, and <code>"ease-in-out"</code>, or a custom <code>"cubic-bezier"</code> value like <code>"cubic-bezier(0.42, 0, 0.58, 1)"</code>. Defaults to <code>"linear"</code>.</dd>
51+
52+
<dt><code>endDelay</code> {{optional_inline}}</dt>
4853
<dd>The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0. </dd>
49-
<dt>{{domxref("EffectTiming.fill", "fill")}} {{optional_inline}}</dt>
54+
55+
<dt><code>fill</code> {{optional_inline}}</dt>
5056
<dd>Dictates whether the animation's effects should be reflected by the element(s) prior to playing (<code>"backwards"</code>), retained after the animation has completed playing (<code>"forwards"</code>), or <code>both</code>. Defaults to <code>"none"</code>.</dd>
57+
5158
<dt>{{domxref("EffectTiming.iterationStart", "iterationStart")}} {{optional_inline}}</dt>
5259
<dd>Describes at what point in the iteration the animation should start. 0.5 would indicate starting halfway through the first iteration for example, and with this value set, an animation with 2 iterations would end halfway through a third iteration. Defaults to 0.0.</dd>
60+
5361
<dt>{{domxref("EffectTiming.iterations", "iterations")}} {{optional_inline}}</dt>
5462
<dd>The number of times the animation should repeat. Defaults to <code>1</code>, and can also take a value of {{jsxref("Infinity")}} to make it repeat for as long as the element exists.</dd>
55-
</dl>
56-
5763

64+
<dt>{{domxref("KeyframeEffect/composite", "composite")}}</dt>
65+
<dd>Determines how values are combined between this animation and the element's underlying values.</dd>
5866

67+
<dt>{{domxref("KeyframeEffect/iterationComposite", "iterationComposite")}}</dt>
68+
<dd>Determines how values build from iteration to iteration in the current animation.</dd>
5969
<dl>
60-
<dt>{{domxref("KeyframeEffect/composite", "composite")}}</dt>
61-
<dd>Determines how values are combined between this animation and the element's underlying values.</dd>
62-
<dt>{{domxref("KeyframeEffect/iterationComposite", "iterationComposite")}}</dt>
63-
<dd>Determines how values build from iteration to iteration in the current animation.</dd>
64-
</dl>
6570
</dd>
6671
</dl>
6772

68-
<p>The second type of constructor (see above) creates a clone of an existing  {{domxref("KeyframeEffect")}} object instance. Its parameter is as follows:</p>
73+
<p>The single argument constructor (see above) creates a clone of an existing  {{domxref("KeyframeEffect")}} object instance. Its parameter is as follows:</p>
6974

7075
<dl>
7176
<dt>sourceKeyFrames</dt>
@@ -74,9 +79,9 @@ <h3 id="Parameters">Parameters</h3>
7479

7580
<h2 id="Examples">Examples</h2>
7681

77-
<p>In the <a href="http://codepen.io/rachelnabors/pen/eJyWzm/?editors=0010">Follow the White Rabbit example</a>, the <code>KeyframeEffect</code> constructor is used to create a set of keyframes that dictate how the White Rabbit should animate down the hole:</p>
82+
<p>In the <a href="https://codepen.io/rachelnabors/pen/eJyWzm/?editors=0010">Follow the White Rabbit example</a>, the <code>KeyframeEffect</code> constructor is used to create a set of keyframes that dictate how the White Rabbit should animate down the hole:</p>
7883

79-
<pre class="brush: js"> var rabbitDownKeyframes = new KeyframeEffect(
84+
<pre class="brush: js">var rabbitDownKeyframes = new KeyframeEffect(
8085
    whiteRabbit, // element to animate
8186
    [
8287
      { transform: 'translateY(0%)' }, // keyframe

files/en-us/web/api/mediastream/mediastream/index.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929

3030
<h2 id="Syntax">Syntax</h2>
3131

32-
<pre class="brush: js"><var>newStream</var> = new MediaStream();
33-
<var>newStream</var> = new MediaStream(<var>stream</var>);
34-
<var>newStream</var> = new MediaStream(<var>tracks[]</var>);
35-
</pre>
32+
<pre class="brush: js">new MediaStream();
33+
new MediaStream(stream);
34+
new MediaStream(tracks);</pre>
3635

3736
<h3 id="Parameters">Parameters</h3>
3837

files/en-us/web/api/offlineaudiocontext/offlineaudiocontext/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121

2222
<h2 id="Syntax">Syntax</h2>
2323

24-
<pre class="brush: js">var <em>offlineAudioCtx</em> = new OfflineAudioContext(<em>numberOfChannels</em>, <em>length</em>, <em>sampleRate</em>);
25-
26-
var <em>offlineAudioCtx</em> = new OfflineAudioContext(<em>options</em>);</pre>
24+
<pre class="brush: js">OfflineAudioContext(options);
25+
OfflineAudioContext(numberOfChannels, length, sampleRate);</pre>
2726

2827
<h3 id="Parameters">Parameters</h3>
2928

files/en-us/web/api/passwordcredential/passwordcredential/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919

2020
<h2 id="Syntax">Syntax</h2>
2121

22-
<pre class="brush: js">var myCredential = new PasswordCredential(passwordCredentialData)
23-
var myCredential = new PasswordCredential(HTMLFormElement)</pre>
22+
<pre class="brush: js">new PasswordCredential(passwordCredentialData)
23+
new PasswordCredential(htmlFormElement)</pre>
2424

2525
<h3 id="Parameters">Parameters</h3>
2626

2727
<p>Either of the following:</p>
2828

2929
<dl>
3030
<dt><em>passwordCredentialData</em></dt>
31-
<dd>A PasswordCredentialData dictionary containing the following fields:
31+
<dd>An object with the following properties:
3232
<ul>
3333
<li><code>iconURL</code>: (Optional) the URL of a user's avatar image.</li>
3434
<li><code>id</code>: The ID of the user signing in.</li>

files/en-us/web/api/presentationrequest/presentationrequest/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
<h2 id="Syntax">Syntax</h2>
2020

21-
<pre
22-
class="brush: js">var presentationRequest = new PresentationRequest(url|urls[])</pre>
21+
<pre class="brush: js">new PresentationRequest(url);
22+
new PresentationRequest(urls);</pre>
2323

2424
<h3 id="Parameters">Parameters</h3>
2525

files/en-us/web/api/securitypolicyviolationevent/securitypolicyviolationevent/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020
<h2 id="Syntax">Syntax</h2>
2121

22-
<pre
23-
class="brush: js">let <var>SPVEvt</var> = <var>new SecurityPolicyViolationEvent(type, eventInitDict);</var></pre>
22+
<pre class="brush: js">new SecurityPolicyViolationEvent(type);
23+
new SecurityPolicyViolationEvent(type, init);</pre>
2424

2525
<h3 id="Properties">Properties</h3>
2626

2727
<dl>
2828
<dt>type</dt>
2929
<dd>A {{domxref("DOMString")}} representing the type of security policy violation that
3030
occurred.</dd>
31-
<dt>eventInitDict {{optional_inline}}</dt>
32-
<dd>A dictionary object containing information about the properties of the
31+
<dt>init {{optional_inline}}</dt>
32+
<dd>An object containing information about the properties of the
3333
<code>SecurityPolicyViolationEvent</code> to be constructed. This can include the
3434
following properties, but bear in mind that if you do include an
3535
<code>eventInitDict</code>, certain properties must be included (marked below with

0 commit comments

Comments
 (0)