Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue regarding live event

I was just reading http://api.jquery.com/event.stopPropagation/

Since the .live() method handles events once they have propagated to the top of the document, it is not possible to stop propagation of live events

I was a bit confused with this statement, Can someone please explain me the same with some example?

like image 708
Rocky Singh Avatar asked May 16 '11 16:05

Rocky Singh


People also ask

Why does my Teams not have live event?

To have the ability to create live events, you need to have E1, E3 or E5 lisc. If you are an EDU company / partner, then you need to have A3 or A5 lisc. If you think that you are currently holding any of these lisc.

What differentiates a live event and a meeting?

A Live Event has more roles than a meeting. A meeting has a limited number of roles which include Organizer, Presenter and Attendee. Conversely, a Live Event has the following roles: Organizers: Responsible for the scheduling of the event and assign the permission requirements are made.

What is the difference between a meeting and a live event in Teams?

Teams live events is an extension of Teams meetings, enabling users to broadcast video and meeting content to a large online audience. Live events are meant for one-to-many communications where the host of the event is leading the interactions and audience participation is primarily to view the content shared by host.


1 Answers

Live method binds a handler to the document, and identifies which element triggered the event from the event.target property.

So the actual handler is at the top (in terms of hierarchy).

The stopPropagation stops the bubbling from going up the DOM hierarchy, but since the handler is at the top already (in the .live case) there is no upper place to bubble to ..


example attempt ..

- document
  - div
    - link

you bind a click event handler to the link (with the bind or click method).

When you click the link, the handler is triggered, but in addition the click event goes up the DOM until it reaches the document, and will also trigger click handlers bound to the div and document. (unless you use the .stopPropagation)

Alternatively if you use the .live method to bind the event handler, it will be bound to the document. If you now click the link, the event (which will not fire right away, since no handler is bound to it) will naturally go up the DOM (triggering the click handlers it encounters). Once it reaches the document it will trigger our own handler. But there is no upper to go, so the stopPropagation is useless at this point.

like image 90
Gabriele Petrioli Avatar answered Oct 24 '22 23:10

Gabriele Petrioli