Skip to content

Commit

Permalink
chore(api): Make macros with line breaks span a single line only, 4 o…
Browse files Browse the repository at this point in the history
…f 4 (#32584)

* chore(api): Make macros with line breaks span a single line only, 4 of 4

* Apply suggestions from code review

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
  • Loading branch information
bsmth and hamishwillee committed Mar 11, 2024
1 parent 0a881ee commit 8a9085b
Show file tree
Hide file tree
Showing 56 changed files with 119 additions and 204 deletions.
3 changes: 1 addition & 2 deletions files/en-us/web/api/videotracklist/gettrackbyid/index.md
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.VideoTrackList.getTrackById

The **{{domxref("VideoTrackList")}}** method
**`getTrackById()`** returns the first
{{domxref("VideoTrack")}} object from the track list whose {{domxref("VideoTrack.id",
"id")}} matches the specified string.
{{domxref("VideoTrack")}} object from the track list whose {{domxref("VideoTrack.id", "id")}} matches the specified string.

This lets you find a specified track if
you know its ID string.
Expand Down
3 changes: 1 addition & 2 deletions files/en-us/web/api/videotracklist/length/index.md
Expand Up @@ -25,8 +25,7 @@ A number indicating how many video tracks are included in the
## Examples

This snippet gets the number of video tracks in the first {{HTMLElement("video")}}
element found in the {{Glossary("DOM")}} by {{domxref("Document.querySelector",
"querySelector()")}}.
element found in the {{Glossary("DOM")}} by {{domxref("Document.querySelector", "querySelector()")}}.

```js
const videoElem = document.querySelector("video");
Expand Down
Expand Up @@ -60,5 +60,4 @@ gl.drawBuffers([gl.NONE, gl.COLOR_ATTACHMENT1]);

## See also

- {{domxref("WebGL2RenderingContext.clearBuffer",
"WebGL2RenderingContext.clearBuffer[fiuv]()")}}
- {{domxref("WebGL2RenderingContext.clearBuffer", "WebGL2RenderingContext.clearBuffer[fiuv]()")}}
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.WebGL2RenderingContext.drawElementsInstanced

The **`WebGL2RenderingContext.drawElementsInstanced()`** method
of the [WebGL 2 API](/en-US/docs/Web/API/WebGL_API) renders primitives from
array data like the {{domxref("WebGLRenderingContext.drawElements()",
"gl.drawElements()")}} method. In addition, it can execute multiple instances of a set
array data like the {{domxref("WebGLRenderingContext.drawElements()", "gl.drawElements()")}} method. In addition, it can execute multiple instances of a set
of elements.

> **Note:** When using {{domxref("WebGLRenderingContext", "WebGL 1", "", 1)}}, the {{domxref("ANGLE_instanced_arrays")}} extension can provide this method,
Expand Down Expand Up @@ -86,10 +85,8 @@ gl.drawElementsInstanced(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4);

## See also

- {{domxref("ANGLE_instanced_arrays.drawArraysInstancedANGLE()",
"ext.drawArraysInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.vertexAttribDivisorANGLE()",
"ext.vertexAttribDivisorANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.drawArraysInstancedANGLE()", "ext.drawArraysInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.vertexAttribDivisorANGLE()", "ext.vertexAttribDivisorANGLE()")}}
- {{domxref("WebGLRenderingContext.drawArrays()")}}
- {{domxref("WebGLRenderingContext.drawElements()")}}
- {{domxref("WebGL2RenderingContext.drawArraysInstanced()")}}
Expand Down
Expand Up @@ -11,10 +11,7 @@ browser-compat: api.WebGL2RenderingContext.vertexAttribDivisor
The **`WebGL2RenderingContext.vertexAttribDivisor()`** method
of the [WebGL 2 API](/en-US/docs/Web/API/WebGL_API) modifies the rate at
which generic vertex attributes advance when rendering multiple instances of primitives
with {{domxref("WebGL2RenderingContext.drawArraysInstanced()",
"gl.drawArraysInstanced()")}} and
{{domxref("WebGL2RenderingContext.drawElementsInstanced()",
"gl.drawElementsInstanced()")}}.
with {{domxref("WebGL2RenderingContext.drawArraysInstanced()", "gl.drawArraysInstanced()")}} and {{domxref("WebGL2RenderingContext.drawElementsInstanced()", "gl.drawElementsInstanced()")}}.

> **Note:** When using {{domxref("WebGLRenderingContext", "WebGL 1", "", 1)}}, the {{domxref("ANGLE_instanced_arrays")}} extension can provide this method,
> too.
Expand Down
4 changes: 1 addition & 3 deletions files/en-us/web/api/webglrenderingcontext/clear/index.md
Expand Up @@ -10,9 +10,7 @@ browser-compat: api.WebGLRenderingContext.clear

The **`WebGLRenderingContext.clear()`** method of the [WebGL API](/en-US/docs/Web/API/WebGL_API) clears buffers to preset values.

The preset values can be set by {{domxref("WebGLRenderingContext.clearColor",
"clearColor()")}}, {{domxref("WebGLRenderingContext.clearDepth", "clearDepth()")}} or
{{domxref("WebGLRenderingContext.clearStencil", "clearStencil()")}}.
The preset values can be set by {{domxref("WebGLRenderingContext.clearColor", "clearColor()")}}, {{domxref("WebGLRenderingContext.clearDepth", "clearDepth()")}} or {{domxref("WebGLRenderingContext.clearStencil", "clearStencil()")}}.

The scissor box, dithering, and buffer writemasks can affect the `clear()`
method.
Expand Down
9 changes: 3 additions & 6 deletions files/en-us/web/api/webglrenderingcontext/drawarrays/index.md
Expand Up @@ -67,12 +67,9 @@ gl.drawArrays(gl.POINTS, 0, 8);
## See also

- {{domxref("WebGLRenderingContext.drawElements()")}}
- {{domxref("ANGLE_instanced_arrays.drawArraysInstancedANGLE()",
"ext.drawArraysInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.drawElementsInstancedANGLE()",
"ext.drawElementsInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.vertexAttribDivisorANGLE()",
"ext.vertexAttribDivisorANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.drawArraysInstancedANGLE()", "ext.drawArraysInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.drawElementsInstancedANGLE()", "ext.drawElementsInstancedANGLE()")}}
- {{domxref("ANGLE_instanced_arrays.vertexAttribDivisorANGLE()", "ext.vertexAttribDivisorANGLE()")}}
- {{domxref("WebGL2RenderingContext.drawArraysInstanced()")}}
- {{domxref("WebGL2RenderingContext.drawElementsInstanced()")}}
- {{domxref("WebGL2RenderingContext.vertexAttribDivisor()")}}
Expand Down
Expand Up @@ -24,10 +24,7 @@ are assigned by the WebGL layer when you create the attributes.
Either way, since attributes cannot be used unless enabled, and are disabled by
default, you need to call `enableVertexAttribArray()` to enable individual
attributes so that they can be used. Once that's been done, other methods can be used to
access the attribute, including {{domxref("WebGLRenderingContext.vertexAttribPointer",
"vertexAttribPointer()")}}, {{domxref("WebGLRenderingContext.vertexAttrib",
"vertexAttrib*()")}}, and {{domxref("WebGLRenderingContext.getVertexAttrib",
"getVertexAttrib()")}}.
access the attribute, including {{domxref("WebGLRenderingContext.vertexAttribPointer", "vertexAttribPointer()")}}, {{domxref("WebGLRenderingContext.vertexAttrib", "vertexAttrib*()")}}, and {{domxref("WebGLRenderingContext.getVertexAttrib", "getVertexAttrib()")}}.

## Syntax

Expand All @@ -40,8 +37,7 @@ enableVertexAttribArray(index)
- `index`
- : A {{domxref("WebGL_API/Types", "GLuint")}} specifying the index number that uniquely identifies the
vertex attribute to enable. If you know the name of the attribute but not its index,
you can get the index by calling {{domxref("WebGLRenderingContext.getAttribLocation",
"getAttribLocation()")}}.
you can get the index by calling {{domxref("WebGLRenderingContext.getAttribLocation", "getAttribLocation()")}}.

### Return value

Expand Down Expand Up @@ -95,8 +91,7 @@ the position attribute so it can be used by the shader program (in particular, b
vertex shader).

Then the vertex buffer is bound to the `aVertexPosition` attribute by
calling {{domxref("WebGLRenderingContext.vertexAttribPointer",
"vertexAttribPointer()")}}. This step is not obvious, since this binding is almost a
calling {{domxref("WebGLRenderingContext.vertexAttribPointer", "vertexAttribPointer()")}}. This step is not obvious, since this binding is almost a
side effect. But as a result, accessing `aVertexPosition` now obtains data
from the vertex buffer.

Expand All @@ -118,5 +113,4 @@ vertex shader, we're ready to draw the shape by calling
- [Data in WebGL](/en-US/docs/Web/API/WebGL_API/Data)
- [Adding 2D content to a WebGL context](/en-US/docs/Web/API/WebGL_API/Tutorial/Adding_2D_content_to_a_WebGL_context)
- [A basic 2D WebGL animation sample](/en-US/docs/Web/API/WebGL_API/Basic_2D_animation_example)
- {{domxref("WebGLRenderingContext.disableVertexAttribArray",
"disableVertexAttribArray()")}}
- {{domxref("WebGLRenderingContext.disableVertexAttribArray", "disableVertexAttribArray()")}}
Expand Up @@ -62,7 +62,5 @@ gl.generateMipmap(gl.TEXTURE_2D);
- {{domxref("WebGLRenderingContext.createTexture()")}}
- {{domxref("WebGLRenderingContext.bindTexture()")}}
- {{domxref("WebGLRenderingContext.getTexParameter()")}}
- {{domxref("WebGLRenderingContext.texParameter",
"WebGLRenderingContext.texParameterf()")}}
- {{domxref("WebGLRenderingContext.texParameter",
"WebGLRenderingContext.texParameteri()")}}
- {{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameterf()")}}
- {{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameteri()")}}
Expand Up @@ -27,8 +27,7 @@ getActiveAttrib(program, index)
- `index`
- : A {{domxref("WebGL_API/Types", "GLuint")}} specifying the index of the vertex attribute to get. This
value is an index 0 to N - 1 as returned
by {{domxref("WebGLRenderingContext.getProgramParameter",
"gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)")}}.
by {{domxref("WebGLRenderingContext.getProgramParameter", "gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)")}}.

### Return value

Expand Down
Expand Up @@ -28,8 +28,7 @@ getActiveUniform(program, index)
- `index`
- : A {{domxref("WebGL_API/Types", "GLuint")}} specifying the index of the uniform attribute to get. This
value is an index 0 to N - 1 as returned
by {{domxref("WebGLRenderingContext.getProgramParameter",
"gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)")}}.
by {{domxref("WebGLRenderingContext.getProgramParameter", "gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)")}}.

### Return value

Expand Down
Expand Up @@ -893,8 +893,7 @@ You can query the following `pname` parameters when using a
</td>
<td>
See
{{domxref("WebGL2RenderingContext/bindTransformFeedback",
"bindTransformFeedback")}}.
{{domxref("WebGL2RenderingContext/bindTransformFeedback", "bindTransformFeedback")}}.
</td>
</tr>
<tr>
Expand Down
Expand Up @@ -189,8 +189,6 @@ gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER);

## See also

- {{domxref("WebGLRenderingContext.texParameter",
"WebGLRenderingContext.texParameterf()")}}
- {{domxref("WebGLRenderingContext.texParameter",
"WebGLRenderingContext.texParameteri()")}}
- {{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameterf()")}}
- {{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameteri()")}}
- {{domxref("EXT_texture_filter_anisotropic")}}
Expand Up @@ -67,8 +67,7 @@ gl.stencilFunc(gl.LESS, 0, 0b1110011);
```

To get the current stencil function, reference value, or other stencil information,
query the following constants with {{domxref("WebGLRenderingContext.getParameter",
"getParameter()")}}.
query the following constants with {{domxref("WebGLRenderingContext.getParameter", "getParameter()")}}.

```js
gl.getParameter(gl.STENCIL_FUNC);
Expand Down
Expand Up @@ -71,8 +71,7 @@ gl.stencilFuncSeparate(gl.FRONT, gl.LESS, 0.2, 1110011);
```

To get the current stencil function, reference value, or other stencil information,
query the following constants with {{domxref("WebGLRenderingContext.getParameter",
"getParameter()")}}.
query the following constants with {{domxref("WebGLRenderingContext.getParameter", "getParameter()")}}.

```js
gl.getParameter(gl.STENCIL_FUNC);
Expand Down
3 changes: 1 addition & 2 deletions files/en-us/web/api/webglrenderingcontext/stencilop/index.md
Expand Up @@ -72,8 +72,7 @@ gl.stencilOp(gl.INCR, gl.DECR, gl.INVERT);
```

To get the current information about stencil and depth pass or fail, query the
following constants with {{domxref("WebGLRenderingContext.getParameter",
"getParameter()")}}.
following constants with {{domxref("WebGLRenderingContext.getParameter", "getParameter()")}}.

```js
gl.getParameter(gl.STENCIL_FAIL);
Expand Down
Expand Up @@ -83,8 +83,7 @@ gl.stencilOpSeparate(gl.FRONT, gl.INCR, gl.DECR, gl.INVERT);
```

To get the current information about stencil and depth pass or fail, query the
following constants with {{domxref("WebGLRenderingContext.getParameter",
"getParameter()")}}.
following constants with {{domxref("WebGLRenderingContext.getParameter", "getParameter()")}}.

```js
gl.getParameter(gl.STENCIL_FAIL);
Expand Down
11 changes: 3 additions & 8 deletions files/en-us/web/api/webglrenderingcontext/vertexattrib/index.md
Expand Up @@ -43,16 +43,11 @@ None ({{jsxref("undefined")}}).
## Description

While vertex attributes are usually used to specify values which are different for each
vertex (using {{domxref("WebGLRenderingContext.vertexAttribPointer()",
"vertexAttribPointer")}}), it can be useful to specify a constant value. For example, if
you have a shader which has a `color` vertex attribute, but you want to draw
everything in a single color, you can use `vertexAttrib` to achieve that
without creating a buffer filled with only one value or having to create a separate
shader which uses a uniform for the color.
vertex (using {{domxref("WebGLRenderingContext.vertexAttribPointer()", "vertexAttribPointer")}}), it can be useful to specify a constant value.
For example, if you have a shader which has a `color` vertex attribute, but you want to draw everything in a single color, you can use `vertexAttrib` to achieve that without creating a buffer filled with only one value or having to create a separate shader which uses a uniform for the color.

This value will be used if a bound array buffer has not been enabled with
{{domxref("WebGLRenderingContext.enableVertexAttribArray()",
"enableVertexAttribArray")}}.
{{domxref("WebGLRenderingContext.enableVertexAttribArray()", "enableVertexAttribArray")}}.

Attributes may be matrices, in which case columns of the matrix must be loaded into
successive vertex attribute slots.
Expand Down
Expand Up @@ -97,8 +97,7 @@ and will be supplied to the Vertex Buffer Object (VBO). First, we need to bind t
this method, `gl.vertexAttribPointer()`, we specify in what order the
attributes are stored, and what data type they are in. In addition, we need to include
the stride, which is the total byte length of all attributes for one vertex. Also, we
have to call {{domxref("WebGLRenderingContext/enableVertexAttribArray",
"gl.enableVertexAttribArray()")}} to tell WebGL that this attribute should be filled
have to call {{domxref("WebGLRenderingContext/enableVertexAttribArray", "gl.enableVertexAttribArray()")}} to tell WebGL that this attribute should be filled
with data from our array buffer.

Usually, your 3D geometry is already in a certain binary format, so you need to read
Expand All @@ -121,13 +120,11 @@ they are stored in the array buffer. You have two options:
- Either you specify the index yourself. In this case, you call
{{domxref("WebGLRenderingContext.bindAttribLocation()", "gl.bindAttribLocation()")}}
to connect a named attribute from the vertex shader to the index you want to use. This
must be done before calling {{domxref("WebGLRenderingContext.linkProgram()",
"gl.linkProgram()")}}. You can then provide this same index to
must be done before calling {{domxref("WebGLRenderingContext.linkProgram()", "gl.linkProgram()")}}. You can then provide this same index to
`gl.vertexAttribPointer()`.
- Alternatively, you use the index that is assigned by the graphics card when
compiling the vertex shader. Depending on the graphics card, the index will vary, so
you must call {{domxref("WebGLRenderingContext.getAttribLocation()",
"gl.getAttribLocation()")}} to find out the index, and then provide this index to
you must call {{domxref("WebGLRenderingContext.getAttribLocation()", "gl.getAttribLocation()")}} to find out the index, and then provide this index to
`gl.vertexAttribPointer()`.
If you are using WebGL 2, you can specify the index yourself in the vertex shader code
and override the default used by the graphics card, e.g.
Expand All @@ -140,8 +137,7 @@ While the `ArrayBuffer` can be filled with both integers and floats, the
attributes will always be converted to a float when they are sent to the vertex shader.
If you need to use integers in your vertex shader code, you can either cast the float
back to an integer in the vertex shader (e.g. `(int) floatNumber`), or use
{{domxref("WebGL2RenderingContext.vertexAttribIPointer()",
"gl.vertexAttribIPointer()")}} from WebGL2.
{{domxref("WebGL2RenderingContext.vertexAttribIPointer()", "gl.vertexAttribIPointer()")}} from WebGL2.

### Default attribute values

Expand All @@ -150,9 +146,8 @@ the values for each attribute. Instead, we can supply a default value that will
identical for all vertices. We can call
{{domxref("WebGLRenderingContext.disableVertexAttribArray()", "gl.disableVertexAttribArray()")}}
to tell WebGL to use the default value, while calling
{{domxref("WebGLRenderingContext.enableVertexAttribArray()",
"gl.enableVertexAttribArray()")}} will read the values from the array buffer as
specified with `gl.vertexAttribPointer()`.
{{domxref("WebGLRenderingContext.enableVertexAttribArray()", "gl.enableVertexAttribArray()")}}
will read the values from the array buffer as specified with `gl.vertexAttribPointer()`.

Similarly, if our vertex shader expects e.g. a 4-component attribute with
`vec4` but in our `gl.vertexAttribPointer()` call we set the
Expand All @@ -172,9 +167,9 @@ color.

### Querying current settings

You can call {{domxref("WebGLRenderingContext.getVertexAttrib()",
"gl.getVertexAttrib()")}} and {{domxref("WebGLRenderingContext.getVertexAttribOffset()",
"gl.getVertexAttribOffset()")}} to get the current parameters for an attribute, e.g. the
You can call {{domxref("WebGLRenderingContext.getVertexAttrib()", "gl.getVertexAttrib()")}} and
{{domxref("WebGLRenderingContext.getVertexAttribOffset()", "gl.getVertexAttribOffset()")}} to
get the current parameters for an attribute, e.g. the
data type or whether the attribute should be normalized. Keep in mind that these WebGL
functions have a slow performance and it is better to store the state inside your
JavaScript application. However, these functions are great for debugging a WebGL context
Expand Down
Expand Up @@ -115,9 +115,8 @@ function sendText() {

WebSockets is an event-driven API; when messages are received, a `message`
event is sent to the `WebSocket` object. To handle it, add an event listener
for the `message` event, or use the {{domxref("WebSocket/message_event",
"onmessage")}} event handler. To begin listening for incoming data, you can do something
like this:
for the `message` event, or use the {{domxref("WebSocket/message_event", "onmessage")}} event handler.
To begin listening for incoming data, you can do something like this:

```js
exampleSocket.onmessage = (event) => {
Expand Down
4 changes: 2 additions & 2 deletions files/en-us/web/api/window/getcomputedstyle/index.md
Expand Up @@ -149,8 +149,8 @@ Java.
- CSS property values may be accessed using the
{{DOMxRef("CSSStyleDeclaration.getPropertyValue", "getPropertyValue(propName)")}} method or by indexing directly into the object
using array or [dot notation](/en-US/docs/Learn/JavaScript/Objects/Basics#dot_notation) such as `obj['z-index']` or `obj.zIndex`.
- The values returned by `getComputedStyle` are {{CSSxRef("resolved_value",
"resolved values", "", 1)}}. These are usually the same as CSS 2.1's
- The values returned by `getComputedStyle` are {{CSSxRef("resolved_value", "resolved values", "", 1)}}.
These are usually the same as CSS 2.1's
{{CSSxRef("computed_value","computed values", "", 1)}}, but for some older properties
like `width`, `height`, or `padding`, they are
instead the same as {{CSSxRef("used_value","used values", "", 1)}}. Originally, CSS
Expand Down
7 changes: 2 additions & 5 deletions files/en-us/web/api/window/getselection/index.md
Expand Up @@ -49,11 +49,8 @@ function foo() {

### String representation of the Selection object

In JavaScript, when an object is passed to a function expecting a string (like {{
Domxref("window.alert()") }} or {{ Domxref("document.write()") }}), the object's
{{jsxref("Object.toString", "toString()")}} method is called and the returned value is
passed to the function. This can make the object appear to be a string when used with
other functions when it is really an object with properties and methods.
In JavaScript, when an object is passed to a function expecting a string (like {{Domxref("window.alert()")}} or {{Domxref("document.write()")}}), the object's {{jsxref("Object.toString", "toString()")}} method is called and the returned value is passed to the function.
This can make the object appear to be a string when used with other functions when it is really an object with properties and methods.

In the above example, `selObj.toString()` is automatically called when it is
passed to {{domxref("window.alert()")}}. However, attempting to use a JavaScript [String](/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) property
Expand Down

0 comments on commit 8a9085b

Please sign in to comment.