recursal/MDN huggingface dataset:
MessagePort
===========

The **`MessagePort`** interface of the Channel Messaging API represents one of the two ports of a `MessageChannel`, allowing messages to be sent from one port and listening out for them arriving at the other.

`MessagePort` is a transferable object.

**Note:** This feature is available in Web Workers

EventTarget

MessagePortInstance methods
----------------

*Inherits methods from its parent, `EventTarget`*.

`postMessage()`

Sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts.

`start()`

Starts the sending of messages queued on the port (only needed when using `EventTarget.addEventListener`; it is implied when using `onmessage`).

`close()`

Disconnects the port, so it is no longer active.

Events
------

*Inherits events from its parent, `EventTarget`*.

`message`

Fired when a `MessagePort` object receives a message.

`messageerror`

Fired when a `MessagePort` object receives a message that can't be deserialized.

Example
-------

In the following example, you can see a new channel being created using the `MessageChannel()` constructor.

When the IFrame has loaded, we register an `onmessage` handler for `MessageChannel.port1` and transfer `MessageChannel.port2` to the IFrame using the `window.postMessage` method along with a message.

When a message is received back from the IFrame, the `onMessage` function outputs the message to a paragraph.


```js
const channel = new MessageChannel();
const output = document.querySelector(".output");
const iframe = document.querySelector("iframe");

// Wait for the iframe to load
iframe.addEventListener("load", onLoad);

function onLoad() {
  // Listen for messages on port1
  channel.port1.onmessage = onMessage;

  // Transfer port2 to the iframe
  iframe.contentWindow.postMessage("Hello from the main page!", "\*", [
    channel.port2,
  ]);
}

// Handle messages received on port1
function onMessage(e) {
  output.innerHTML = e.data;
}
```


For a full working example, see our channel messaging basic demo on GitHub (run it live too).

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

| Specification |
| --- |
| HTML Standard # message-ports |

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

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

See also
--------

* Using channel messaging
WebTransportError
=================

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.

The **`WebTransportError`** interface of the WebTransport API represents an error related to the API, which can arise from server errors, network connection problems, or client-initiated abort operations (for example, arising from a `WritableStream.abort()` call).

DOMException

WebTransportError

**Note:** This feature is available in Web Workers

Constructor
-----------

`WebTransportError()`

Creates a new `WebTransportError` object instance.

Instance properties
-------------------

*Inherits properties from its parent, `DOMException`.*

`source` Read only 

Returns an enumerated value indicating the source of the error—can be either `stream` or `session`.

`streamErrorCode` Read only 

Returns a number in the range 0-255 indicating the application protocol error code for this error, or `null` if one is not available.

Examples
--------


```js
const url = "notaurl";

async function initTransport(url) {
  try {
    // Initialize transport connection
    const transport = new WebTransport(url);

    // The connection can be used once ready fulfills
    await transport.ready;

    // ...
  } catch (error) {
    const msg = `Transport initialization failed.
 Reason: ${error.message}.
 Source: ${error.source}.
 Error code: ${error.streamErrorCode}.`;
    console.log(msg);
  }
}
```

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

| Specification |
| --- |
| WebTransport # webtransporterror |

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

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

See also
--------

* Using WebTransport
* WebSockets API
* Streams API
* WebTransport over HTTP/3
FeaturePolicy
=============

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

The `FeaturePolicy` interface represents the set of Permissions Policies applied to the current execution context.

Instance methods
----------------

`FeaturePolicy.allowsFeature` 
Experimental

Returns a Boolean that indicates whether or not a particular feature is enabled in the specified context.

`FeaturePolicy.features` 
Experimental

Returns a list of names of all features supported by the User Agent. Features whose names appear on the list might not be allowed by the Permissions Policy of the current execution context and/or might be restricted by user-granted permissions.

`FeaturePolicy.allowedFeatures` 
Experimental

Returns a list of names of all features supported by the User Agent and allowed by the Permissions Policy. Note that features appearing on this list might still be behind a user permission.

`FeaturePolicy.getAllowlistForFeature` 
Experimental

Returns the allow for the specified feature.

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

#### No specification found

No specification data found for `api.FeaturePolicy`.  
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.

See also
--------

* `Permissions-Policy`
* Privacy, permissions, and information security
GPUOutOfMemoryError
===================

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

The **`GPUOutOfMemoryError`** interface of the WebGPU API describes an out-of-memory (oom) error indicating that there was not enough free memory to complete the requested operation.

