recursal/MDN huggingface dataset:
EncodedVideoChunk: timestamp property
=====================================

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
The **`timestamp`** read-only property of the `EncodedVideoChunk` interface returns an integer indicating the timestamp of the video in microseconds.

Value
-----

An integer.

Examples
--------

In the following example the `timestamp` is printed to the console.


```js
const init = {
  type: "key",
  data: videoBuffer,
  timestamp: 23000000,
  duration: 2000000,
};
chunk = EncodedVideoChunk(init);
console.log(chunk.timestamp); //23000000
```

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

| Specification |
| --- |
| WebCodecs # dom-encodedvideochunk-timestamp |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
The **`duration`** read-only property of the `EncodedVideoChunk` interface returns an integer indicating the duration of the video in microseconds.

Value
-----

An integer.

Examples
--------

In the following example the `duration` is printed to the console.


```js
const init = {
  type: "key",
  data: videoBuffer,
  timestamp: 23000000,
  duration: 2000000,
};
chunk = EncodedVideoChunk(init);

console.log(chunk.duration); //2000000
```

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

| Specification |
| --- |
| WebCodecs # dom-encodedvideochunk-duration |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
The **`copyTo()`** method of the `EncodedVideoChunk` interface copies the encoded chunk of video data.

Syntax
------


```js
copyTo(destination)
```

### Parameters

`destination`

An `ArrayBuffer`, a `TypedArray`, or a `DataView` that the data can be copied to.

### Return value

None (`undefined`).

Examples
--------

In the following example an `EncodedVideoChunk` is created then copied.


```js
const init = {
  type: "key",
  data: videoBuffer,
  timestamp: 23000000,
  duration: 2000000,
};
chunk = EncodedVideoChunk(init);

chunk.copyTo(newBuffer);
```

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

| Specification |
| --- |
| WebCodecs # dom-encodedvideochunk-copyto |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

The **`data`** property of the `HIDInputReportEvent` interface returns a `DataView` containing the data from the input report, excluding the `reportId` if the HID interface uses report IDs.

Value
-----

A `DataView`.

Examples
--------

In the following example the returned `data` is logged to the console.


```js
device.addEventListener("inputreport", (event) => {
  const { data, device, reportId } = event;
  console.log(data);
});
```

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

| Specification |
| --- |
| WebHID API # dom-hidinputreportevent-data |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

The **`reportId`** property of the `HIDInputReportEvent` interface returns the one-byte identification prefix for this report, or 0 if the HID interface does not use report IDs.

Value
-----

A one-byte identification prefix.

Examples
--------

In the following example the `reportId` of an incoming input report is logged to the console.


```js
device.addEventListener("inputreport", (event) => {
  const { data, device, reportId } = event;
  console.log(reportId);
});
```

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

| Specification |
| --- |
| WebHID API # dom-hidinputreportevent-reportid |

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

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

Limited availability
--------------------

This feature is not Baseline because it does not work in some of the most widely-used browsers.

* Learn more
* See full compatibility
* Report feedback
**Secure context:** This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

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

The **`device`** property of the `HIDInputReportEvent` interface returns the `HIDDevice` instance that represents the HID interface that sent the input report.

Value
-----

An `HIDDevice`.

Examples
--------

In the following example `device` is a `HIDDevice` instance, representing the device sending the report. The `productName` of this device is logged to the console.


```js
device.addEventListener("inputreport", (event) => {
  const { data, device, reportId } = event;
  console.log(device.productName);
});
```

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

| Specification |
| --- |
| WebHID API # dom-hidinputreportevent-device |

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

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

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

 The optional **`weight`** property of the
 `SpeechGrammar` interface sets and returns the weight of the
 `SpeechGrammar` object.

Value
-----

A float representing the weight of the grammar, in the range 0.0–1.0.

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

console.log(speechRecognitionList[0].src); // should return the same as the contents of the grammar variable
console.log(speechRecognitionList[0].weight); // should return 1 - the same as the weight set in line 4.
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammar-weight |

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

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

See also
--------

* Web Speech API
SpeechGrammar: SpeechGrammar() constructor
==========================================

**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.

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

 The **`SpeechGrammar()`** constructor of the
 `SpeechGrammar` interface creates a new `SpeechGrammar` object
 instance.

Syntax
------


```js
new SpeechGrammar()
```

### Parameters

None.

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

