recursal/MDN huggingface dataset:
FontFaceSet: forEach() method
=============================

The **`forEach()`** method of the `FontFaceSet` interface executes a provided function for each value in the `FontFaceSet` object.

Syntax
------


```js
forEach(callbackFn)
forEach(callbackFn, thisArg)
```

### Parameters

`callbackFn`

Function to execute for each element, taking three arguments:

`value`, `key`

The current element being processed in the `FontFaceSet`. As there are no keys in a `FontFaceSet`, the value is passed for both arguments.

`set`

The `FontFaceSet` which `forEach()` was called on.


`thisArg`

Value to use as `this` when executing `callbackFn`.

### Return value

Undefined.

Specifications
--------------

#### No specification found

No specification data found for `api.FontFaceSet.forEach`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: loading event
==========================

The `loading` event fires when the document begins loading fonts.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("loading", (event) => {});

onloading = (event) => {};
```

Example
-------

In the following example, when the font `Ephesis` starts to load, "Font is loading…" is printed to the console.


```js
document.fonts.onloading = () => {
  console.log("Font is loading");
};

(async () => {
  await document.fonts.load("16px Ephesis");
})();
```

Specifications
--------------

| Specification |
| --- |
| CSS Font Loading Module Level 3 # dom-fontfaceset-onloading |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: entries() method
=============================

The **`entries()`** method of the `FontFaceSet` interface returns a new `Iterator` object, containing an array of `[value,value]` for each element in the `FontFaceSet`.

Syntax
------


```js
entries()
```

### Parameters

None.

### Return value

A new iterator object that contains an array of `[value, value]` for each element in the `CustomStateSet`, in insertion order.

Specifications
--------------

#### No specification found

No specification data found for `api.FontFaceSet.entries`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: loadingerror event
===============================

The `loadingerror` event fires when fonts have finished loading, but some or all fonts have failed to load.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("loadingerror", (event) => {});

onloadingerror = (event) => {};
```

Example
-------

In the following example, if the font `Ephesis` fails to load, "Font loading error" is printed to the console.


```js
document.fonts.onloadingerror = () => {
  console.log("Font loading error");
};

(async () => {
  await document.fonts.load("16px Ephesis");
})();
```

Specifications
--------------

| Specification |
| --- |
| CSS Font Loading Module Level 3 # dom-fontfaceset-onloadingerror |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: size property
==========================

The **`size`** property of the `FontFaceSet` interface returns the number of items in the `FontFaceSet`.

Value
-----

An integer indicating the number of items in the `FontFaceSet`.

Examples
--------

In the following example the `size` of the `FontFaceSet` is printed to the console.


```js
console.log(document.fonts.size);
```

Specifications
--------------

#### No specification found

No specification data found for `api.FontFaceSet.size`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: keys() method
==========================

The **`keys()`** method of the `FontFaceSet` interface is an alias for `FontFaceSet.values`.

Syntax
------


```js
keys()
```

### Parameters

None.

### Return value

A new iterator object containing the values for each element in the given `FontFaceSet`, in insertion order.

Specifications
--------------

#### No specification found

No specification data found for `api.FontFaceSet.keys`.  
Check for problems with this page or contribute a missing `spec_url` to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: delete() method
============================

The **`delete()`** method of the `FontFaceSet` interface removes a font from the set.

Font faces that were added to the set using the CSS `@font-face` rule remain connected to the corresponding CSS, and cannot be deleted.

Syntax
------


```js
delete(font)
```

### Parameters

`font`

A `FontFace` to be removed from the set.

### Return value

A boolean value which is `true` if the deletion was successful, and `false` otherwise.

Examples
--------

In the following example a new `FontFace` object is created and then deleted from the `FontFaceSet`.


```js
const font = new FontFace("MyFont", "url(myFont.woff2)");
document.fonts.delete(font);
```

Specifications
--------------

