DOM Flashcards
Why do we log things to the console?
In order to check and debug our work
What is a “model”?
DOM is a representation (a separate entity)
Which “document” is being referred to in the phrase Document Object Model?
DOCTYPE Html
What is the word “object” referring to in the phrase Document Object Model?
Data type (or type of Data)
What is a DOM Tree?
Is a JS object for html element including its elements, attributes, values, children, and its children.
Give two examples of document methods that retrieve a single element from the DOM.
getElementByID
querySelector
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?
Easier to retrieve data, which makes it easy to retrieve
What console method allows you to inspect the properties of a DOM element object?
console.dir
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
Html loads from top to bottom
Needs to parse all the elements before
What does document.querySelector() take as its argument and what does it return?
Returns only the first of the matching elements (selectors for css)
What does document.querySelectorAll() take as its argument and what does it return?
Returns all of that matches the called element (selector for css)
What is the purpose of events and event handling?
To create a reaction from the user upon action
Are all possible parameters required to use a JavaScript method or function?
Not always necessary
What method of element objects lets you set up a function to be called when a specific type of event occurs?
addEventListener