dom-querying Flashcards
Why do we log things to the console?
- verify what code is doing
2. debugging
What is a “model”?
-a representation of something
Which “document” is being referred to in the phrase Document Object Model?
-document node
What is the word “object” referring to in the phrase Document Object Model?
-nodes
What is a DOM Tree?
It is a node tree with a single parent stem that branches out into several child branches, each which may have leaves.
Give two examples of document methods that retrieve a single element from the DOM.
- querySelector()
2. getElementById()
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?
When you need to work with an element more than once, you should use a variable to store the result of that query which will save time.
What console method allows you to inspect the properties of a DOM element object?
-dir()
Why would a tag need to be placed at the bottom of the HTML content instead of at the top?
Everything must load first for the script to access.
What does document.querySelector() take as its argument and what does it return?
- selectors
- An Element object representing the first element in the document that matches the specified set of CSS selectors, or null is returned if there are no matches.
What does document.querySelectorAll() take as its argument and what does it return?
- selectors
- A non-live NodeList containing one Element object for each element that matches at least one of the specified selectors or an empty NodeList in case of no matches.