What does the DOM represent?
The Document Object Model (DOM) represents a web document as a tree of nodes that JavaScript can inspect and update.
Study 6 The DOM and Browser Events with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does the DOM represent?
The Document Object Model (DOM) represents a web document as a tree of nodes that JavaScript can inspect and update.
How do `querySelector()` and `querySelectorAll()` differ?
`document.querySelector()` returns the first matching element; `document.querySelectorAll()` returns a static collection of all matches.
What does a DOM query return when no element matches?
A query that finds no matching element returns `null`. Check the result before trying to use it.
What happens when you set an element’s `textContent`?
Setting an element’s `textContent` changes its text and replaces its child content with text.
Why prefer `textContent` for user-supplied text?
Prefer `textContent`: it treats the supplied value as text rather than parsing it as HTML markup.
How can JavaScript change an element’s CSS classes?
Use `classList.add()`, `classList.remove()`, or `classList.toggle()` to change an element’s CSS classes.
How can JavaScript add a new element to the page?
Create a node with `document.createElement()` and insert it into the page with a method such as `append()`.
How does JavaScript register a response to an event?
An event represents something that occurs, such as a click or key press. Register a listener with `addEventListener(type, callback)` to respond to it.
What is the difference between `target` and `currentTarget`?
`target` is where the event originated; `currentTarget` is the object whose listener is currently running.
What are the main phases of event propagation?
An event travels toward its target during capturing, runs target listeners at the target, then travels back through ancestors when it bubbles.
What is event delegation?
Event delegation uses a listener on a parent to handle events from descendants, often by relying on event bubbling.
What does `event.preventDefault()` do?
`event.preventDefault()` cancels a cancelable event’s default browser action, such as a form’s normal submission. It does not stop propagation.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A focused review of propositional logic, quantifiers, sets, relations, functions, and foundational proof methods in discrete mathematics for computer science.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.