recursal/MDN huggingface dataset:
TransitionEvent: TransitionEvent() constructor
==============================================

The **`TransitionEvent()`** constructor returns a new `TransitionEvent` object, representing an event in relation with a transition.

Syntax
------


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

### Parameters

`type`

 A string with the name of the event.
 It is case-sensitive and browsers set it to `transitionrun`, `transitionstart`, `transitionend`, or `transitioncancel`.


`options` Optional

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

`propertyName` Optional

 A string containing the name of the CSS property associated with the transition.
 It defaults to `""`.


`elapsedTime` Optional

 A number giving the amount of time the animation has been running,
 in seconds, when this event fired, excluding any time the animation was paused.
 For an `"animationstart"` event, `elapsedTime` is `0.0` unless there was a negative value for `animation-delay`,
 in which case the event will be fired with `elapsedTime` containing `(-1 * delay)`.
 It defaults to `0.0`.


`pseudoElement` Optional

 A string, defaulting with `"::"`, containing the name of the pseudo-element the animation runs on.
 If the animation doesn't run on a pseudo-element but on the element, an empty string: `""`.
 It defaults to `""`.



### Return value

A new `TransitionEvent` object.

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

| Specification |
| --- |
| CSS Transitions # dom-transitionevent-transitionevent |

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

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

See also
--------

* Using CSS transitions
* CSS properties: `transition`, `transition-delay`,
 `transition-duration`, `transition-property`,
 `transition-timing-function`.
TransitionEvent: propertyName property
======================================

The **`propertyName`** read-only property of `TransitionEvent` objects is a string containing the name of the CSS property associated with the transition.

Value
-----

A string.

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

| Specification |
| --- |
| CSS Transitions # Events-TransitionEvent-propertyName |

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

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

See also
--------

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

The **`abort()`** method of the `BackgroundFetchRegistration` interface aborts an active background fetch.

Syntax
------


```js
abort()
```

### Parameters

None.

### Return value

A `Promise` that resolves with `true` if the fetch is successfully aborted.

Examples
--------

Use `abort()` to terminate a background fetch that is in progress.


```js
bgFetch.abort();
```

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

| Specification |
| --- |
| Background Fetch # background-fetch-registration-abort |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: downloaded 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`downloaded`** read-only property of the `BackgroundFetchRegistration` interface returns the size in bytes that has been downloaded, initially `0`.

If the value of this property changes, the progress event is fired at the associated `BackgroundFetchRegistration` object.

Value
-----

A `number`.

Examples
--------

Logging this property to the console returns the number of bytes downloaded.


```js
console.log(bgFetch.downloaded);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-downloaded |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: downloadTotal 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`downloadTotal`** read-only property of the `BackgroundFetchRegistration` interface returns the total size in bytes of this download. This is set when the background fetch was registered, or `0` if not set.

Value
-----

A `number`.

Examples
--------

Logging this property to the console returns the total size in bytes of this download.


```js
console.log(bgFetch.downloadTotal);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-downloadtotal |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: uploadTotal 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`uploadTotal`** read-only property of the `BackgroundFetchRegistration` interface returns the total number of bytes to be sent to the server.

Value
-----

A `number`.

Examples
--------

Logging `BackgroundFetchRegistration.uploadTotal` to the console returns the uploadTotal.


```js
console.log(bgFetch.uploadTotal);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-uploadtotal |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: match() 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`match()`** method of the `BackgroundFetchRegistration` interface returns the first matching `BackgroundFetchRecord`.

Syntax
------


```js
match(request)
match(request, options)
```

### Parameters

`request`

 The `Request` for which you are attempting to find records.
 This can be a `Request` object or a URL.


`options` Optional

 An object that sets options for the `match` operation. The available
 options are:


`ignoreSearch`

 A boolean value that specifies whether to
 ignore the query string in the URL. For example, if set to
 `true` the `?value=bar` part of
 `http://foo.com/?value=bar` would be ignored when performing a match.
 It defaults to `false`.


`ignoreMethod`

 A boolean value. When `true`,
 prevents matching operations from validating the `Request` `http` method.
 If `false` (the default) only `GET` and `HEAD` are allowed.


`ignoreVary`

 A boolean value. When `true` indicates that the `VARY`
 header should be ignored.
 It defaults to `false`.



### Return value

 A `Promise` that resolves with the first `BackgroundFetchRecord` that matches
 the request or `undefined` if no match is found.


**Note:** `BackgroundFetchRegistration.match()` is basically identical to
 `BackgroundFetchRegistration.matchAll()`, except that rather than resolving with an array of
 all matching records, it resolves with the first matching record only.


### Exceptions

