recursal/MDN huggingface dataset:
TouchList: item() method
========================

 The **`item()`** method returns the `Touch`
 object at the specified index in the `TouchList`.

Syntax
------


```js
item(index)
```

### Parameters

`index`

 The index of the `Touch` object to retrieve. The index is a number in
 the range of 0 to one less than the length of the `TouchList`.


### Return value

`touchPoint`

 The requested `Touch` object from the `TouchList`.
 Returns `null` if the index is not less than the length of the list.


Examples
--------

 This code example illustrates the use of the `TouchList` interface's
 `item` method and the
 `length` property.


```js
const target = document.getElementById("target");

target.addEventListener(
  "touchstart",
  (ev) => {
    // If this touchstart event started on element target,
    // set touch to the first item in the targetTouches list;
    // otherwise set touch to the first item in the touches list
    const touch =
      ev.targetTouches.length >= 1
        ? ev.targetTouches.item(0)
        : ev.touches.item(0);
  },
  false,
);
```

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

| Specification |
| --- |
| Touch Events # dom-touchlist-item |

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

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

 The **`animationName`** property of the
 `CSSAnimation` interface returns the `animation-name`. This
 specifies one or more keyframe at-rules which describe the animation applied to the
 element.

Value
-----

A string.

Examples
--------

### Returning the animationName

 The animation in the following example is defined in CSS with the name
 `slide-in`. Calling `Element.getAnimations()` returns an array
 of all `Animation` objects. The `animationName` property returns
 the name given to the animation, in our case `slide-in`.


```css
.animate {
  animation: slide-in 0.7s both;
}

@keyframes slide-in {
  0% {
    transform: translateY(-1000px);
  }
  100% {
    transform: translateY(0);
  }
}
```



```js
let animations = document.querySelector(".animate").getAnimations();
console.log(animations[0].animationName);
```

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

| Specification |
| --- |
| CSS Animations Level 2 # dom-cssanimation-animationname |

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

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

 The `XMLSerializer` method
 **`serializeToString()`** constructs a string representing the
 specified DOM tree in XML form.

Syntax
------


```js
serializeToString(rootNode)
```

### Parameters

`rootNode`

 The `Node` to use as the root of the DOM tree or subtree for which to
 construct an XML representation.


### Return value

A string containing the XML representation of the specified DOM tree.

### Exceptions

`TypeError`

 Thrown if the specified `rootNode` is not a compatible node type. The root node
 must be either `Node` or `Attr`.


`InvalidStateError` `DOMException`

 Thrown if the tree could not be successfully serialized, probably due to issues with the
 content's compatibility with XML serialization.


`SyntaxError` `DOMException`

 Thrown if a serialization of HTML was requested but could not succeed due to the content not
 being well-formed.


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

### Compatible node types

 The specified root node—and all of its descendants—must be compatible with the XML
 serialization algorithm. The root node itself must be either a `Node` or
 `Attr` object.

 The following types are also permitted as descendants of the root node, in addition to
 `Node` and `Attr`:

* `DocumentType`
* `Document`
* `DocumentFragment`
* `Element`
* `Comment`
* `Text`
* `ProcessingInstruction`
* `Attr`

If any other type is encountered, a `TypeError` exception is thrown.

### Notes on the resulting XML

 There are some things worth noting about the XML output by
 `serializeToString()`:

* For XML serializations, `Element` and `Attr` nodes are always
 serialized with their `namespaceURI` intact. This
 may mean that a previously-specified `prefix` or default
 namespace may be dropped or altered.
* The resulting XML is compatible with the HTML parser.
* Elements in the HTML namespace that have no child nodes (thereby representing empty
 tags) are serialized with both begin and end tags
 (`"<someelement></someelement>"`) instead of using the
 empty-element tag (`"<someelement/>"`).
Specifications
--------------

| Specification |
| --- |
| DOM Parsing and Serialization # dom-xmlserializer-serializetostring |

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

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

See also
--------

* Parsing and serializing XML
* Serializing to HTML: `Element.innerHTML` and
 `Element.outerHTML`
* Parsing HTML or XML to create a DOM tree: `DOMParser`
XMLSerializer: XMLSerializer() constructor
==========================================

The **`XMLSerializer()`** constructor creates a new `XMLSerializer`.

Syntax
------


```js
new XMLSerializer()
```

### Parameters

None.

### Return value

A new `XMLSerializer` object.

Examples
--------

### Serializing XML into a string

This example serializes an entire document into a string containing XML.


```js
const s = new XMLSerializer();
const d = document;
const str = s.serializeToString(d);
saveXML(str);
```


This involves creating a new `XMLSerializer` object, then passing the `Document` to be serialized into `serializeToString()`, which returns the XML equivalent of the document. `saveXML()` represents a function that would then save the serialized string.

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

