JavaScriptRead and update a form control’s value independently of whether the user can interact with it. Distinguish an element’s own `disabled` attribute from its effective disabled state and see which values make it into form data.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScript`max` reflects the upper limit as a string, while `disabled` reflects whether the input has its own disabling attribute. Exceeding the limit does not disable the input.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptRead pause and mute states separately, set a playback position in seconds, and distinguish a known duration from `NaN` and `Infinity`.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptDistinguish a media element’s current state from its events and from the result of calling `play()`. Tell a pause, natural completion, and a media resource failure apart.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptUse nine audio and video events to keep playback position, duration, and controls in sync and to detect a resource reset, playback completion, or a media failure.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptRead or set the value of one HTML option. A missing `value` attribute makes the property fall back to the option’s text, but an explicitly empty value stays empty.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScript`max` sets the total amount of work and `value` sets the amount done. A missing `value` attribute means indeterminate progress, not 0% complete.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScript`template.content` exposes a template’s inert contents as a `DocumentFragment`. To reuse the template, copy its subtree into the destination document and insert the copy.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptReading `HTMLTextAreaElement.value` returns text with LF line endings, even if the string assigned to it contained CRLF pairs or lone CR characters.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptWhen generating HTML, escape plain text for the position where it will be inserted. When writing directly to an ordinary DOM element, use `textContent` with the original string instead.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptEscape characters to display input as literal text. To preserve selected formatting, sanitize the parsed HTML structure using an explicit policy for elements and attributes.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptRead the current IndexedDB record from a cursor, then request the next record or use a key to skip ahead in the cursor’s direction.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptUse `createObjectStore()` to change the schema during a database upgrade, and `transaction()` to read or write records in existing object stores.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptUse `add()`, `getAll()`, `delete()`, and `put()` to work with records by primary key, and distinguish a successful request from a committed transaction.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptCreate a secondary index during a database upgrade, insert without overwriting, and look up a record by its index key rather than its primary key.
Advanced · Current web platform; runtime support variesJavaScriptCreate a secondary index, insert records without overwriting them, and query by either primary key or index key.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptChange an IndexedDB schema in `onupgradeneeded`, get the upgrade transaction from `request.transaction`, and wait for `success` before using the new schema.
Advanced · Current web platform; runtime support variesJavaScriptTell when an IndexedDB open request needs a schema upgrade, is waiting for a connection to close, has succeeded, or has failed.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptLearn when to read `result` and `error` in IndexedDB and how to tell an individual request's success from a transaction commit.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptRead `result` after an IndexedDB request succeeds and `error` after it fails. A successful request does not mean that its transaction has committed.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptUse `complete` and `abort` to determine the outcome of a whole IndexedDB transaction, and `error` to diagnose a failed individual request.
Intermediate · ECMAScript 2024 and the current web platform; runtime support variesJavaScript`didTimeout` tells you why an idle callback ran; `timeRemaining()` estimates how many milliseconds are left in the current idle period.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptAn IIFE creates and calls a function in one expression. Grouping parentheses do not call the function; the argument list that follows them does.
Advanced · ECMAScript 2024 and the current web platform; runtime support variesJavaScriptHandle image loading success and failure on the image element itself. Register both handlers before setting `src`, and do not treat `complete` as proof of success.
Advanced · ECMAScript 2024 and the current web platform; runtime support varies