@@ -718,7 +718,7 @@ the {{CustomElementRegistry/define(name, constructor)|CustomElementRegistry.defi
718
718
a <a href="https://tc39.es/ecma262/#sec-static-semantics-constructormethod">Constructor Method</a> .
719
719
720
720
This takes advantage of the relatively recent addition of classes to JavaScript,
721
- and the fact that function references are very easy to use in JavaScript.
721
+ and the fact that method references are very easy to use in JavaScript.
722
722
</div>
723
723
724
724
<div class="note">
@@ -812,7 +812,7 @@ the interaction with garbage collection.
812
812
[[!WEBIDL]] attributes should act like simple JavaScript object properties.
813
813
814
814
In reality, IDL attributes are implemented as accessor properties
815
- with separate getter and setter functions .
815
+ with separate getter and setter methods .
816
816
To make them act like JavaScript object properties:
817
817
818
818
* Getters must not have any observable side effects.
@@ -914,14 +914,14 @@ See also:
914
914
915
915
* [[#attributes-like-data]]
916
916
917
- <h3 id="prefer-dict-to-bool">Prefer dictionary parameters over primitive parameters </h3>
917
+ <h3 id="prefer-dict-to-bool">Prefer dictionary arguments over primitive arguments </h3>
918
918
919
- API methods should generally use dictionary parameters
920
- instead of a series of optional primitive parameters .
919
+ API methods should generally use dictionary arguments
920
+ instead of a series of optional primitive arguments .
921
921
922
922
This makes the code that calls the method much more readable.
923
923
It also makes the API more extensible in the future,
924
- particularly if multiple parameters with the same type are needed.
924
+ particularly if multiple arguments with the same type are needed.
925
925
926
926
<div class="example">
927
927
For example,
@@ -952,7 +952,7 @@ window.scrollBy(50, 0)
952
952
953
953
</div>
954
954
955
- The dictionary itself should be an optional parameter ,
955
+ The dictionary itself should be an optional argument ,
956
956
so that if the author is happy with all of the default options,
957
957
they can avoid passing an extra argument.
958
958
@@ -974,10 +974,10 @@ See also:
974
974
* [[#optional-parameters]]
975
975
* [[#naming-optional-parameters]]
976
976
977
- <h3 id="optional-parameters">Make function parameters optional if possible</h3>
977
+ <h3 id="optional-parameters">Make method arguments optional if possible</h3>
978
978
979
- If a parameter for an API function has a reasonable default value,
980
- make that parameter optional and specify the default value.
979
+ If an argument for an API method has a reasonable default value,
980
+ make that argument optional and specify the default value.
981
981
982
982
<div class="example">
983
983
{{EventTarget/addEventListener()}} takes an optional boolean `useCapture` argument.
@@ -989,10 +989,10 @@ Note: Exceptions have been made for legacy interoperability reasons
989
989
(such as {{XMLHttpRequest}} ),
990
990
but this should be considered a design mistake rather than recommended practice.
991
991
992
- The API must be designed so that if a parameter is left out,
992
+ The API must be designed so that if an argument is left out,
993
993
the default value used is the same as
994
- converting {{undefined}} to the type of the parameter .
995
- For example, if a boolean parameter isn't set,
994
+ converting {{undefined}} to the type of the argument .
995
+ For example, if a boolean argument isn't set,
996
996
it must default to false.
997
997
998
998
When deciding between different list data types for your API,
@@ -1006,13 +1006,13 @@ See also:
1006
1006
1007
1007
* [[#prefer-dict-to-bool]]
1008
1008
1009
- <h3 id="naming-optional-parameters">Naming optional parameters </h3>
1009
+ <h3 id="naming-optional-parameters">Naming optional arguments </h3>
1010
1010
1011
- Name optional parameters to make the default behavior obvious
1011
+ Name optional arguments to make the default behavior obvious
1012
1012
without being named negatively.
1013
1013
1014
1014
This applies whether they are provided in a [dictionary] (#prefer-dict-to-bool)
1015
- or as [single parameters ] (#optional-parameters).
1015
+ or as [single arguments ] (#optional-parameters).
1016
1016
1017
1017
<div class="example">
1018
1018
{{EventTarget/addEventListener()}} takes an `options` object
@@ -1127,7 +1127,7 @@ An API should generally be synchronous if the following rules of thumb apply:
1127
1127
1128
1128
<h3 id="promises">Design asynchronous APIs using Promises</h3>
1129
1129
1130
- If an API function needs to be asynchronous, use Promises,
1130
+ If an API method needs to be asynchronous, use Promises,
1131
1131
not callback functions.
1132
1132
1133
1133
Using Promises consistently across the Web platform
@@ -1149,7 +1149,7 @@ See also:
1149
1149
1150
1150
<h3 id="aborting">Cancel asynchronous APIs/operations using AbortSignal</h3>
1151
1151
1152
- If an asynchronous function can be cancelled,
1152
+ If an asynchronous method can be cancelled,
1153
1153
allow authors to pass in an {{AbortSignal}} as part of an options dictionary.
1154
1154
1155
1155
<div class="example">
@@ -2404,7 +2404,7 @@ Sets of related names should agree with each other in:
2404
2404
<h4 id="naming-booleans" class="no-num no-toc">Boolean properties vs.
2405
2405
boolean-returning methods</h5>
2406
2406
2407
- Boolean properties, options, or API parameters which are asking a question about
2407
+ Boolean properties, options, or API arguments which are asking a question about
2408
2408
their argument *should not* be prefixed with <code> is</code> , while methods
2409
2409
that serve the same purpose, given that it has no side effects, *should* be
2410
2410
prefixed with <code> is</code> to be consistent with the rest of the platform.
0 commit comments