| Specification |
| --- |
| DOM Parsing and Serialization # dom-xmlserializer-constructor |

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

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

 The `MediaTrackConstraints` dictionary's
 **`frameRate`** property is a `ConstrainDouble`
 describing the requested or mandatory constraints placed upon the value of the
 `frameRate` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.frameRate` as returned by a
 call to `MediaDevices.getSupportedConstraints()`. However, typically this
 is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

 A `ConstrainDouble` describing the acceptable or required value(s) for a
 video track's frame rate, in frames per second.

 If this value is a number, the user agent will attempt to obtain media whose frame rate
 is as close as possible to this number given the capabilities of the hardware and the
 other constraints specified. Otherwise, the value of this `ConstrainDouble`
 will guide the user agent in its efforts to provide an exact match to the required frame
 rate (if `exact` is specified or both `min` and `max`
 are provided and have the same value) or to a best-possible value.

Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-framerate |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: logicalSurface property
==============================================

The `MediaTrackConstraints` dictionary's **`logicalSurface`** property is a `ConstrainDOMString` describing the requested or mandatory constraints placed upon the value of the `logicalSurface` constrainable property.

 This is used to specify whether or
 not `getDisplayMedia()` should allow the
 user to choose display surfaces which are not necessarily fully visible on the screen,
 such as occluded windows or the complete content of windows which are large enough to
 require scrolling to see their entire contents.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.logicalSurface` as returned by
 a call to `MediaDevices.getSupportedConstraints()`. However, typically this
 is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

A `ConstrainBoolean` which is `true` if logical surfaces should be permitted among the selections available to the user.

See how constraints are defined.

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

 You can check the setting selected by the user agent after the display media has been
 created by `getDisplayMedia()` by calling
 `getSettings()` on the display media's
 video `MediaStreamTrack`, then checking the value of the returned
 `MediaTrackSettings` object's
 `logicalSurface` object.

 For example, if your app needs to know if the selected display surface is a logical
 one:


```js
let isLogicalSurface = displayStream
  .getVideoTracks()[0]
  .getSettings().logicalSurface;
```


 Following this code, `isLogicalSurface` is `true` if the display
 surface contained in the stream is a logical surface; that is, one which may not be
 entirely onscreen, or may even be entirely offscreen.

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

| Specification |
| --- |
| Screen Capture # dom-mediatrackconstraintset-logicalsurface |

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

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

See also
--------

* Screen Capture API
* Using the Screen Capture API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
MediaTrackConstraints: suppressLocalAudioPlayback property
==========================================================

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

The `MediaTrackConstraints` dictionary's **`suppressLocalAudioPlayback`** property is a `ConstrainBoolean` describing the requested or mandatory constraints placed upon the value of the `suppressLocalAudioPlayback` constrainable property. This property controls whether the audio playing in a tab will continue to be played out of a user's local speakers when the tab is captured.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.suppressLocalAudioPlayback` as returned
 by a call to `MediaDevices.getSupportedConstraints()`. However, typically
 this is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

A `ConstrainBoolean` value.

 If this value is a simple `true` or `false`, the user agent will
 attempt to obtain media with local audio playback enabled or disabled as specified, if
 possible, but will not fail if this can't be done.

 If the value is given as `ideal`, that field's boolean value indicates an ideal
 setting for the local audio playback suppression feature; if it can't be met, then the request will
 result in an error.

Examples
--------


```js
let isLocalAudioSuppressed = displayStream
  .getVideoTracks()[0]
  .getSettings().suppressLocalAudioPlayback;
```


The Constraint exerciser example shows how to use media track constraints.

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

| Specification |
| --- |
| Screen Capture # dom-mediatrackconstraintset-suppresslocalaudioplayback |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: latency property
=======================================

 The `MediaTrackConstraints` dictionary's
 **`latency`** property is a `ConstrainDouble`
 describing the requested or mandatory constraints placed upon the value of the
 `latency` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.latency` as returned by a call
 to `MediaDevices.getSupportedConstraints()`. However, typically this is
 unnecessary since browsers will ignore any constraints they're unfamiliar with.

 Because RTP doesn't include this information, tracks associated with a
 WebRTC `RTCPeerConnection`
 will never include this property.

Value
-----

 A `ConstrainDouble` describing the acceptable or required value(s) for an
 audio track's latency, with values specified in seconds. In audio processing, latency is
 the time between the start of processing (when sound occurs in the real world, or is
 generated by a hardware device) and the data being made available to the next step in
 the audio input or output process. In most cases, low latency is desirable for
 performance and user experience purposes, but when power consumption is a concern, or
 delays are otherwise acceptable, higher latency might be acceptable.

 If this property's value is a number, the user agent will attempt to obtain media whose
 latency tends to be as close as possible to this number given the capabilities of the
 hardware and the other constraints specified. Otherwise, the value of this
 `ConstrainDouble` will guide the user agent in its efforts to provide an
 exact match to the required latency (if `exact` is specified or both
 `min` and `max` are provided and have the same value) or to a
 best-possible value.