| Specification |
| --- |
| CSS Font Loading Module Level 3 # dom-fontfaceset-delete |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
FontFaceSet: status property
============================

The **`status`** read-only property of the `FontFaceSet` interface returns the loading state of the fonts in the set.

Value
-----

One of:

* `"loading"`
* `"loaded"`
Examples
--------

In the following example the `status` of the `FontFaceSet` is printed to the console.


```js
console.log(document.fonts.status);
```

Specifications
--------------

| Specification |
| --- |
| CSS Font Loading Module Level 3 # dom-fontfaceset-status |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
CSSMathMax: values property
===========================

 The CSSMathMax.values read-only property of the
 `CSSMathMax` interface returns a `CSSNumericArray` object
 which contains one or more `CSSNumericValue` objects.

Value
-----

A `CSSNumericArray`.

Examples
--------

To do

Specifications
--------------

| Specification |
| --- |
| CSS Typed OM Level 1 # dom-cssmathmax-values |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
CSSMathMax: CSSMathMax() constructor
====================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

 The **`CSSMathMax()`** constructor creates a
 new `CSSMathMax` object which represents the CSS `max()` function.

Syntax
------


```js
new CSSMathMax(args)
```

### Parameters

`args`

 A list of values for the `CSSMathProduct` object to be either a double
 integer or a `CSSNumericValue`.


### Exceptions

`TypeError`

Thrown if there is a *failure* when adding all of the values in args.

Examples
--------

To do

Specifications
--------------

| Specification |
| --- |
| CSS Typed OM Level 1 # dom-cssmathmax-cssmathmax |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
ReportingObserver: takeRecords() method
=======================================

 The **`takeRecords()`** method of the
 `ReportingObserver` interface returns the current list of reports contained
 in the observer's report queue, and empties the queue.

Syntax
------


```js
takeRecords()
```

### Parameters

None.

### Return value

An array of `Report` objects.

Examples
--------


```js
const options = {
  types: ["deprecation"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  reportBtn.onclick = () => displayReports(reports);
}, options);

observer.observe();

// …

const records = observer.takeRecords();
console.log(records);
```

Specifications
--------------

| Specification |
| --- |
| Reporting API # dom-reportingobserver-takerecords |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Reporting API
ReportingObserver: ReportingObserver() constructor
==================================================

 The **`ReportingObserver()`** constructor of the Reporting API creates a new
 `ReportingObserver` object instance, which can be used to collect and
 access reports.

Syntax
------


```js
new ReportingObserver(callback)
new ReportingObserver(callback, options)
```

### Parameters

`callback`

 A callback function that runs when the observer starts to collect reports (i.e. via
 `ReportingObserver.observe()`). The callback function is given two
 parameters:


`reports`

 A sequence of `Report` objects representing
 the reports collected in the observer's report queue. This is probably the most
 common way to retrieve the reports.


`observer`

 A reference to the same `ReportingObserver`
 object, allowing for recursive report collection, etc.



`options` Optional

An object allowing you to set the options for creating the object. The available options are:

