Events Flashcards

1
Q

What is the difference between event bubbling and event capturing?

A

Direction of the event

1) Event capturing phase: from root(document) to the ellement
2) Event Bubbling Phase: Target to Root

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

Why don’t event listeners get called twice (up and down the stack)? One in the Event capturing phase, and Event Bubbling Phase

A

You can choice which phase it listens too. Defaults to event Bubbling Phase

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

Which event listening phase is default

A

Bubbling Phase

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

What is the difference between stopPropagation() and preventDefault() ?

A

stopPropagation stops the event from ether proceeding

down the event capturing phase or going up the Event Bubbling Phase

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

What is the difference between stopPropagation() and preventDefault() ?

A

stopPropagation stops the event from ether proceeding
down the event capturing phase or going up the Event Bubbling Phase. STOPS

PreventDefault: doesn’t stop event. But stops action
Not check in Checkbox

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

Are event listeners async?

A

No they wait for the event in front of them to execute

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

Does event capturing happen first or is it event bubbling?

A

Event capturing First

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

Events:
Does this code add an event listener to the event capturing phase or the bubbling phase?

    (function () {
     var y = i;
     items[y].addEventListener("click",
     function (event) {
      console.log(items[y]
     event);
     }
     true);
    })();
A

Event capturing phase

The Default is false

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

Events:
Does the below code add an event listener on the event capturing phase or the event bubbling phase?

    (function () {
     var y = i;
     items[y].addEventListener("click",
     function (event) {
      console.log(items[y]
     event);
     });
    })();
A

Event Bubbling Phase

Default

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

Calling the prevent default function in an event listener stops the next event listener from being called?

A

False

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

If we clicked a checkbox, calling preventDefault() from one of the event listeners would stop the checkbox from having the tick applied to it.

A

True

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