EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.
Ce sujet n'a pas encore été évalué - Évaluez ce sujet

stopPropagation method

Prevents propagation of an event beyond the current target.

Document Object Model (DOM) Level 3 Events Specification, Section 4.1Internet Explorer 9

Syntax

object.stopPropagation()

Parameters

This method has no parameters.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

Remarks

You can stop event propagation in the capturing or bubbling event phase by calling the stopPropagation method. However, the event dispatchs to all event listeners on the current target (regardless of capturing or bubbling) before the event flow stops. To completely prevent any remaining handlers from running, use the stopImmediatePropagation method instead.

The stopPropagation method is similar to the cancelBubble event property of Windows Internet Explorer 8 and earlier versions.

Examples

The following code example demonstrates how to stop an event early by using the stopPropagation method.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/ie9_event_phases.htm

See also

SVGZoomEvent
BeforeUnloadEvent
CompositionEvent
CustomEvent
Event
DragEvent
FocusEvent
KeyboardEvent
MessageEvent
MouseEvent
MouseWheelEvent
MutationEvent
MSSiteModeEvent
StorageEvent
TextEvent
UIEvent
Reference
eventPhase
stopImmediatePropagation

 

 

Send comments about this topic to Microsoft

Build date: 1/23/2013

Ajouts de la communauté

AJOUTER
© 2013 Microsoft. Tous droits réservés.