It represents one of the types of errors surfaced by `GPUDevice.popErrorScope` and the `uncapturederror` event.

Out-of-memory errors should be relatively rare in a well-behaved app but are less predictable than `GPUValidationError`s. This is because they are dependent on the device your app is running on as well as other apps that are using GPU resources at the time.

GPUError

GPUOutOfMemoryErrorConstructor
-----------

`GPUOutOfMemoryError()` 
Experimental

Creates a new `GPUOutOfMemoryError` object instance.

Instance properties
-------------------

The `message` property is inherited from its parent, `GPUError`:

`message` 
Experimental
 Read only 

A string providing a human-readable message that explains why the error occurred.

Examples
--------

The following example uses an error scope to capture an out-of-memory error, logging it to the console.


```js
device.pushErrorScope("out-of-memory");

let buffer = device.createBuffer({
  size: 100\_000\_000\_000, // 100GB; far too big
  usage: GPUBufferUsage.COPY\_SRC | GPUBufferUsage.MAP\_WRITE,
});

device.popErrorScope().then((error) => {
  if (error) {
    // error is a GPUOutOfMemoryError object instance
    buffer = null;
    console.error(`Out of memory, buffer too large. Error: ${error.message}`);
  }
});
```

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

| Specification |
| --- |
| WebGPU # gpuoutofmemoryerror |

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

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

See also
--------

* The WebGPU API
* WebGPU Error Handling best practices
SVGClipPathElement
==================

The **`SVGClipPathElement`** interface provides access to the properties of `<clipPath>` elements, as well as methods to manipulate them.

EventTarget

Node

Element

SVGElement

SVGClipPathElementInstance properties
-------------------

*This interface also inherits properties from its parent, `SVGElement`.*

`SVGClipPathElement.clipPathUnits` Read only 

Returns an `SVGAnimatedEnumeration` corresponding to the `clipPathUnits` attribute of the associated `<clipPath>` element. Takes one of the constants defined in `SVGUnitTypes`.

`SVGClipPathElement.transform` Read only 

Returns an `SVGAnimatedTransformList` corresponding to the `transform` attribute of the associated `<clipPath>` element.

Instance methods
----------------

*This interface doesn't implement any specific methods, but inherits methods from its parent, `SVGElement`.*

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

| Specification |
| --- |
| CSS Masking Module Level 1 # InterfaceSVGClipPathElement |

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

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

See also
--------

* `<clipPath>`
SVGTRefElement
==============

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

The **`SVGTRefElement`** interface corresponds to the `<tref>` elements.

Object-oriented access to the attributes of the `<tref>` element via the SVG DOM is not possible.

Instance properties
-------------------

*This interface has no properties but inherits properties from its parent,* `SVGTextPositioningElement`*.*

Instance methods
----------------

*This interface has no methods but inherits methods from its parent,* `SVGTextPositioningElement`*.*

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

| Specification |
| --- |
| Scalable Vector Graphics (SVG) 1.1 (Second Edition) # InterfaceSVGTRefElement |

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

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

See also
--------

* `<tref>`
HTMLEmbedElement
================

The **`HTMLEmbedElement`** interface provides special properties (beyond the regular `HTMLElement` interface it also has available to it by inheritance) for manipulating `<embed>` elements.

**Note:** This topic describes the `HTMLEmbedElement` interface as defined in the standard. It does not address earlier, non-standardized version of the interface.

EventTarget

Node

Element

HTMLElement

HTMLEmbedElementInstance properties
-------------------

*Inherits properties from its parent, `HTMLElement`.*

`HTMLEmbedElement.align` 
Deprecated

A string representing an enumerated property indicating alignment of the element's contents with respect to the surrounding context. The possible values are `"left"`, `"right"`, `"center"`, and `"justify"`.

`HTMLEmbedElement.height`

A string reflecting the `height` HTML attribute, containing the displayed height of the resource.

`HTMLEmbedElement.name` 
Deprecated

A string representing the name of the embedded object.

`HTMLEmbedElement.src`

A string that reflects the `src` HTML attribute, containing the address of the resource.

`HTMLEmbedElement.type`

A string that reflects the `type` HTML attribute, containing the type of the resource.

`HTMLEmbedElement.width`

A string that reflects the `width` HTML attribute, containing the displayed width of the resource.

Instance methods
----------------

*No specific method; inherits methods from its parent, `HTMLElement`.*

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

| Specification |
| --- |
| HTML Standard # htmlembedelement |

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

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

See also
--------

