Node.firstChild — the first child node
Node.firstChild is a read-only property that returns the first direct child node or null. It includes text and comments, so the returned node is not necessarily an element.
CKTIS / JavaScript
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Node.firstChild is a read-only property that returns the first direct child node or null. It includes text and comments, so the returned node is not necessarily an element.
Node.insertBefore inserts or moves a node before a specified child. Passing null inserts it at the end.
NodeList is an indexed, iterable collection of DOM nodes. It can be live or static, depending on the API that returns it.
NodeList.forEach calls a function for successive nodes in a DOM collection, passing the node, index, and collection.
NodeList.length is a read-only property reporting the number of nodes in a collection, not necessarily just elements.
Node.parentElement returns the immediate parent of type Element, or null. Unlike parentNode, it never returns a Document or DocumentFragment.
The parent.removeChild(child) method detaches a direct child from its parent and returns the same node, which can be inserted again.
Node.replaceChild replaces a parent's direct child and returns the removed node. The replacement node is the first argument.
Node.textContent reads a node’s text or replaces its textual content without parsing HTML.
OscillatorNode generates a mono periodic waveform. Configure its shape and frequency, connect its output, and schedule its start and stop.
PageTransitionEvent carries information for pageshow and pagehide events. Its persisted property distinguishes document restoration from ordinary loading and indicates whether the browser intends to preserve the document for possible reuse.
performance.clearMarks() removes User Timing marks from the performance entry buffer. Supplying a name removes every matching mark; calling it without an argument removes all marks, but not measures.
performance.clearMeasures() removes stored User Timing measures from the performance entry buffer. You can remove all measures or every entry with one name without deleting timing marks.
PerformanceEntry.duration is a read-only property reporting a performance entry's duration in milliseconds. Its meaning depends on entryType; a value of 0 can mean that duration does not apply, rather than that an operation completed instantly.
Performance.getEntriesByName retrieves current performance timeline entries with a specified name and optional type. It returns an array rather than a single entry and does not track future events.
performance.mark records a named timestamp on the performance timeline. It represents a point, not an interval; options let you set its time and attach metadata.
performance.measure records a named interval on the performance timeline. It can use marks or explicit timestamps; the modern overload returns a PerformanceMeasure containing the interval's start and duration in milliseconds.
performance.now() returns a timestamp in milliseconds relative to the environment's time origin. Subtracting two readings measures elapsed time without being affected by system-clock adjustments.
PointerEvent unifies mouse, touch, and pen input. Learn how pointer identifiers, viewport coordinates, interaction lifecycles, and pointer capture work together when implementing dragging.
PopStateEvent.state reads the state associated with the history entry activated during a popstate event. Learn what null means and why saving state is different from navigating through history.
PromiseRejectionEvent.reason exposes the rejection reason in unhandledrejection and rejectionhandled events. The property is read-only, but its value can be any JavaScript value, not just an Error object.
queueMicrotask(callback) schedules a short function in the microtask queue. It runs after the current synchronous code finishes, without scheduling a separate timer task or yielding time to the browser for rendering.
Range describes a DOM fragment between two boundaries. It supports extracting, deleting, and inserting content, while its boundaries automatically respond to tree changes.
ReadableStream provides chunked data consumption. A reader retrieves chunks asynchronously without requiring the entire input to be collected first.