const newGrammar = new SpeechGrammar();
newGrammar.src =
  "#JSGF V1.0; grammar names; public <name> = chris | kirsty | mike;";
speechRecognitionList[1] = newGrammar; // should add the new SpeechGrammar object to the list
```

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

This API has no official W3C or WHATWG specification.

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

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

See also
--------

* Web Speech API
SpeechGrammar: src property
===========================

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

 The **`src`** property of the `SpeechGrammar`
 interface sets and returns a string containing the grammar from within in the
 `SpeechGrammar` object.

Value
-----

A string representing the grammar.

Examples
--------


```js
const grammar =
  "#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
const recognition = new SpeechRecognition();
const speechRecognitionList = new SpeechGrammarList();
speechRecognitionList.addFromString(grammar, 1);
recognition.grammars = speechRecognitionList;

console.log(speechRecognitionList[0].src); // should return the same as the contents of the grammar variable
console.log(speechRecognitionList[0].weight); // should return 1 - the same as the weight set in line 4.
```

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

| Specification |
| --- |
| Web Speech API # dom-speechgrammar-src |

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

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

See also
--------

* Web Speech API
TrustedTypePolicyFactory: isHTML() method
=========================================

The **`isHTML()`** method of the `TrustedTypePolicyFactory` interface returns true if it is passed a valid `TrustedHTML` object.

**Note:** The purpose of the functions `isHTML()`, `isScript()`, and `isScriptURL()` is to check if the object is a valid TrustedType object, created by a configured policy.

Syntax
------


```js
isHTML(value)
```

### Parameters

`value`

A `TrustedHTML` object.

### Return value

A `boolean` that is true if the object is a valid `TrustedHTML` object.

Examples
--------

In the below example the constant `html` was created by a policy, and therefore `isHTML()` returns true. The second example is an attempt to fake an object, and the third is a string. Both of these will return false when passed to `isHTML()`.


```js
const html = policy.createHTML("<div>");
console.log(trustedTypes.isHTML(html)); // true;

const fake = Object.create(TrustedHTML.prototype);
console.log(trustedTypes.isHTML(fake)); // false

console.log(trustedTypes.isHTML("<div>plain string</div>")); // false
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-ishtml |

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

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

The **`emptyScript`** read-only property of the `TrustedTypePolicyFactory` interface returns a `TrustedScript` object containing an empty string.

This object can be used when the application requires an empty string to be inserted into an injection sink which is expecting a `TrustedScript` object.

Value
-----

A `TrustedScript` object.

Examples
--------

The specification explains that the `emptyScript` object can be used to detect support for dynamic code compilation.

Native Trusted Types implementations can support `eval(TrustedScript)`, therefore in the below example a native implementation will return false for `eval(trustedTypes.emptyScript)`. A polyfill will return a truthy object.


```js
const supportsTS = !eval(trustedTypes.emptyScript);
eval(supportsTS ? myTrustedScriptObj : myTrustedScriptObj.toString());
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-emptyscript |

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

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

The **`emptyHTML`** read-only property of the `TrustedTypePolicyFactory` interface returns a `TrustedHTML` object containing an empty string.

This object can be used when the application requires an empty string to be inserted into an injection sink.

Value
-----

A `TrustedHTML` object.

Examples
--------

In the below example an empty string is to be inserted into the element. Therefore there is no need to create a policy, and the `emptyHTML` property can be used to insert the empty element when a Trusted Types object is expected.


```js
el.innerHTML = trustedTypes.emptyHTML;
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-emptyhtml |

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

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

The **`getPropertyType()`** method of the `TrustedTypePolicyFactory` interface allows web developers to check if a Trusted Type is required for an element's property.

Syntax
------


```js
getPropertyType(tagName, property)
getPropertyType(tagName, property, elementNS)
```

### Parameters

`tagName`

A string containing the name of an HTML tag.

`property`

A string containing a property, for example `"innerHTML"`.

`elementNS` Optional

A string containing a namespace, if empty defaults to the HTML namespace.

### Return value

A string with one of:

* `"TrustedHTML"`
* `"TrustedScript"`
* `"TrustedScriptURL"`

Or, null.

Examples
--------

In this example, passing the `<div>` element and `innerHTML` property to `getPropertyType` returns "TrustedHTML".