* The HTML element implementing this interface: `<embed>`
queueMicrotask() global function
================================

**Note:** This feature is available in Web Workers

 The **`queueMicrotask()`** method,
 which is exposed on the `Window` or `Worker` interface,
 queues a microtask to be executed at a safe time prior to control returning to the
 browser's event loop.

 The microtask is a short function which will run after
 the current task has completed its work and when there is no other code waiting to be
 run before control of the execution context is returned to the browser's event loop.

 This lets your code run without interfering with any other, potentially higher
 priority, code that is pending, but before the browser regains control over the
 execution context, potentially depending on work you need to complete. You can learn
 more about how to use microtasks and why you might choose to do so in our microtask guide.

 The importance of microtasks comes in its ability to perform tasks asynchronously but
 in a specific order. See Using microtasks in JavaScript with queueMicrotask() for more details.

 Microtasks are especially useful for libraries and frameworks that need to perform
 final cleanup or other just-before-rendering tasks.

Syntax
------


```js
queueMicrotask(() => {/\* ... \*/})
```

### Parameters

`function`

 A `function` to be executed when the browser engine determines it is
 safe to call your code. Enqueued microtasks are executed after all pending tasks have
 completed but before yielding control to the browser's event loop.


### Return value

None (`undefined`).

Examples
--------


```js
queueMicrotask(() => {
  // function contents here
});
```


Taken from the queueMicrotask spec:


```js
MyElement.prototype.loadData = function (url) {
  if (this._cache[url]) {
    queueMicrotask(() => {
      this.\_setData(this._cache[url]);
      this.dispatchEvent(new Event("load"));
    });
  } else {
    fetch(url)
      .then((res) => res.arrayBuffer())
      .then((data) => {
        this._cache[url] = data;
        this.\_setData(data);
        this.dispatchEvent(new Event("load"));
      });
  }
};
```

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

| Specification |
| --- |
| HTML Standard # microtask-queuing |

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

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

See also
--------

* Polyfill of `queueMicrotask()` in `core-js`
* Using microtasks in JavaScript with queueMicrotask()
* Asynchronous JavaScript
* queueMicrotask explainer
* Tasks, microtasks, queues and schedules by Jake Archibald
TextUpdateEvent
===============

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

The **`TextUpdateEvent`** interface is a `DOM event` that represents a text or selection update in an editable text region that's attached to an `EditContext` instance.

This interface inherits properties from `Event`.

Event

TextUpdateEventConstructor
-----------

`TextUpdateEvent()` 
Experimental

Creates a new `TextUpdateEvent` object.

Instance properties
-------------------

`TextUpdateEvent.updateRangeStart` Read only  
Experimental

Returns the index of the first character in the range of text that was updated.

`TextUpdateEvent.updateRangeEnd` Read only  
Experimental

Returns the index of the last character in the range of text that was updated.

`TextUpdateEvent.text` Read only  
Experimental

Returns the text that was inserted in the updated range.

`TextUpdateEvent.selectionStart` Read only  
Experimental

Returns the index of the first character in the new selection range, after the update.

`TextUpdateEvent.selectionEnd` Read only  
Experimental

Returns the index of the last character in the new selection range, after the update.

Examples
--------

### Rendering the updated text in an editable canvas

In the following example, the EditContext API is used to render editable text in a `<canvas>` element, and the `textupdate` event is used to render the text when the user is typing.


```html
<canvas id="editor-canvas"></canvas>
```



```js
const canvas = document.getElementById("editor-canvas");
const ctx = canvas.getContext("2d");
const editContext = new EditContext();
canvas.editContext = editContext;

function render() {
  // Clear the canvas.
  ctx.clearRect(0, 0, canvas.width, canvas.height);

  // Render the text.
  ctx.fillText(editContext.text, 10, 10);
}

editContext.addEventListener("textupdate", (e) => {
  // Re-render the editor view when the user is entering text.
  render();

  console.log(
    `The user entered ${e.text}. Rendering the entire text: ${editContext.text}`,
  );
});
```

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

| Specification |
| --- |
| EditContext API # dom-textupdateevent |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
EXT\_color\_buffer\_float extension
===================================

The **`EXT_color_buffer_float`** extension is part of WebGL and adds the ability to render a variety of floating point formats.

WebGL extensions are available using the `WebGLRenderingContext.getExtension()` method. For more information, see also Using Extensions in the WebGL tutorial.

**Note:** This extension is available to WebGL 2 contexts only.

