dom-querying Flashcards

1
Q

Which “document” is being referred to in the phrase Document Object Model?

A

The HTML document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the word “object” referring to in the phrase Document Object Model?

A

Javascript object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a DOM Tree?

A

A model of the document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Give two examples ofdocumentmethods that retrieve a single element from the DOM.

A

getElementByID()

querySelector()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give one example of adocumentmethod that retrieves multiple elements from the DOM at once.

A

querySelectorAll()

getElementsByTagName()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why might you want to assign the return value of a DOM query to a variable?

A

So that we can use the same element more than once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Whatconsolemethod allows you to inspect the properties of a DOM element object?

A

console.dir()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why would atag need to be placed at the bottom of the HTML content instead of at the top?

A

The browser needs to parse all of the elements in the HTML page before the JavaScript code can access them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What doesdocument.querySelector()take as its argument and what does it return?

A

Uses a CSS selector, and returns the first matching element.


How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What doesdocument.querySelectorAll()take as its argument and what does it return?

A

Uses a CSS selector to select all matching elements (returns a node list)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly