dom-querying Flashcards
Which “document” is being referred to in the phrase Document Object Model?
The HTML document
What is the word “object” referring to in the phrase Document Object Model?
Javascript object
What is a DOM Tree?
A model of the document
Give two examples ofdocumentmethods that retrieve a single element from the DOM.
getElementByID()
querySelector()
Give one example of adocumentmethod that retrieves multiple elements from the DOM at once.
querySelectorAll()
getElementsByTagName()
Why might you want to assign the return value of a DOM query to a variable?
So that we can use the same element more than once.
Whatconsolemethod allows you to inspect the properties of a DOM element object?
console.dir()
Why would atag need to be placed at the bottom of the HTML content instead of at the top?
The browser needs to parse all of the elements in the HTML page before the JavaScript code can access them
What doesdocument.querySelector()take as its argument and what does it return?
Uses a CSS selector, and returns the first matching element.
What doesdocument.querySelectorAll()take as its argument and what does it return?
Uses a CSS selector to select all matching elements (returns a node list)