DOM Flashcards
Why do we log things to the console?
to check the output of your coding to see if it is working correctly
What is a “model”?
copy of the structure of an html document.
Which “document” is being referred to in the phrase Document Object Model?
the html page.
What is the word “object” referring to in the phrase Document Object Model?
javascript object.
What is a DOM Tree?
Data representation of all elements and its child elements.
Give two examples ofdocumentmethods that retrieve a single element from the DOM.
getelementbyid and query selector.
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?
so that you can easily access that DOM variable. Reuse it.
What console method allows you to inspect the properties of a DOM element object?
console.dir
Why would the script tag need to be placed at the bottom of the HTML content instead of at the top?
so that body contents of html can load first.
What does queryselector take as its argument and what does it return?
string of css selector, first of the matching elements.
What does queryselectorall take as its argument and what does it return?
string of css selector, returns all of the elements that match.
What is the purpose of events and event handling?
events occur based on user interaction. Event handling are steps that lead to the trigger.
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?
add event listener