1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/browser-element/mochitest/file_inputmethod.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<body> 1.7 +<script> 1.8 + var im = navigator.mozInputMethod; 1.9 + if (im) { 1.10 + var intervalId = null; 1.11 + // Automatically append location hash to current input field. 1.12 + im.oninputcontextchange = function() { 1.13 + var ctx = im.inputcontext; 1.14 + if (ctx) { 1.15 + dump('inputcontext is received for input method ' + location.hash + '\n'); 1.16 + intervalId = setInterval(function() { 1.17 + dump('sending text in input method ' + location.hash + '\n'); 1.18 + ctx.replaceSurroundingText(location.hash); 1.19 + }, 500); 1.20 + } else { 1.21 + dump('inputcontext is removed for input method ' + location.hash + '\n'); 1.22 + clearInterval(intervalId); 1.23 + } 1.24 + }; 1.25 + } 1.26 +</script> 1.27 +<p>This frame representing the input method frame.</p> 1.28 +</body> 1.29 +</html>