recursal/MDN huggingface dataset:
CSSPseudoElement: element property
==================================

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

 The **`element`** read-only property of the
 `CSSPseudoElement` interface returns a reference to the originating element
 of the pseudo-element, in other words its parent element.

Value
-----

An `Element` representing the pseudo-element's originating element.

Examples
--------

 The example below demonstrates the relationship between
 `CSSPseudoElement.element` and `Element.pseudo()`:


```js
const myElement = document.querySelector("q");
const cssPseudoElement = myElement.pseudo("::after");
const originatingElement = cssPseudoElement.element;

console.log(myElement === originatingElement); // Outputs true
console.log(myElement.parentElement === originatingElement); // Outputs false
console.log(myElement.lastElementChild === cssPseudoElement); // Outputs false
console.log(myElement.lastChild === cssPseudoElement); // Outputs false
console.log(myElement.nextElementSibling === cssPseudoElement); // Outputs false
console.log(myElement.nextSibling === cssPseudoElement); // Outputs false
```

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

| Specification |
| --- |
| CSS Pseudo-Elements Module Level 4 # dom-csspseudoelement-element |

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

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

See also
--------

* `Element.pseudo()`
RTCPeerConnectionStats: dataChannelsClosed property
===================================================

The **`dataChannelsClosed`** property of the `RTCPeerConnectionStats` dictionary indicates the number of unique `RTCDataChannel` objects that have left the `open` state during their lifetime.

 A channel will leave the `open` state if either end of the connection or the underlying transport is closed.
 Note that channels that transition to `closing` or `closed` without ever being `open` are not counted in this number.

Value
-----

A positive integer that indicates the number of unique `RTCDataChannel` objects that have left the `open` state during their lifetime.

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

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcpeerconnectionstats-datachannelsclosed |

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

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

The **`timestamp`** property of the `RTCPeerConnectionStats` dictionary is a `DOMHighResTimeStamp` object specifying the time at which the data in the object was sampled.

Value
-----

A `DOMHighResTimeStamp` value indicating the time at which the activity described by the statistics in this object was recorded, in milliseconds elapsed since the beginning of January 1, 1970, UTC.

The value should be accurate to within a few milliseconds but may not be entirely precise, either because of hardware or operating system limitations or because of fingerprinting protection in the form of reduced clock precision or accuracy.

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

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcstats-timestamp |

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

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

The **`dataChannelsOpened`** property of the `RTCPeerConnectionStats` dictionary indicates the number of unique `RTCDataChannel` objects that have entered the `open` state during their lifetime.

Value
-----

A positive integer that indicates the number of unique `RTCDataChannel` objects that have entered the `open` state during their lifetime.

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

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcpeerconnectionstats-datachannelsopened |

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

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

The **`type`** property of the `RTCPeerConnectionStats` dictionary is a string with the value `"peer-connection"`.

 Different statistics are obtained by iterating the `RTCStatsReport` object returned by a call to `RTCPeerConnection.getStats()`.
 The type indicates the set of statistics available through the object in a particular iteration step.
 A value of `"peer-connection"` indicates that the statistics available in the current step are those defined in `RTCPeerConnectionStats`.

Value
-----

A string with the value `"peer-connection"`.

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

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcstats-type |

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

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

The **`id`** property of the `RTCPeerConnectionStats` dictionary is a string which uniquely identifies the object for which this object provides statistics.

Using the `id`, you can correlate this statistics object with others, in order to monitor statistics over time for a given WebRTC object, such as an `RTCPeerConnection`, or an `RTCDataChannel`.

Value
-----

A string that uniquely identifies the object for which this `RTCPeerConnectionStats` object provides statistics.

The format of the ID string is not defined by the specification, so you cannot reliably make any assumptions about the contents of the string, or assume that the format of the string will remain unchanged for a given object type.

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

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcstats-id |

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

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

 The **`evaluate()`** method of the
 `XPathExpression` interface executes an XPath expression on the given node or document and
 returns an `XPathResult`.

Syntax
------


