dom-querying Flashcards
Why do we log things to the console?
Remove bugs and check functionality.
What is a “model”?
Representation of something.
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?
The elements of the page.
What is a DOM Tree?
A model of the web page.
Give two examples of document methods that retrieve a single element from the DOM.
getElementById( ) and 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?
To avoid having the browser look for that location again.
What console method allows you to inspect the properties of a DOM element object?
Console.dir( ).
Why would a script tag need to be placed at the bottom of the HTML content instead of at the top?
Because the browser needs to go through all the HTML elements before the JavaScript code can access it.
What does document.querySelectorAll( ) take as its argument and what does it return?
A selector (universal, type, class, id or attribute) and it returns a Node List with all the properties of that selector.