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

89
Vistas
Issues Dispatching CompositionEvents

I am creating a WYSIWYG editor and am trying to dispatch a pair of CompositionEvents (compositionstart and compositionupdate). The editor utilizes a private document model, and each key event is processed and recorded in said document model. After the key recording, if needed (depending on cross element selections, and the start/end elements selected), I may need to redraw an element, or a portion of an element.

The thinking is to capture the user's CompositionEvents, process the changes to the document model and elements, and then dispatch a copy of the user's CompositionEvents. Here is the code I have written (currently the events are hard-coded; I'm just testing a proof of concept):

var compStart = new CompositionEvent('compositionstart', {
  bubbles:true,
  cancelBubble:false,
  cancelable:true,
  composed:true,
  data:"",
  returnValue:true,
  view:window,
});
var compUpdate = new CompositionEvent('compositionupdate', {
  bubbles:true,
  cancelBubble:false,
  cancelable:true,
  composed:true,
  data:"´",
  returnValue:true,
  view:window,
});
document.querySelector('client-control-wysiwyg').dispatchEvent(compStart);
document.querySelector('client-control-wysiwyg').dispatchEvent(compUpdate);

The event listeners fire when these event are dispatched, but the character "´" never appears in the element.

These two events are identical to those that are created when I type the keyboard combo Option + E on my Mac, with the exception of isTrusted, which is expected as these are being manually triggered.

Is it possible to dispatch CompositionEvents?

about 4 years ago · Juan Pablo Isaza
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