ValidityState: overall validity and specific failures
Read `element.validity` to distinguish an overall valid state from a missing required value, a format mismatch, or a user-edited value that is too short.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Read `element.validity` to distinguish an overall valid state from a missing required value, a format mismatch, or a user-edited value that is too short.
Tell a hidden tab from an attempted departure or a back/forward cache restore, so you can save state, warn about unsaved edits, and resume work at the right time.
Pass a keyframe array to `Element.animate()` and use a separate options object to set how long each iteration lasts, how it progresses, and how many times it runs.
Call `weakMap.delete(key)` to remove the entry for a given key. It returns `true` if it removed an entry and `false` if it did not.
`weakMap.get(key)` returns the value stored for a key. Use `has(key)` to tell a missing entry apart from one whose value is `undefined`.
Remove an entry from a `WeakMap` and use the boolean result to tell whether the entry was actually removed.
Use `weakMap.get(key)` to read a stored value without changing the map. Use `has()` to tell a missing entry apart from one whose value is `undefined`.
Learn what `get`, `set`, and `delete` return, which keys a `WeakMap` accepts, and how to tell a missing entry from one whose stored value is `undefined`.
`weakMap.has(key)` checks whether the map contains an entry for that key, even if the stored value is `undefined`.
Check whether a key is present, read its value, or update it. Learn to tell a missing entry from a stored `undefined` and know which keys a `WeakMap` accepts.
Use `set()` to insert an entry into a `WeakMap` or replace the value for an existing key. It returns the same map so you can chain calls.
Use `set()` to store a value under a key in a `WeakMap`. It replaces the value if the key already exists and returns the same map, so you can chain calls.
Use `has()` to check whether a value belongs to a `WeakSet` and `add()` to insert it. Membership is based on identity, and the collection does not keep its members alive.
Use `has()` to check membership, `add()` to insert a value, and `delete()` to remove it. The three methods differ in what they return and how they handle invalid values.
Distinguish wheel input from scrolling, detect when a page resumes from the back/forward cache, and warn users before unsaved changes are lost.
Use JavaScript to test whether the browser supports a specific CSS property–value pair or satisfies a CSS support condition before choosing an enhanced behavior.
Read the number of device pixels per CSS pixel and use a resolution media query to detect when that ratio changes.
Read the browser’s resolved CSS `visibility` value and distinguish it from the declaration stored in an element’s inline style.
Check whether a CSS media query currently matches in JavaScript, and respond only when the match result changes.
Distinguish references to the current and parent windows from a serialized origin, and learn why having a window reference does not grant access to its document.
Use `popstate` to read the state of an activated history entry and `hashchange` to detect a URL fragment change within the same document.
Listen for `resize` on `window` to respond to layout viewport size changes. Use `ResizeObserver` when you need to track the size of an individual element.
Tell apart three dedicated worker events: successful message delivery, a worker error, and a message the receiver cannot deserialize.
Four optional sink callbacks define how a writable stream initializes its destination, writes chunks, finalizes successful output, or cleans up after an abort.