```js
evaluate(contextNode)
evaluate(contextNode, type)
evaluate(contextNode, type, result)
```

### Parameters

`contextNode`

A `Node` representing the context to use for evaluating the expression.

`type` Optional

 Specifies the type of result to be returned by evaluating the expression. This must
 be one of the `XPathResult.Constants`.


`result` Optional

 Allows to specify a result object which may be reused and returned by this method.
 If this is specified as `null` or the implementation does not reuse the
 specified result, a new result object will be returned.


### Return value

 An `XPathResult` object representing the result of evaluating the XPath
 expression.

### Exceptions

#### INVALID\_EXPRESSION\_ERR

 If the expression is not legal according to the rules of the
 `XPathEvaluator`, an `XPathException` of type
 `INVALID_EXPRESSION_ERR` is raised.

#### TYPE\_ERR

 In case result cannot be converted to the specified type, an
 `XPathException` of type `TYPE_ERR` is raised.

#### NAMESPACE\_ERR

 If the expression contains namespace prefixes which cannot be resolved by the specified
 `XPathNSResolver`, a `DOMException` of type
 `NAMESPACE_ERROR` is raised.

#### WRONG\_DOCUMENT\_ERR

 If the provided context node is from a document that is not supported by the
 `XPathEvaluator`, a `DOMException` of type
 `WRONG_DOCUMENT_ERR` is raised.

#### NOT\_SUPPORTED\_ERR

 If the provided context node is not a type permitted as an XPath context node or the
 request type is not permitted by the `XPathEvaluator`, a
 `DOMException` of type `NOT_SUPPORTED_ERR` is raised.

Examples
--------

The following example shows the use of the `evaluate()` method.

### HTML


```html
<div>XPath example</div>
<div>Number of &lt;div&gt;s: <output></output></div>
```

### JavaScript


```js
const xpath = "//div";
const evaluator = new XPathEvaluator();
const expression = evaluator.createExpression("//div");
const result = expression.evaluate(
  document,
  XPathResult.ORDERED\_NODE\_SNAPSHOT\_TYPE,
);
document.querySelector("output").textContent = result.snapshotLength;
```

### Result

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

| Specification |
| --- |
| DOM Standard # dom-xpathexpression-evaluate |

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

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

The **`GamepadEvent()`** constructor creates a new `GamepadEvent` object.

Syntax
------


```js
new GamepadEvent(type, options)
```

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers set it to `gamepadconnected` or `gamepaddisconnected`.


`options`

An object that, *in addition of the properties defined in `Event()`*, can have the following properties:

`gamepad`

A `Gamepad` object describing the gamepad associated with the event.


### Return value

A new `GamepadEvent` object.

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

| Specification |
| --- |
| Gamepad # dom-gamepadevent-constructor |

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

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

 The **`GamepadEvent.gamepad`** property of the
 **`GamepadEvent` interface** returns a `Gamepad`
 object, providing access to the associated gamepad data for fired
 `gamepadconnected` and `gamepaddisconnected` events.

Value
-----

A `Gamepad` object.

Examples
--------

 The `gamepad` property being called on a fired
 `gamepadconnected` event.


```js
window.addEventListener("gamepadconnected", (e) => {
  console.log(
    "Gamepad connected at index %d: %s. %d buttons, %d axes.",
    e.gamepad.index,
    e.gamepad.id,
    e.gamepad.buttons.length,
    e.gamepad.axes.length,
  );
});
```

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

| Specification |
| --- |
| Gamepad # dom-gamepadevent-gamepad |

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

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

See also
--------

Using the Gamepad API
XRReferenceSpaceEvent: transform property
=========================================

 The read-only `XRReferenceSpaceEvent` property
 **`transform`** indicates the position and orientation of the
 affected `referenceSpace`'s
 native origin after the changes the event represents are applied. The
 `transform` is defined using the old coordinate system, which allows it to be
 used to convert coordinates from the pre-event coordinate system to the post-event
 coordinate system.

