aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-12-07 11:08:35 +0100
committerNoah Loomans <noahloomans@gmail.com>2016-12-07 11:08:35 +0100
commit84bf0b24e0a6b584311218108ca953f911901c74 (patch)
treed8fe156ce0c3a5cc04b89b6a53b39e9383c3167b /public
parent0e2ef2aa2495fa19d7cc7a25cceef58c572494ca (diff)
fix IE bug input event bug
The IE 'input' event doesn't work propery. Use non-standard 'textinput' event on IE instaid.
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/main.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 722031d..4ebc6c8 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -88,7 +88,15 @@ searchNode.addEventListener('keydown', function (e) {
}
})
-searchNode.addEventListener('input', function (e) {
+let inputEventStr
+if (navigator.userAgent.indexOf('MSIE') !== -1 ||
+ navigator.appVersion.indexOf('Trident/') > 0) {
+ inputEventStr = 'textinput' // IE 6-11
+} else {
+ inputEventStr = 'input' // normal browsers
+}
+
+searchNode.addEventListener(inputEventStr, function (e) {
document.body.className = ''
autocompleteNode.innerHTML = ''
if (inputNode.value.trim() === '') return