prevent-listener

prevent-listener

The prevent-listener snippet prevents the addition of event listeners by wrapping EventTarget.prototype.addEventListener.

Parameters

Name

Description

Mandatory

type

A pattern that matches the type(s) of events to prevent. Enclose in / for regex.

Yes

handler

A pattern that matches the event handler's declaration. Enclose in / for regex.

No

selector

The CSS selector that the event target must match.

No

Filter examples

Filter

Result

prevent-listener click

No event listener will be added for click events.

prevent-listener click console div

No click event listener added on div elements whose handler matches "console".

prevent-listener click console

No listener added for click events whose handler matches "console".

Debugging

Message

When

Definition

DEBUG [prevent] Wrapped addEventListener

After wrapping

addEventListener has been wrapped.

DEBUG [prevent] was prevented from being added

Each time prevented

Detailed group of logs about the event type and handler.