Value
-----

 An `XRRigidTransform` object providing a transform that can be used to
 convert coordinates from the pre-event coordinate system to the post-event coordinate
 system.

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

 Upon receiving a `reset` event, you can apply the `transform` to
 cached position or orientation information to shift them into the updated coordinate
 system. Alternatively, you can just discard any cached positional information and
 recompute from scratch. The approach you take will depend on your needs.

 For details on what causes a `reset` event and how to respond, see the
 `reset` event's documentation.

Examples
--------

 This example handles the `reset` event by walking through all the objects in
 a scene, updating each object's position by multiplying it with the event's given
 `transform`. The scene is represented by a `scene` object, with
 all the objects in an array called `objects` within it.


```js
xrReferenceSpace.addEventListener("reset", (event) => {
  for (const obj of scene.objects) {
    mat4.multiply(obj.transform, obj.transform, event.transform);
  }
});
```

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

| Specification |
| --- |
| WebXR Device API # dom-xrreferencespaceevent-transform |

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

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

 The **`XRReferenceSpaceEvent()`**
 constructor is used to create a new `XRReferenceSpaceEvent` object, which
 represents an event regarding the state of a WebXR reference space object,
 `XRReferenceSpace`.

Syntax
------


```js
new XRReferenceSpaceEvent(type, options)
```

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers always set it to `reset`.


`options`

An object that, *in addition of the properties defined in `Event()`*, can have the following properties:

`referenceSpace`

The `XRReferenceSpace` from which the event originates.

`transform`

An `XRRigidTransform` which maps the old coordinate system (from before the changes indicated by this event) to the new coordinate system.


### Return value

A new `XRReferenceSpaceEvent` object, initialized as defined by the input parameters.

Examples
--------

This simple snippet calls the constructor to create a new reference space event of type `reset`.


```js
let refSpaceEvent = new XRReferenceSpaceEvent("reset", {
  referenceSpace: myRefSpace,
  transform: myTransform,
});
```

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

| Specification |
| --- |
| WebXR Device API # dom-xrreferencespaceevent-xrreferencespaceevent |

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

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

 The read-only `XRReferenceSpaceEvent` property
 **`referenceSpace`** specifies the reference space which is the
 originator of the event.

Value
-----

An `XRReferenceSpace` indicating the source of the event.

Examples
--------

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

| Specification |
| --- |
| WebXR Device API # dom-xrreferencespaceevent-referencespace |

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

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

The **`DOMRect()`** constructor creates a new `DOMRect` object.

Syntax
------


```js
new DOMRect(x, y, width, height)
```

### Parameters

`x`

The `x` coordinate of the `DOMRect`'s origin.

`y`

The `y` coordinate of the `DOMRect`'s origin.

`width`

The width of the `DOMRect`.

`height`

The height of the `DOMRect`.

### Return value

A new `DOMRect` object.

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

| Specification |
| --- |
| Geometry Interfaces Module Level 1 # dom-domrect-domrect |

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

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

See also
--------

* `DOMPoint`
* `DOMRect`
* `DOMRect.fromRect()`
DOMRect: fromRect() static method
=================================

 The **`fromRect()`** static method of the
 `DOMRect` object creates a new `DOMRect`
 object with a given location and dimensions.

Syntax
------


```js
DOMRect.fromRect()
DOMRect.fromRect(rectangle)
```

### Parameters

`rectangle` Optional

 An object specifying the location and dimensions of a rectangle. All properties
 default to `0`. The properties are:


* `x`: The coordinate of the left side of the rectangle.
* `y`: The coordinate of the top side of the rectangle.
* `width`: The width of the rectangle.
* `height`: The height of the rectangle.

### Return value

An instance of `DOMRect`.

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

| Specification |
| --- |
| Geometry Interfaces Module Level 1 # dom-domrect-fromrect |

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

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

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

 The **`label`** property of the
 `GPUPipelineLayout` interface provides a label that can be used to identify the object, for example in `GPUError` messages or console warnings.

