Collapse the table of content
Expand the table of content

getCompositionAlternatives method

Returns a copy of the current list of alternate candidate strings from the MSInputMethodContext object.




var result = MSInputMethodContext.getCompositionAlternatives();


This method has no parameters.

Return value

Type: sequence<DOMString>

An array of strings


The MSInputMethodContext object can produce alternatives while it has a composition in progress. If the composition ends and the composition is finalized unchanged (for example, with a Chinese Simplified Pinyin IME when committing Pinyin unchanged or Japanese IME when finalizing Hiragana), then for some IMEs the last set of alternatives may still be available, since in this case there is no user perceived change and its more useful to keep suggestions unchanged in this case. Any later text change will cause this to return an empty or new list.

The list of alternatives is not updated "live". It is only updated between compositionupdate events.

In some cases, this method might return an empty list if the IME doesn't support it or if composition alternatives are not available for the current composition string. For example, an empty list is returned for the Korean IME.

For an ambiguous composition in progress (such as Chinese Pinyin or Japanese Hiragana), composition alternatives include different possible conversion strings for use in scenarios like matching search suggestions. They will be linguistically equivalent to the input string, but depending on the IME, they might not be exactly the same as the characters shown in the IME candidate window and might not include the full set of possible conversions if a large number are possible.

See also




© 2017 Microsoft