Dom Querying Flashcards

1
Q

Why do we log things to the console?

A

to debug and test our code

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

Why do we log things to the console?

A

to debug and test our code

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

What is a “model”?

A

A recreation (or model) of something

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

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

A

the html page

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

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

A

objects within the Dom tree- representing a different part of the html page

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

What is a DOM Tree?

A

A model of the html page

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

Give two examples of document methods that retrieve a single element from the DOM.

A

getElementByld()

querySelector()

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

Give one example of a document method that retrieves multiple elements from the DOM at once.

A

getElementsByClassName()

querySelectorAll()

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

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

A

so it holds it’s reference place

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

What console method 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
11
Q

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

A

so the JS loads after the html

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

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

A

returns the first element node that matches the CSS-style selector.

Both methods take a CSS selector as their only parameter.

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

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

A

returns a Nodelist of all of the matches.

Both methods take a CSS selector as their only parameter.

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

What is a “model”?

A

A recreation (or model) of something

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

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

A

the html page

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

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

A

objects within the Dom tree- representing a different part of the html page

17
Q

What is a DOM Tree?

A

A model of the html page

18
Q

Give two examples of document methods that retrieve a single element from the DOM.

A

getElementByld()

querySelector()

19
Q

Give one example of a document method that retrieves multiple elements from the DOM at once.

A

getElementsByClassName()

querySelectorAll()

20
Q

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

A

so it holds it’s reference place

21
Q

What console method allows you to inspect the properties of a DOM element object?

A

console.dir()

22
Q

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

A

so the JS loads after the html

23
Q

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

A

returns the first element node that matches the CSS-style selector.

Both methods take a CSS selector as their only parameter.

24
Q

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

A

returns a Nodelist of all of the matches.

Both methods take a CSS selector as their only parameter.