DOM 3 Flashcards

1
Q

What is the event.target?

A

point of interaction. actual element where the event was fired.

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

Why is it possible to listen for events on one element that actually happen its descendent elements?

A

because of event bubbling.

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

What DOM element property tells you what type of element it is?

A

tagName

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

What does the element.closest() method take as its argument and what does it return?

A

takes the child element as the argument and returns the Element which is the closest ancestor of the selected element

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

If you wanted to insert new clickable DOM elements into the page using JavaScript, how could you avoid adding an event listener to every new element individually?

A

add eventlistener to the parent.

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

What is the event.target?

A

point of interaction. actual element where the event was fired.

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

What is the affect of setting an element to display: none?

A

element hides.

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

What is the affect of setting an element to display: none?

A

removes from document flow and hides it.

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

How can you retrieve the value of an element’s attribute?

A

Element.getAttribute()

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

At what steps of the solution would it be helpful to log things to the console?

A

every step

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

If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?

A

I would have to write out event listener for all tabs.

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

If you were to add another tab and view to your HTML, but you didn’t use event delegation, how would your JavaScript code be written instead?

A

I would have to add eventlistener for all tabs. (all descendants of the tabs-container)

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

If you didn’t use a loop to conditionally show or hide the views in the page, how would your JavaScript code be written instead?

A

We would need to write a lot of conditionals (if else statements checking for equality on value)

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