This can be set by providing a `label` property in the descriptor object passed into the originating `GPUDevice.createPipelineLayout()` call, or you can get and set it directly on the `GPUPipelineLayout` object.

Value
-----

A string. If this has not been previously set as described above, it will be an empty string.

Examples
--------

Setting and getting a label via `GPUPipelineLayout.label`:


```js
// ...

const pipelineLayout = device.createPipelineLayout({
  bindGroupLayouts: [bindGroupLayout],
});

pipelineLayout.label = "mypipelinelayout";

console.log(pipelineLayout.label); // "mypipelinelayout";
```


Setting a label via the originating `GPUDevice.createPipelineLayout()` call, and then getting it via `GPUPipelineLayout.label`:


```js
// ...

const pipelineLayout = device.createPipelineLayout({
  bindGroupLayouts: [bindGroupLayout],
  label: "mypipelinelayout",
});

console.log(pipelineLayout.label); // "mypipelinelayout";
```

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

| Specification |
| --- |
| WebGPU # dom-gpuobjectbase-label |

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

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

See also
--------

* The WebGPU API
FontFaceSet: load() method
==========================

The `load()` method of the `FontFaceSet` forces all the fonts given in parameters to be loaded.

Syntax
------


```js
load(font)
load(font, text)
```

### Parameters

`font`

a font specification using the CSS value syntax, e.g. "italic bold 16px Roboto"

`text`

limit the font faces to those whose Unicode range contains at least one of the characters in text. This does not check for individual glyph coverage.

### Return value

 A `Promise` fulfilled with an `Array` of loaded `FontFace` objects. The
 promise is fulfilled when all the fonts are loaded; it is rejected if one of the fonts
 failed to load.

Examples
--------

The following example returns a promise that will be fulfilled or rejected according the success of loading "MyFont". The code in `then()` can assume the availability of that font.


```js
document.fonts.load("12px MyFont", "ß").then(/\* ... \*/);
```

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

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

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

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

The **`add()`** method of the `FontFaceSet` interface adds a new font to the set.

Syntax
------


```js
add(font)
```

### Parameters

`font`

A `FontFace` to be added to the set.

### Return value

A new `FontFaceSet`.

### Exceptions

`InvalidModificationError` `DOMException`

Thrown if this font is already included via the CSS `@font-face` rule.

Examples
--------

In the following example a new `FontFace` object is created and then added to the `FontFaceSet`.


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

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

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

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

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

The `loadingdone` event fires when the document has loaded all fonts.

Syntax
------

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


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

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

Example
-------

In the following example, when the font `Ephesis` has finished loading, "Font loading complete" is printed to the console.


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

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

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

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

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

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

The **`has()`** method of the `FontFaceSet` interface returns a `Boolean` asserting whether an element is present with the given value.

Syntax
------


```js
has(value)
```

### Parameters

`value`

The value to test for in the `FontFaceSet` object.

### Return value

A `Boolean`, `true` if `value` exists in the `FontFaceSet`.

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

#### No specification found

No specification data found for `api.FontFaceSet.has`.  
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: values() method
============================

The **`values()`** method of the `FontFaceSet` interface returns a new iterator object that yields the values for each element in the `FontFaceSet` object in insertion order.

Syntax
------


```js
values()
```

### 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.values`.  
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: clear() method
===========================

The **`clear()`** method of the `FontFaceSet` interface removes all fonts added via this interface. Fonts added with the `@font-face` rule are not removed.

Syntax
------


```js
clear()
```

### Parameters

None.

### Return value

None (`undefined`).

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

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

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

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

The `ready` read-only property of the `FontFaceSet` interface returns a `Promise` that resolves to the given `FontFaceSet`.

The promise will only resolve once the document has completed loading fonts, layout operations are completed, and no further font loads are needed.

Value
-----

A `Promise` that resolves to the given `FontFaceSet`.

Examples
--------

In the following example the value of `ready` is printed to the console once the promise has resolved.


```js
async function isReady() {
  let ready = await document.fonts.ready;
  console.log(ready);
}

isReady();
```

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

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

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

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