**Note:** Latency is always prone to some variation due to hardware usage demands, network
 constraints, and so forth, so even in an "exact" match, some variation should be
 expected.


Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-latency |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: height property
======================================

 The `MediaTrackConstraints` dictionary's
 **`height`** property is a `ConstrainULong`
 describing the requested or mandatory constraints placed upon the value of the
 `height` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.height` as returned by a call
 to `MediaDevices.getSupportedConstraints()`. However, typically this is
 unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

 If this value is a number, the user agent will attempt to obtain media whose height is
 as close as possible to this number given the capabilities of the hardware and the other
 constraints specified. Otherwise, the value of this `ConstrainULong` will
 guide the user agent in its efforts to provide an exact match to the required height (if
 `exact` is specified or both `min` and `max` are
 provided and have the same value) or to a best-possible value.

Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-height |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: sampleRate property
==========================================

 The `MediaTrackConstraints` dictionary's
 **`sampleRate`** property is a `ConstrainULong`
 describing the requested or mandatory constraints placed upon the value of the
 `sampleRate` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.sampleRate` as returned by a
 call to `MediaDevices.getSupportedConstraints()`. However, typically this
 is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

 If this value is a number, the user agent will attempt to obtain media whose sample
 rate is as close as possible to this number given the capabilities of the hardware and
 the other constraints specified. Otherwise, the value of this
 `ConstrainULong` will guide the user agent in its efforts to provide an
 exact match to the required sample rate (if `exact` is specified or both
 `min` and `max` are provided and have the same value) or to a
 best-possible value.

Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-samplerate |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: autoGainControl property
===============================================

 The `MediaTrackConstraints` dictionary's **`autoGainControl`** property is a `ConstrainBoolean` describing the requested or mandatory constraints placed
 upon the value of the `autoGainControl` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.autoGainControl` as returned
 by a call to `MediaDevices.getSupportedConstraints()`. However, typically
 this is unnecessary since browsers will ignore any constraints they're unfamiliar with.

 Automatic gain control is typically a feature provided by microphones, although it can
 be provided by other input sources as well.

Value
-----

 If this value is a simple `true` or `false`, the user agent will
 attempt to obtain media with automatic gain control enabled or disabled as specified, if
 possible, but will not fail if this can't be done. If, instead, the value is given as an
 object with an `exact` field, that field's Boolean value indicates a required
 setting for the automatic gain control feature; if it can't be met, then the request
 will result in an error.

Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-autogaincontrol |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: volume property
======================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

 The `MediaTrackConstraints` dictionary's
 **`volume`** property is a `ConstrainDouble`
 describing the requested or mandatory constraints placed upon the value of the
 `volume` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.volume` as returned by a call
 to `MediaDevices.getSupportedConstraints()`. However, typically this is
 unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value
-----

 A `ConstrainDouble` describing the acceptable or required value(s) for an
 audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest
 supported volume.

 If this value is a number, the user agent will attempt to obtain media whose volume is
 as close as possible to this number given the capabilities of the hardware and the other
 constraints specified. Otherwise, the value of this `ConstrainDouble` will
 guide the user agent in its efforts to provide an exact match to the required volume (if
 `exact` is specified or both `min` and `max` are
 provided and have the same value) or to a best-possible value.

 Any constraint set which only permits values outside the range 0.0 to 1.0 cannot be
 satisfied and will result in failure.

Examples
--------

See the Constraint exerciser example.

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`
MediaTrackConstraints: noiseSuppression property
================================================

The `MediaTrackConstraints` dictionary's **`noiseSuppression`** property is a `ConstrainBoolean` describing the requested or mandatory constraints placed upon the value of the `noiseSuppression` constrainable property.

 If needed, you can determine whether or not this constraint is supported by checking
 the value of `MediaTrackSupportedConstraints.noiseSuppression` as returned
 by a call to `MediaDevices.getSupportedConstraints()`. However, typically
 this is unnecessary since browsers will ignore any constraints they're unfamiliar with.

 Noise suppression is typically provided by microphones, although it can be provided by
 other input sources as well.

Value
-----

 If this value is a simple `true` or `false`, the user agent will
 attempt to obtain media with noise suppression enabled or disabled as specified, if
 possible, but will not fail if this can't be done. If, instead, the value is given as an
 object with an `exact` field, that field's Boolean value indicates a required
 setting for the noise suppression feature; if it can't be met, then the request will
 result in an error.

Examples
--------

See the Constraint exerciser example.

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

| Specification |
| --- |
| Media Capture and Streams # dom-mediatrackconstraintset-noisesuppression |

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

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

See also
--------

* Media Capture and Streams API
* Capabilities, constraints, and settings
* `MediaTrackConstraints`
* `MediaDevices.getSupportedConstraints()`
* `MediaTrackSupportedConstraints`
* `MediaStreamTrack`