* (bug 16529) Fix for search suggestions with some third-party JS libraries
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 3 Dec 2008 00:00:20 +0000 (00:00 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 3 Dec 2008 00:00:20 +0000 (00:00 +0000)
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
skins/common/mwsuggest.js

index 24fbd0f..fb12add 100644 (file)
@@ -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 ===
 
index 3582a75..061a645 100644 (file)
@@ -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;
 }