From 2135c34e1d70b4c2759b80e64d0db143d0b37f19 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Dec 2008 00:00:20 +0000 Subject: [PATCH] * (bug 16529) Fix for search suggestions with some third-party JS libraries Per bug "when other javascripts are included in a webpage that use event handlers, eg prototype.js, os_eventKeydown does not work (for example the arrow keys) because the keycode is undefined." The check for window.Event seems to be for ancient Netscape 4.x stuff and might not be totally necessary... but at least checking for the *actual* thing wanted (e.keyCode vs e.which) is less prone to false positives. (A third party JS library might create an Event class which would override the window.Event property and generally muck things up; on IE the previous check would then cause an attempt to read the key code from e.which which doesn't exist on IE.) --- RELEASE-NOTES | 2 ++ skins/common/mwsuggest.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 24fbd0fba0..fb12add345 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -387,6 +387,8 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 12647) Allow autogenerated edit summary messages to be blanked with '-' * (bug 16026) 'Revision-info' and 'revision-info-current' both accept wiki markup now. +* (bug 16529) Fix for search suggestions with some third-party JS libraries + === API changes in 1.14 === diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index 3582a75f8c..061a645149 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -611,7 +611,7 @@ function os_eventKeydown(e){ os_mouse_moved = false; - os_cur_keypressed = (window.Event) ? e.which : e.keyCode; + os_cur_keypressed = (e.keyCode == undefined) ? e.which : e.keyCode; os_last_keypress = 0; os_keypressed_count = 0; } -- 2.20.1