```js
console.log(trustedTypes.getPropertyType("div", "innerHTML")); // "TrustedHTML"
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-getpropertytype |

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

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

The **`defaultPolicy`** read-only property of the `TrustedTypePolicyFactory` interface returns the default `TrustedTypePolicy` or null if this is empty.

**Note:** Information about the creation and use of default policies can be found in the `createPolicy()` documentation.

Value
-----

A `TrustedTypePolicy` or null.

Examples
--------

The first line below returns null as no default policy has been created. Once a default policy is created, calling `defaultPolicy` returns that policy object.


```js
console.log(trustedTypes.defaultPolicy); // null
const dp = trustedTypes.createPolicy("default", {});
console.log(trustedTypes.defaultPolicy); // a TrustedTypePolicy object
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-defaultpolicy |

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

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

The **`isScript()`** method of the `TrustedTypePolicyFactory` interface returns true if it is passed a valid `TrustedScript` object.

**Note:** The purpose of the functions `isScript()`, `isHTML()`, and `isScriptURL()` is to check if the object is a valid TrustedType object, created by a configured policy.

Syntax
------


```js
isScript(value)
```

### Parameters

`value`

A `TrustedScript` object.

### Return value

A `boolean` that is true if the object is a valid `TrustedScript` object.

Examples
--------

In the below example the constant `url` was created by a policy, and therefore `isScriptURL()` returns true. The second example is an attempt to fake an object, and the third is a string. Both of these will return false when passed to `isScriptURL()`.


```js
const myScript = policy.createScript("eval('2 + 2')");
console.log(trustedTypes.isScript(myScript)); // true;

const fake = Object.create(TrustedScript.prototype);
console.log(trustedTypes.isScript(fake)); // false

console.log(trustedTypes.isScript("eval('2 + 2')")); // false
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-isscript |

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

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

The **`getAttributeType()`** method of the `TrustedTypePolicyFactory` interface allows web developers to check if a Trusted Type is required for an element, and if so which Trusted Type is used.

Syntax
------


```js
getAttributeType(tagName, attribute)
getAttributeType(tagName, attribute, elementNS)
getAttributeType(tagName, attribute, elementNS, attrNS)
```

### Parameters

`tagName`

A string containing the name of an HTML tag.

`attribute`

A string containing an attribute.

`elementNS` Optional

A string containing a namespace, if empty defaults to the HTML namespace.

`attrNS` Optional

A string containing a namespace, if empty defaults to null.

### Return value

A string with one of:

* `"TrustedHTML"`
* `"TrustedScript"`
* `"TrustedScriptURL"`

Or, null.

Examples
--------

In this example, passing the `<script>` element and `src` attribute to `getAttributeType` returns "TrustedScriptURL".


```js
console.log(trustedTypes.getAttributeType("script", "src")); // "TrustedScriptURL"
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-getattributetype |

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

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

The **`isScriptURL()`** method of the `TrustedTypePolicyFactory` interface returns true if it is passed a valid `TrustedScriptURL` object.

**Note:** The purpose of the functions `isScriptURL()`, `isHTML()`, and `isScript()` is to check if the object is a valid TrustedType object, created by a configured policy.

Syntax
------


```js
isScriptURL(value)
```

### Parameters

`value`

A `TrustedScriptURL` object.

### Return value

A `boolean`that is true if the object is a valid `TrustedScriptURL` object.

Examples
--------

In the below example the constant `url` was created by a policy, and therefore `isScriptURL()` returns true. The second example is an attempt to fake an object, and the third is a string. Both of these will return false when passed to `isScriptURL()`.


```js
const url = policy.createScriptURL("https://example.com/myscript.js");
console.log(trustedTypes.isScriptURL(url)); // true;

const fake = Object.create(TrustedScriptURL.prototype);
console.log(trustedTypes.isScriptURL(fake)); // false

console.log(trustedTypes.isScriptURL("https://example.com/myscript.js")); // false
```

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

| Specification |
| --- |
| Trusted Types # dom-trustedtypepolicyfactory-isscripturl |

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

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

 The **`documentURI`** read-only property of the
 `Document` interface returns the document location as a string.

Value
-----

A string.

Examples
--------

### JavaScript


```js
document.getElementById("url").textContent = document.documentURI;
```

### HTML


```html
<p id="urlText">
  URL:<br />
  <span id="url">URL goes here</span>
</p>
```

### Result

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

| Specification |
| --- |
| DOM Standard # ref-for-dom-document-documenturi① |

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

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

See also
--------

* The `document.URL` property which returns the same value.