`InvalidStateError` `DOMException`

Returned if you call `match()` when there are no fetches in progress. This state will be reflected by `BackgroundFetchRegistration.recordsAvailable` being set to `false`.

Examples
--------

In this example we look for a record with the URL "/ep-5.mp3". If a `BackgroundFetchRecord` is found then we can return some information about it.


```js
bgFetch.match("/ep-5.mp3").then(async (record) => {
  if (!record) {
    console.log("No record found");
    return;
  }

  console.log(`Here's the request`, record.request);
  const response = await record.responseReady;
  console.log(`And here's the response`, response);
});
```

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

| Specification |
| --- |
| Background Fetch # background-fetch-registration-match |

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

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

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 **`progress`** event of the `BackgroundFetchRegistration` interface thrown when the associated background fetch progresses.

Practically, this event is fired when any of the following properties will return a new value:

* `uploaded`,
* `downloaded`,
* `result`, or
* `failureReason`.
Syntax
------

Use the event name in methods like `addEventListener()`, or set the `onprogress` event property on the relevant `BackgroundFetchRegistration` object.


```js
addEventListener("progress", (event) => { })
onprogress = (event) => { }
```

Event type
----------

A generic `Event` with no added properties.

Example
-------

The following example demonstrates how to log the progress of a download. The code first checks that a `downloadTotal` was provided when the background fetch was registered. This is then used to calculate the percentage, based on the `downloaded` property.


```js
bgFetch.addEventListener("progress", () => {
  if (!bgFetch.downloadTotal) return;
  const percent = Math.round(
    (bgFetch.downloaded / bgFetch.downloadTotal) \* 100,
  );
  console.log(`Download progress: ${percent}%`);
});
```

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

| Specification |
| --- |
| Background Fetch # background-fetch-registration-events |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: uploaded 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`uploaded`** read-only property of the `BackgroundFetchRegistration` interface returns the size in bytes successfully sent, initially `0`.

If the value of this property changes, the progress event is fired at the associated `BackgroundFetchRegistration` object.

Value
-----

A `number`.

Examples
--------

Logging this property to the console returns the number of bytes uploaded.


```js
console.log(bgFetch.uploaded);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-uploaded |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: recordsAvailable 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`recordsAvailable`** read-only property of the `BackgroundFetchRegistration` interface returns `true` if there are requests and responses to be accessed. If this returns false then `match()` and `matchAll()` can't be used.

Value
-----

A `boolean`.

Examples
--------

Logging this property to the console returns `true` or `false` to indicate if there are records.


```js
console.log(bgFetch.recordsAvailable);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-recordsavailable |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: id 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`id`** read-only property of the `BackgroundFetchRegistration` interface returns a copy of the background fetch's `ID`.

Value
-----

A string.

Examples
--------

Logging the this part to the console returns the identifier set when registering the fetch. In this case, `"my-fetch"`.


```js
console.log(bgFetch.id); // "my-fetch"
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-id |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: matchAll() 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`matchAll()`** method of the `BackgroundFetchRegistration` interface returns an array of matching `BackgroundFetchRecord` objects.

Syntax
------


```js
matchAll()
matchAll(request)
matchAll(request,options)
```

### Parameters

`request` Optional

 The `Request` for which you are attempting to find records.
 This can be a `Request` object or a URL. If this parameter is omitted, all records are included in the result.


`options` Optional

 An object that sets options for the `match` operation. The available
 options are:


`ignoreSearch`

 A boolean value that specifies whether to
 ignore the query string in the URL. For example, if set to
 `true` the `?value=bar` part of
 `http://foo.com/?value=bar` would be ignored when performing a match.
 It defaults to `false`.


`ignoreMethod`

 A boolean value. When `true`,
 prevents matching operations from validating the `Request` `http` method.
 If `false` (the default) only `GET` and `HEAD` are allowed.


`ignoreVary`

 A boolean value. When `true` indicates that the `VARY`
 header should be ignored.
 It defaults to `false`.



### Return value

A `Promise` that resolves with an array of all matching `BackgroundFetchRecord` objects.

### Exceptions

`InvalidStateError` `DOMException`

Returned if the `recordsAvailable` flag is `false`, indicating that there is no fetch in progress.

Examples
--------

Use `matchAll()` with no parameters to return all of the records in a background fetch.


```js
const records = await bgFetch.matchAll();
console.log(records); // an array of BackgroundFetchRecord objects
```

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

| Specification |
| --- |
| Background Fetch # background-fetch-registration-match-all |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: result 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`result`** read-only property of the `BackgroundFetchRegistration` interface returns a string indicating whether the background fetch was successful or failed.

