DOM traversal and manipulation, events and bubbling, fetch, Web Storage, IntersectionObserver, service workers and the History API.
43 cards · basic cards · AI-written, checked twice. Edit anything.
- What does querySelector() return?
Show answer
The first element matching the CSS selector, or null if no match exists.
- What is the difference between querySelector and querySelectorAll?
Show answer
querySelector returns one element, querySelectorAll returns a NodeList of all matching elements.
- What does parentElement return?
Show answer
The parent node that is an Element, skipping any text or comment nodes.
- What is the difference between children and childNodes?
Show answer
children returns only Element nodes, childNodes returns all node types including text and comment nodes.
- What is the difference between nextSibling and nextElementSibling?
Show answer
nextSibling returns the next node of any type, nextElementSibling returns only the next Element node.
- What does the closest() method do?
Show answer
Searches the element and its ancestors for the first element matching a CSS selector.
- What does textContent return?
Show answer
The text content of an element and all its descendants, excluding any HTML markup.
- What is the difference between textContent and innerText?
Show answer
innerText considers CSS visibility and returns only visible text, textContent ignores visibility.
- What does innerHTML do?
Show answer
Sets or gets the HTML markup content of an element, including tags.
- What does appendChild do?
Show answer
Adds a node as the last child of a parent element.
- What does removeChild do?
Show answer
Removes a specified child node from the DOM.
- What does insertBefore do?
Show answer
Inserts a node before a specified child node as a sibling.
- What does replaceChild do?
Show answer
Replaces an existing child node with a new node.
- What does cloneNode do?
Show answer
Creates a copy of a node, with an optional boolean to include all child nodes.
- What does setAttribute do?
Show answer
Sets the value of an attribute on an element.