For WebGL 1, see the `EXT_color_buffer_half_float` and `WEBGL_color_buffer_float` extensions.

Extended methods
----------------

The following sized formats become **color-renderable**:

* `gl.R16F`,
* `gl.RG16F`,
* `gl.RGBA16F`,
* `gl.R32F`,
* `gl.RG32F`,
* `gl.RGBA32F`,
* `gl.R11F_G11F_B10F`.

**Color-renderable** means:

* The `WebGLRenderingContext.renderbufferStorage()` method now accepts these formats.
* Framebuffers with attached textures of these formats may now be **FRAMEBUFFER\_COMPLETE**.
Examples
--------

`gl` must be a `WebGL2RenderingContext`. This extension does not work in WebGL 1 contexts.


```js
const ext = gl.getExtension("EXT\_color\_buffer\_float");

gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA16F, 256, 256);
```

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

| Specification |
| --- |
| WebGL EXT\_color\_buffer\_float Extension Specification  |

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

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

See also
--------

* `WebGLRenderingContext.getExtension()`
* `WebGLRenderingContext.renderbufferStorage()`
* `EXT_color_buffer_half_float`
* `WEBGL_color_buffer_float`
XRWebGLSubImage
===============

**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 **`XRWebGLSubImage`** interface is used during rendering of WebGL layers.

XRSubImage

XRWebGLSubImageInstance properties
-------------------

*Inherits properties from its parent, `XRSubImage`.*

`XRWebGLSubImage.colorTexture` Read only  
Experimental

A color `WebGLTexture` object for the `XRCompositionLayer` to render.

`XRWebGLSubImage.depthStencilTexture` Read only  
Experimental

A depth/stencil `WebGLTexture` object for the `XRCompositionLayer` to render.

`XRWebGLSubImage.imageIndex` Read only  
Experimental

A number representing the offset into the texture array if the layer was requested with `texture-array`; `null` otherwise.

`XRWebGLSubImage.colorTextureWidth` Read only  
Experimental

A number representing the width in pixels of the GL attachment.

`XRWebGLSubImage.colorTextureHeight` Read only  
Experimental

A number representing the height in pixels of the GL attachment.

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

| Specification |
| --- |
| WebXR Layers API Level 1 # xrwebglsubimagetype |

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

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

See also
--------

* `XRLayer`
* `XRWebGLBinding.getSubImage()`
* `XRWebGLBinding.getViewSubImage()`
SVGAnimateColorElement
======================

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

The **`SVGAnimateColorElement`** interface corresponds to the `<animateColor>` element.

Instance properties
-------------------

*This interface has no properties but inherits properties from its parent, `SVGAnimationElement`.*

Instance methods
----------------

*This interface has no methods but inherits methods from its parent, `SVGAnimationElement`.*

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

| Specification |
| --- |
| Scalable Vector Graphics (SVG) 1.1 (Second Edition) # InterfaceSVGAnimateColorElement |

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

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

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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`AudioEncoder`** interface of the WebCodecs API encodes `AudioData` objects.

EventTarget

AudioEncoderConstructor
-----------

`AudioEncoder()` 
Experimental

Creates a new `AudioEncoder` object.

Instance properties
-------------------

*Inherits properties from its parent, `EventTarget`.*

`AudioEncoder.encodeQueueSize` Read only  
Experimental

An integer representing the number of encode queue requests.

`AudioEncoder.state` Read only  
Experimental

Represents the state of the underlying codec and whether it is configured for encoding.

### Events

`dequeue` 
Experimental

Fires to signal a decrease in `AudioEncoder.encodeQueueSize`.

Static methods
--------------

`AudioEncoder.isConfigSupported()` 
Experimental

Returns a promise indicating whether the provided `AudioEncoderConfig` is supported.

Instance methods
----------------

*Inherits methods from its parent, `EventTarget`.*

`AudioEncoder.configure()` 
Experimental

Enqueues a control message to configure the audio encoder for encoding chunks.

`AudioEncoder.encode()` 
Experimental

Enqueues a control message to encode a given `AudioData` objects.

`AudioEncoder.flush()` 
Experimental

Returns a promise that resolves once all pending messages in the queue have been completed.

`AudioEncoder.reset()` 
Experimental

Resets all states including configuration, control messages in the control message queue, and all pending callbacks.

`AudioEncoder.close()` 
Experimental

Ends all pending work and releases system resources.

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

| Specification |
| --- |
| WebCodecs # audioencoder-interface |

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

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