DOM Flashcards
only use?
querySelector(‘xxx’)
querySelectorAll(‘xxx’)
callback
share the value of one function with another
event handler
the function write for event (no return in here because only event will get the value, you will never call it by yourself)
What is a DOM Tree?
Which “document” is being referred to in the phrase Document Object Model?
html document
Give two examples of document methods that retrieve a single element from the DOM.
querySelector
querySelectorAll
Give one example of a document method that retrieves multiple elements from the DOM at once.
querySelectorAll
Why might you want to assign the return value of a DOM query to a variable?
easy to reuse
What console method allows you to inspect the properties of a DOM element object?
console.log
console.dir
Why would a
tag need to be placed at the bottom of the HTML content instead of at the top?
What does document.querySelector() take as its argument and what does it return?
element in dom
What does document.querySelectorAll() take as its argument and what does it return?
all () element in dom
What is the purpose of events and event handling?
for moniter user interaction, when fired, run function
Are all possible parameters required to use a JavaScript method or function?
no
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener()
What is a callback function?
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
What object is passed into an event listener callback when the event fires?