`types`

 An array of strings representing the types of report to be
 collected by this observer. Available types include `deprecation`,
 `intervention`, and `crash` (although this last type usually
 isn't retrievable via a `ReportingObserver`). If this option is omitted, all supported types are collected.


`buffered`

 a boolean that defines whether the reports that were
 generated before the observer was able to be created should be observable
 (`true`) or not (`false`).



Examples
--------


```js
const options = {
  types: ["deprecation"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  reportBtn.onclick = () => displayReports(reports);
}, options);
```

Specifications
--------------

| Specification |
| --- |
| Reporting API # dom-reportingobserver-reportingobserver |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Reporting API
ReportingObserver: disconnect() method
======================================

 The **`disconnect()`** method of the
 `ReportingObserver` interface stops a reporting observer that had
 previously started observing from collecting reports.

 After calling `disconnect()`, neither
 `ReportingObserver.takeRecords()` nor the `records` parameter of
 the
 `ReportingObserver()`
 callback will return any reports. The associated observer will no longer be active.

Syntax
------


```js
disconnect()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------


```js
const options = {
  types: ["deprecation"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  reportBtn.onclick = () => displayReports(reports);
}, options);

observer.observe();

// ...

observer.disconnect();
```

Specifications
--------------

| Specification |
| --- |
| Reporting API # dom-reportingobserver-disconnect |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Reporting API
ReportingObserver: observe() method
===================================

 The **`observe()`** method of the
 `ReportingObserver` interface instructs a reporting observer to start
 collecting reports in its report queue.

Syntax
------


```js
observe()
```

### Parameters

None.

### Return value

None (`undefined`).

Examples
--------


```js
const options = {
  types: ["deprecation"],
  buffered: true,
};

const observer = new ReportingObserver((reports, observer) => {
  reportBtn.onclick = () => displayReports(reports);
}, options);

observer.observe();
```

Specifications
--------------

| Specification |
| --- |
| Reporting API # dom-reportingobserver-observe |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Reporting API
XRInputSource: hand property
============================

The read-only **`hand`** property of the `XRInputSource` interface is a `XRHand` object providing access to a hand-tracking device.

Value
-----

An `XRHand` object or `null` if the `XRSession` has not been requested with the `hand-tracking` feature descriptor.

Examples
--------


```js
navigator.xr
  .requestSession({ optionalFeatures: ["hand-tracking"] })
  .then(/\* … \*/);

function renderFrame(session, frame) {
  // …

  for (const inputSource of session.inputSources) {
    if (inputSource.hand) {
      // render a hand model, perform gesture detection, etc.
    }
  }
}
```

Specifications
--------------

| Specification |
| --- |
| WebXR Hand Input Module - Level 1 # dom-xrinputsource-hand |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `XRHand`
XRInputSource: profiles property
================================

The read-only `XRInputSource` property **`profiles`** returns an array of strings, each describing a configuration profile for the input source. The profile strings are listed in order of specificity, with the most specific profile listed first.

**Note:** The `profiles` list is always empty when the WebXR
 session is in inline mode.


Value
-----

 An array of strings, each describing one configuration profile
 for the input device represented by the `XRInputSource` object. Each input
 profile specifies the preferred visual representation and behavior of the input source.

### Input profile names

 An input profile name is a string describing a visual representation and behavior the
 input source may be configured to use. Each string:

* Has no spaces; instead, words are separated by hyphen ("-") characters
* If the platform makes it available, the USB vendor and product ID may be provided
 but cannot be relied upon
* Does not uniquely identify a specific device; rather, it identifies a configuration
 that the product is capable of using
* Does not provide information about handedness of the device, if applicable

 The WebXR Input Profiles Registry is used by device developers and browser developers to
 attempt to ensure that a given device will report the same profile strings regardless of
 which browser or other user agent you use.

### Generic input profile names

The following input profile names are generic and can serve as fallbacks that describe the devices in the roughest sense.

* generic-button
* generic-hand-select-grasp
* generic-hand-select
* generic-hand
* generic-touchpad
* generic-touchscreen
* generic-trigger-squeeze-thumbstick
* generic-trigger-squeeze-touchpad-thumbstick
* generic-trigger-squeeze-touchpad
* generic-trigger-squeeze
* generic-trigger-thumbstick
* generic-trigger-touchpad-thumbstick
* generic-trigger-touchpad
* generic-trigger
Examples
--------

The list in `profiles` is in order of reverse specificity; that is, the most precise description is first, and the least precise description is last. The first entry in the list is typically indicative of the precise model of the controller, or of a model with which the controller is compatible.

For example, entry 0 in `profiles` for an Oculus Touch controller is `oculus-touch`. The next entry is `generic-trigger-squeeze-thumbstick`, indicating a generic device with a trigger, a squeeze control, and a thumbstick. While the Oculus Touch controller actually has a thumbpad rather than a thumbstick, the overall description is "close enough" that the details within the profile matching the name will let the controller be interpreted usefully.


```js
inputSource.profiles;
// ['oculus-touch', 'generic-trigger-squeeze-thumbstick']
```

Specifications
--------------

| Specification |
| --- |
| WebXR Device API # dom-xrinputsource-profiles |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* WebXR Device API
* Inputs and input sources
XRInputSource: handedness property
==================================

 The read-only `XRInputSource` property
 **`handedness`** indicates which of the user's hands the WebXR
 input source is associated with, or if it's not associated with a hand at all.

Value
-----

 A string indicating whether the input controller is held in one of
 the user's hands, and if it is, which hand. The value is one of the following:

`none`

The input controller is not associated with one of the user's hands.

`left`

The input controller is being held in, worn on, or is attached to the user's left hand.

`right`

The input controller is being held in, worn on, or is attached to the user's right hand.

Usage notes
-----------

 If the input source is not a device associated with a user's hand (whether by being
 held, attached, or worn), the value of `handedness` is `none`.
 This may indicate, for example, an input source which isn't hand-held, such as controls
 built into a headset or an input device attached to the head or body.

Examples
--------

One important usage scenario for `handedness` is to determine which hand a controller is in so you can draw a representation of that hand (or the device that hand is controlling) in virtual space.


```js
function updateInputSources(session, frame, refSpace) {
  for (const source of session.inputSources) {
    if (source.gripSpace) {
      const gripPose = frame.getPose(source.gripSpace, refSpace);

      if (gripPose) {
        myRenderHandObject(gripPose, inputSource.handedness);
      }
    }
  }
}
```


This function, which would be called every animation frame (or possibly just periodically, depending on the degree of smoothness required and any performance constraints), scans the list of input sources looking for any which have a `gripSpace` which isn't `null`. If a `gripSpace` is present, that means the input source is a hand-held device of some sort, so it should be rendered visibly if possible.

If `gripSpace` is non-`null`, the function proceeds to get the pose for the `gripSpace` transformed into the current reference space. Assuming that's then valid, a function called `myRenderHandObject()` is called with the grip's pose and the value of `handedness`. It then draws the appropriate model positioned and formed for the correct hand.

Specifications
--------------

| Specification |
| --- |
| WebXR Device API # dom-xrinputsource-handedness |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* WebXR Device API
* Inputs and input sources
* Using gamepads in WebXR applications
XRInputSource: gamepad property
===============================

The read-only `XRInputSource` property **`gamepad`** returns a `Gamepad` object describing the state of the buttons and axes on the XR input source, if it is a gamepad or comparable device. If the device isn't a gamepad-like device, this property's value is `null`.

The `Gamepad` instance returned behaves as described by the Gamepad API. However, there are a few things to note:

* `Gamepad` instances belonging to `XRInputSource` are not included in the array returned by `navigator.getGamepads()`. Gamepads are strictly associated with the WebXR hardware and are not general-purpose gaming devices.
* `Gamepad.id` is an empty string (`""`)
* `Gamepad.index` is `-1`
* `Gamepad.connected` is `true` until the `XRInputSource` is removed from the list of active XR input sources or the `XRSession` is ended.
* If an axis reported by `Gamepad.axes` represents an axis of a touchpad, the value is 0 when the associated `GamepadButton.touched` property is `false`.
* `Gamepad.mapping` returns "xr-standard".
Examples
--------

### Using a gamepad input source


```js
for (const source of frame.session.inputSources) {
  const gamepad = source.gamepad;
  if (gamepad) {
    if (gamepad.buttons[2].pressed) {
      // do something
    }
  }
}
```

Specifications
--------------

| Specification |
| --- |
| WebXR Gamepads Module - Level 1 # dom-xrinputsource-gamepad |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.