If the value of this property changes, the progress event is fired at the associated `BackgroundFetchRegistration` object.

Value
-----

One of the following strings:

`""`

The fetch is active so there is no result.

`"success"`

The background fetch was successful.

`"failure"`

The background fetch failed. This only appears when there is no ability for the browser to retry.

Examples
--------

Logging this property to the console returns a string indicating the status, or an empty string if the fetch is still active.


```js
console.log(bgFetch.result);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-result |

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

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
BackgroundFetchRegistration: failureReason 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
**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The **`failureReason`** read-only property of the `BackgroundFetchRegistration` interface returns a string with a value that indicates a reason for a background fetch failure.

If the value of this property changes, the progress event is fired at the associated `BackgroundFetchRegistration` object.

Value
-----

One of the following strings:

`""`

The background fetch has not completed, or was successful.

`"aborted"`

The operation was cancelled by the user, or `abort()` was called.

`"bad-status"`

A response had a not-ok status (a status outside the range 200-299).

`"fetch-error"`

A fetch failed for other reasons, for example CORS, or a network failure.

`"quota-exceeded"`

Storage quota was reached during the operation.

`"download-total-exceeded"`

The provided `downloadTotal` was exceeded. This value was set when the background fetch was registered.

Examples
--------

Logging this property to the console prints the reason the fetch failed, or an empty string if it was successful or has not yet completed.


```js
console.log(bgFetch.failureReason);
```

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

| Specification |
| --- |
| Background Fetch # dom-backgroundfetchregistration-failurereason |

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

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

 The **`createTHead()`** method of
 `HTMLTableElement` objects returns the `<thead>` element
 associated with a given `<table>`. If no header exists in the table, this
 method creates it, and then returns it.


**Note:** If no header exists, `createTHead()` inserts a new
 header directly into the table. The header does not need to be added separately as
 would be the case if `Document.createElement()` had been used to create
 the new `<thead>` element.


Syntax
------


```js
createTHead()
```

### Parameters

None.

### Return value

`HTMLTableSectionElement`Examples
--------


```js
let myhead = mytable.createTHead();
// Now this should be true: myhead === mytable.tHead
```

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

| Specification |
| --- |
| HTML Standard # dom-table-createthead-dev |

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

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

 The **`HTMLTableElement.insertRow()`** method inserts a new row
 (`<tr>`) in a given `<table>`, and returns a reference to
 the new row.

 If a table has multiple `<tbody>` elements, by default, the new row is
 inserted into the last `<tbody>`. To insert the row into a specific
 `<tbody>`:


```js
let specific_tbody = document.getElementById(tbody_id);
let row = specific_tbody.insertRow(index);
```


**Note:** `insertRow()` inserts the row directly into the
 table. The row does not need to be appended separately as would be the case if
 `Document.createElement()` had been used to create the new
 `<tr>` element.


Syntax
------


```js
insertRow()
insertRow(index)
```


`HTMLTableElement` is a reference to an HTML `<table>`
 element.

### Parameters

`index` Optional

 The row index of the new row. If `index` is `-1` or equal to
 the number of rows, the row is appended as the last row.
 If `index` is omitted it defaults to `-1`.


### Return value

 An `HTMLTableRowElement` that references the new
 row.

### Exceptions

`IndexSizeError` `DOMException`

Thrown if `index` is greater than the number of rows.

Examples
--------

This example uses `insertRow(-1)` to append a new row to a table.

 We then use `HTMLTableRowElement.insertCell()` to insert a new cell in the
 new row. (To be valid HTML, a `<tr>` must have at least one
 `<td>` element.) Finally, we add some text to the cell using
 `Document.createTextNode()` and `Node.appendChild()`.

### HTML


```html
<table id="my-table">
  <tr>
    <td>Row 1</td>
  </tr>
  <tr>
    <td>Row 2</td>
  </tr>
  <tr>
    <td>Row 3</td>
  </tr>
</table>
```

### JavaScript


```js
function addRow(tableID) {
  // Get a reference to the table
  let tableRef = document.getElementById(tableID);

  // Insert a row at the end of the table
  let newRow = tableRef.insertRow(-1);

  // Insert a cell in the row at index 0
  let newCell = newRow.insertCell(0);

  // Append a text node to the cell
  let newText = document.createTextNode("New bottom row");
  newCell.appendChild(newText);
}

// Call addRow() with the table's ID
addRow("my-table");
```

### Result

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

| Specification |
| --- |
| HTML Standard # dom-table-insertrow-dev |

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

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

See also
--------

* `HTMLTableRowElement.insertCell()`
* The HTML element representing rows: `HTMLTableRowElement`