Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

68
Vistas
how to break event.stopImmediatePropagation on javascript

While building an extension, a webpage disabled all eventListeners and disabled eventListeners on my test extension. For example, when the event listner looks like,

element.addEventListener('click', (e) => {
 e.stopImmediatePropagation();
 console.log('A click event fired.');
});

but the webpage disabled event listener(I can't edit the webpage). As I expect Event.stopImmediatePropagation() fired on all event listeners and keep event listeners from firing events. Like,

let element = document.querySelector('#test');
// From the webpage,
element.addEventListener('click', (e) => {
e.stopImmediatePropagation();
console.log('A click event fired.');
});

// From my test extension, 
//this event listener is stopped by e.stopImmediatePropagation();
element.addEventListener('click', (e) => {
console.log('Extension is executed.');
});
<div id='test'>
Click me
</div>

And I found a question about how to break event.stopImmediatePropagation. But there is only a solution for jQuery.

I want to find how to break stopimmediatepropagation with only javascript. Any comment or answer would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If this really for a click event (or at least a bubbling event), you can add a capturing event handler on the document before any script is ran. This will ensure you'll receive the event.

let element = document.querySelector('#test');
// From the webpage,
element.addEventListener('click', (e) => {
e.stopImmediatePropagation();
console.log('A click event fired.');
});

// From your test extension, 
// make it run before the page's scripts
// to be sure to also catch other "captured" events
document.addEventListener('click', (e) => {
 if( e.composedPath().includes( element ) ) { // check that 'element' has really been clicked
    console.log('Extension is executed.');
 }
}, { capture: true }); // catch it in capture phase
<div id='test'>
Click me
</div>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda