Skip to content

Commit

Permalink
Convert noteblocks for web/api folder (part 10) (#35134)
Browse files Browse the repository at this point in the history
This PR converts the noteblocks for the 'web/api' folder to GFM syntax, using a [conversion script](https://github.com/queengooborg/mdn-toolkit/blob/main/upgrade-noteblock.js). This is part 10.
  • Loading branch information
queengooborg authored Jul 26, 2024
1 parent cfb7587 commit 802b606
Show file tree
Hide file tree
Showing 100 changed files with 232 additions and 116 deletions.
3 changes: 2 additions & 1 deletion files/en-us/web/api/node/contains/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ whether a node is a descendant of a given node, that is the node itself,
one of its direct children ({{domxref("Node.childNodes", "childNodes")}}),
one of the children's direct children, and so on.

> **Note:** A node is _contained_ inside itself.
> [!NOTE]
> A node is _contained_ inside itself.
## Syntax

Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/api/node/firstchild/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ or `null` if the node has no children.
If the node is a {{domxref("Document")}},
this property returns the first node in the list of its direct children.

> **Note:** This property returns any type of node that is the first child of this one.
> [!NOTE]
> This property returns any type of node that is the first child of this one.
> It may be a {{domxref("Text")}} or a {{domxref("Comment")}} node.
> If you want to get the first {{domxref("Element")}} that is a child of another element,
> consider using {{domxref("Element.firstElementChild")}}.
Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/api/plugin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ browser-compat: api.Plugin

The `Plugin` interface provides information about a browser plugin.

> **Note:** Own properties of `Plugin` objects are no longer enumerable in the latest browser versions.
> [!NOTE]
> Own properties of `Plugin` objects are no longer enumerable in the latest browser versions.
## Instance properties

Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/api/pluginarray/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ browser-compat: api.PluginArray

The `PluginArray` interface is used to store a list of {{DOMxRef("Plugin")}} objects describing the available [plugins](/en-US/docs/Mozilla/Add-ons/Plugins); it's returned by the {{DOMxRef("Navigator.plugins", "navigator.plugins")}} property. The `PluginArray` is not a JavaScript array, but has the `length` property and supports accessing individual items using bracket notation (`plugins[2]`), as well as via `item(index)` and `namedItem("name")` methods.

> **Note:** Own properties of `PluginArray` objects are no longer enumerable in the latest browser versions.
> [!NOTE]
> Own properties of `PluginArray` objects are no longer enumerable in the latest browser versions.
## Instance properties

Expand Down
6 changes: 4 additions & 2 deletions files/en-us/web/api/pointer_events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ The following table provides the values of `button` and `buttons` for the variou
| X2 (forward) Mouse | `4` | `16` |
| Pen eraser button | `5` | `32` |

> **Note:** The `button` property indicates a change in the state of the button. However, as in the case of touch, when multiple events occur with one event, all of them have the same value.
> [!NOTE]
> The `button` property indicates a change in the state of the button. However, as in the case of touch, when multiple events occur with one event, all of them have the same value.
## Capturing the pointer

Expand All @@ -276,7 +277,8 @@ Pointer capture allows events for a particular {{domxref("PointerEvent","pointer
Pointer capture will cause the target to capture all subsequent pointer events as if they were occurring over the capturing target. Accordingly, `pointerover`, `pointerenter`, `pointerleave`, and `pointerout` **will not fire** as long as this capture is set.
For touchscreen browsers that allow [direct manipulation](https://w3c.github.io/pointerevents/#dfn-direct-manipulation), an [implicit pointer capture](https://w3c.github.io/pointerevents/#dfn-implicit-pointer-capture) will be called on the element when a `pointerdown` event triggers. The capture can be released manually by calling {{domxref('element.releasePointerCapture')}} on the target element, or it will be implicitly released after a `pointerup` or `pointercancel` event.

> **Note:** If you need to move an element in the DOM, then make sure to call `setPointerCapture()` **after DOM movements** so that `setPointerCapture()` will not lose track of it. E.g., if you need to use `Element.append()` to move an element somewhere else, then make sure to call `setPointerCapture()` on it only after the call to `Element.append()`.
> [!NOTE]
> If you need to move an element in the DOM, then make sure to call `setPointerCapture()` **after DOM movements** so that `setPointerCapture()` will not lose track of it. E.g., if you need to use `Element.append()` to move an element somewhere else, then make sure to call `setPointerCapture()` on it only after the call to `Element.append()`.
The following example shows pointer capture being set on an element.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ A live version of this application is available on [GitHub](https://mdn.github.i

## Example

> **Note:** The text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location.
> [!NOTE]
> The text below uses the term "finger" when describing the contact with the surface, but it could, of course, also be a stylus, mouse, or other method of pointing at a location.
### Create a canvas

Expand Down
6 changes: 4 additions & 2 deletions files/en-us/web/api/pointer_lock_api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ canvas.addEventListener("click", async () => {
});
```

> **Note:** If a user has exited pointer lock via the [default unlock gesture](https://w3c.github.io/pointerlock/#dfn-default-unlock-gesture), or pointer lock has not previously been entered for this document, an event generated as a result of an [engagement gesture](https://w3c.github.io/pointerlock/#dfn-engagement-gesture) must be received by the document before [`requestPointerLock`](https://w3c.github.io/pointerlock/#dom-element-requestpointerlock) will succeed. (from <https://w3c.github.io/pointerlock/#extensions-to-the-element-interface>)
> [!NOTE]
> If a user has exited pointer lock via the [default unlock gesture](https://w3c.github.io/pointerlock/#dfn-default-unlock-gesture), or pointer lock has not previously been entered for this document, an event generated as a result of an [engagement gesture](https://w3c.github.io/pointerlock/#dfn-engagement-gesture) must be received by the document before [`requestPointerLock`](https://w3c.github.io/pointerlock/#dom-element-requestpointerlock) will succeed. (from <https://w3c.github.io/pointerlock/#extensions-to-the-element-interface>)
Operating systems enable mouse acceleration by default, which is useful when you sometimes want slow precise movement (think about you might use a graphics package), but also want to move great distances with a faster mouse movement (think about scrolling, and selecting several files). For some first-person perspective games however, raw mouse input data is preferred for controlling camera rotation — where the same distance movement, fast or slow, results in the same rotation. This results in a better gaming experience and higher accuracy, according to professional gamers.

Expand Down Expand Up @@ -174,7 +175,8 @@ canvas.addEventListener("click", async () => {
});
```

> **Note:** The above snippet works in browsers that don't support the promise version of `requestPointerLock()`. See [Handling promise and non-promise versions of requestPointerLock()](#handling_promise_and_non-promise_versions_of_requestpointerlock) for an explanation.
> [!NOTE]
> The above snippet works in browsers that don't support the promise version of `requestPointerLock()`. See [Handling promise and non-promise versions of requestPointerLock()](#handling_promise_and_non-promise_versions_of_requestpointerlock) for an explanation.
Now for the dedicated pointer lock event listener: `pointerlockchange`. When this occurs, we run a function called `lockChangeAlert()` to handle the change.

Expand Down
6 changes: 4 additions & 2 deletions files/en-us/web/api/pointerevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ _This interface inherits properties from {{domxref("MouseEvent")}} and {{domxref

The `PointerEvent` interface has several event types. To determine which event fired, look at the event's {{domxref("Event.type", "type")}} property.

> **Note:** It's important to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). If you use pointer events, you should call {{domxref("Event.preventDefault()", "preventDefault()")}} to keep the mouse event from being sent as well.
> [!NOTE]
> It's important to note that in many cases, both pointer and mouse events get sent (in order to let non-pointer-specific code still interact with the user). If you use pointer events, you should call {{domxref("Event.preventDefault()", "preventDefault()")}} to keep the mouse event from being sent as well.
- {{domxref('Element/pointerover_event', 'pointerover')}}
- : This event is fired when a pointing device is moved into an element's hit test boundaries.
Expand All @@ -70,7 +71,8 @@ The `PointerEvent` interface has several event types. To determine which event f

- : The event is fired when a pointer becomes _active_. For mouse, it is fired when the device transitions from no buttons pressed to at least one button pressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.

> **Note:** For touchscreen browsers that allow [direct manipulation](https://w3c.github.io/pointerevents/#dfn-direct-manipulation), a `pointerdown` event triggers [implicit pointer capture](https://w3c.github.io/pointerevents/#dfn-implicit-pointer-capture), which causes the target to capture all subsequent pointer events as if they were occurring over the capturing target. Accordingly, `pointerover`, `pointerenter`, `pointerleave`, and `pointerout` **will not fire** as long as this capture is set. The capture can be released manually by calling {{ domxref('element.releasePointerCapture') }} on the target element, or it will be implicitly released after a `pointerup` or `pointercancel` event.
> [!NOTE]
> For touchscreen browsers that allow [direct manipulation](https://w3c.github.io/pointerevents/#dfn-direct-manipulation), a `pointerdown` event triggers [implicit pointer capture](https://w3c.github.io/pointerevents/#dfn-implicit-pointer-capture), which causes the target to capture all subsequent pointer events as if they were occurring over the capturing target. Accordingly, `pointerover`, `pointerenter`, `pointerleave`, and `pointerout` **will not fire** as long as this capture is set. The capture can be released manually by calling {{ domxref('element.releasePointerCapture') }} on the target element, or it will be implicitly released after a `pointerup` or `pointercancel` event.
- {{domxref('Element/pointermove_event', 'pointermove')}}
- : This event is fired when a pointer changes coordinates.
Expand Down
12 changes: 8 additions & 4 deletions files/en-us/web/api/popover_api/using/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ In its simplest form, a popover is created by adding the [`popover`](/en-US/docs
<div id="mypopover" popover>Popover content</div>
```

> **Note:** Setting the `popover` attribute with no value is equivalent to setting `popover="auto"`.
> [!NOTE]
> Setting the `popover` attribute with no value is equivalent to setting `popover="auto"`.
Adding this attribute causes the element to be hidden on page load by having {{cssxref("display", "display: none")}} set on it. To show/hide the popover, you need to add some control buttons. You can set a {{htmlelement("button")}} (or {{htmlelement("input")}} of `type="button"`) as a popover control button by giving it a [`popovertarget`](/en-US/docs/Web/HTML/Element/button#popovertarget) attribute, the value of which should be the ID of the popover to control:

Expand All @@ -43,7 +44,8 @@ If you want to change that behavior, you can use the [`popovertargetaction`](/en

You can see how the previous code snippet renders in our [Basic declarative popover example](https://mdn.github.io/dom-examples/popover-api/basic-declarative/) ([source](https://github.com/mdn/dom-examples/tree/main/popover-api/basic-declarative)).

> **Note:** If the `popovertargetaction` attribute is omitted, `"toggle"` is the default action that will be performed by a control button.
> [!NOTE]
> If the `popovertargetaction` attribute is omitted, `"toggle"` is the default action that will be performed by a control button.
When a popover is shown, it has `display: none` removed from it and it is put into the {{glossary("top layer")}} so it will sit on top of all other page content.

Expand Down Expand Up @@ -244,7 +246,8 @@ Popovers are set to `display: none;` when hidden and `display: block;` when show
- When animating `display` from `none` to `block` (or another visible `display` value), the value will flip to `block` at `0%` of the animation duration so it is visible throughout.
- When animating `display` from `block` (or another visible `display` value) to `none`, the value will flip to `none` at `100%` of the animation duration so it is visible throughout.

> **Note:** When animating using [CSS transitions](/en-US/docs/Web/CSS/CSS_transitions), [`transition-behavior: allow-discrete`](/en-US/docs/Web/CSS/transition-behavior) needs to be set to enable the above behavior. When animating with [CSS animations](/en-US/docs/Web/CSS/CSS_animations), the above behavior is available by default; an equivalent step is not required.
> [!NOTE]
> When animating using [CSS transitions](/en-US/docs/Web/CSS/CSS_transitions), [`transition-behavior: allow-discrete`](/en-US/docs/Web/CSS/transition-behavior) needs to be set to enable the above behavior. When animating with [CSS animations](/en-US/docs/Web/CSS/CSS_animations), the above behavior is available by default; an equivalent step is not required.
### Transitioning a popover

Expand Down Expand Up @@ -353,7 +356,8 @@ The code renders as follows:

{{ EmbedLiveSample("Transitioning a popover", "100%", "200") }}

> **Note:** Because popovers change from `display: none` to `display: block` each time they are shown, the popover transitions from its `@starting-style` styles to its `[popover]:popover-open` styles every time the entry transition occurs. When the popover closes, it transitions from its `[popover]:popover-open` state to the default `[popover]` state.
> [!NOTE]
> Because popovers change from `display: none` to `display: block` each time they are shown, the popover transitions from its `@starting-style` styles to its `[popover]:popover-open` styles every time the entry transition occurs. When the popover closes, it transitions from its `[popover]:popover-open` state to the default `[popover]` state.
>
> It is possible for the style transition on entry and exit to be different in such cases. See our [Demonstration of when starting styles are used](/en-US/docs/Web/CSS/@starting-style#demonstration_of_when_starting_styles_are_used) example for a proof of this.
Expand Down
3 changes: 2 additions & 1 deletion files/en-us/web/api/popstateevent/popstateevent/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ browser-compat: api.PopStateEvent.PopStateEvent

The **`PopStateEvent()`** constructor creates a new {{domxref("PopStateEvent")}} object.

> **Note:** A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing {{domxref("Window/popstate_event", "popstate")}} events.
> [!NOTE]
> A web developer doesn't typically need to call this constructor, as the browser creates these objects itself when firing {{domxref("Window/popstate_event", "popstate")}} events.
## Syntax

Expand Down
6 changes: 4 additions & 2 deletions files/en-us/web/api/presentation/defaultrequest/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ If set by the [controller](https://www.w3.org/TR/presentation-api/#dfn-controlle

The [controlling user agent](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) _SHOULD_ initiate presentation using the [default presentation request](https://www.w3.org/TR/presentation-api/#dfn-default-presentation-request), only when the user has expressed an intention to do so via a user gesture. For example, by clicking a button in the browser.

> **Note:** Some [controlling user agents](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) may allow the user to initiate a default [presentation connection](https://www.w3.org/TR/presentation-api/#dfn-presentation-connection) and select a [presentation display](https://www.w3.org/TR/presentation-api/#dfn-presentation-display) with the same user gesture. For example, the browser chrome could allow the user to pick a display from a menu, or allow the user to tap on an [Near Field Communications (NFC)](https://nfc-forum.org/) enabled display. In this case, when the [controlling user agent](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) asks for permission while [starting a presentation](https://www.w3.org/TR/presentation-api/#dfn-start-a-presentation), the browser could offer that display as the default choice, or consider the gesture as granting permission for the display and bypass display selection entirely.
> [!NOTE]
> Some [controlling user agents](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) may allow the user to initiate a default [presentation connection](https://www.w3.org/TR/presentation-api/#dfn-presentation-connection) and select a [presentation display](https://www.w3.org/TR/presentation-api/#dfn-presentation-display) with the same user gesture. For example, the browser chrome could allow the user to pick a display from a menu, or allow the user to tap on an [Near Field Communications (NFC)](https://nfc-forum.org/) enabled display. In this case, when the [controlling user agent](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) asks for permission while [starting a presentation](https://www.w3.org/TR/presentation-api/#dfn-start-a-presentation), the browser could offer that display as the default choice, or consider the gesture as granting permission for the display and bypass display selection entirely.
> **Note:** If a [controlling user agent](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) does not support initiation of a [presentation connection](https://www.w3.org/TR/presentation-api/#dfn-presentation-connection) from the browser chrome, setting `defaultRequest` will have no effect.
> [!NOTE]
> If a [controlling user agent](https://www.w3.org/TR/presentation-api/#dfn-controlling-user-agent) does not support initiation of a [presentation connection](https://www.w3.org/TR/presentation-api/#dfn-presentation-connection) from the browser chrome, setting `defaultRequest` will have no effect.
## Specifications

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ browser-compat: api.PresentationConnection.binaryType

When a {{DOMxRef("PresentationConnection")}} object is created, its `binaryType` IDL attribute _MUST_ be set to the string `"arraybuffer"`. Upon getting, the attribute _MUST_ return its most recent value (the value it was last set as). Upon setting, the user agent _MUST_ set the IDL attribute to the new value.

> **Note:** The `binaryType` attribute allows authors to control how binary data is exposed to scripts. By setting the attribute to `"blob"`, binary data is returned in `Blob` form; by setting it to `"arraybuffer"`, it is returned in {{JSxRef("ArrayBuffer")}} form. The attribute defaults to `"arraybuffer"`. This attribute has no effect on data sent in a string form.
> [!NOTE]
> The `binaryType` attribute allows authors to control how binary data is exposed to scripts. By setting the attribute to `"blob"`, binary data is returned in `Blob` form; by setting it to `"arraybuffer"`, it is returned in {{JSxRef("ArrayBuffer")}} form. The attribute defaults to `"arraybuffer"`. This attribute has no effect on data sent in a string form.
## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ browser-compat: api.PressureObserver.knownSources_static

The static **`knownSources`** read-only property of the {{domxref("PressureObserver")}} interface returns an array of the {{domxref("PressureRecord.source","source")}} values supported by the user agent in alphabetical order.

> **Note:** The list of supported sources varies per browser, operating system, and hardware, and is evolving. This property is merely a hint about source types the user agents supports. Call {{domxref("PressureObserver.observe()", "observe()")}} and check for a `NotSupportedError` to see if pressure observation is possible.
> [!NOTE]
> The list of supported sources varies per browser, operating system, and hardware, and is evolving. This property is merely a hint about source types the user agents supports. Call {{domxref("PressureObserver.observe()", "observe()")}} and check for a `NotSupportedError` to see if pressure observation is possible.
## Value

Expand Down
Loading

0 comments on commit 802b606

Please sign in to comment.