W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2015

IME endcomposition event imeplementation inconsistencies

From: Johannes Wilm <mail@johanneswilm.org>
Date: Wed, 26 Aug 2015 16:32:45 +0200
Message-ID: <CABkgm-TTzZLOvOsYH0ju8zNkeQWUXoZ7HMwgfqS0LwV=XNgOUA@mail.gmail.com>
To: www-dom@w3.org, Gary Kačmarčík <garykac@google.com>, Travis Leithead <travis.leithead@microsoft.com>, "public-editing-tf@w3.org" <public-editing-tf@w3.org>
Hey,
I noticed that the IME compositionend event is implement somewhat
differently in Chrome and Firefox. Looking at the spec [1], I am not sure
if either of them are correct.

Chrome triggers the event on the element where the caret currently is, if
one moves it to another contentEditable element it then pastes all the
composed characters there.

Firefox triggers the event on the element where the caret was at the time
when the compositionstart event was triggered. It does not paste the
composed characters into another cE-element, if one places it there.


The spec seems to say that it has to be triggered on the element where the
composition actually takes place. I don't think it says it should paste the
composition in another place if the caret is moved there, but this actually
helps my use case.

What I am trying to achieve is to not have the composition insert anything
into the DOM of the element before the entire composition is done. On the
W3C Editing Taskforce we are trying to make it possible to give more direct
control to JS on what changes are made to cE-elements and as part of that,
one may choose to move the caret to somewhere else during composition.

Doing the composition in an alternative element works in both Chrome and
Firefox, but due to above mentioned implementation differences, one has to
write some of the code twice [2]. The idea is to eventually do what one can
already do with Chrome [3] and compose characters inline without doing any
changes to the DOM before the construction is entirely done.


[1] https://w3c.github.io/uievents/#event-type-compositionend
[2] http://jsbin.com/degubomera/1/edit?html,js,output
[3] http://jsbin.com/fudeqikivu/1/edit?html,js,output

-- 
Johannes Wilm
http://www.johanneswilm.org
tel: +1 (520) 399 8880
Received on Wednesday, 26 August 2015 14:33:20 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:24 UTC