r66537 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66536‎ | r66537 | r66538 >
Date:16:30, 16 May 2010
Author:hartman
Status:ok
Tags:
Comment:
Don't setup mwsuggest when browsers cannot getElementById forms
This happens with Opera 8 for instance. Fixes bug 19586
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/skins/common/mwsuggest.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/mwsuggest.js
@@ -112,6 +112,11 @@
113113 /** Init Result objects and event handlers */
114114 function os_initHandlers( name, formname, element ) {
115115 var r = new os_Results( name, formname );
 116+ var formElement = document.getElementById( formname );
 117+ if( !formElement ) {
 118+ // Older browsers (Opera 8) cannot get form elements
 119+ return;
 120+ }
116121 // event handler
117122 os_hookEvent( element, 'keyup', function( event ) { os_eventKeyup( event ); } );
118123 os_hookEvent( element, 'keydown', function( event ) { os_eventKeydown( event ); } );
@@ -126,7 +131,7 @@
127132 element.setAttribute( 'autocomplete', 'off' );
128133 }
129134 // stopping handler
130 - os_hookEvent( document.getElementById( formname ), 'submit', function( event ) { return os_eventOnsubmit( event ); } );
 135+ os_hookEvent( formElement, 'submit', function( event ) { return os_eventOnsubmit( event ); } );
131136 os_map[name] = r;
132137 // toggle link
133138 if( document.getElementById( r.toggle ) == null ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -165,6 +165,7 @@
166166 variable {{REVISIONMONTH1}} when unpadded version is needed.
167167 * Special:Userrights didn't recognize user as changing his/her own rights if user did not capitalize first letter of username.
168168 * (bug 23507) Add styles for printing wikitables
 169+* (bug 19586) Avoid JS errors in mwsuggest when using old browsers such as Opera 8.
169170
170171 === API changes in 1.17 ===
171172 * (bug 22738) Allow filtering by action type on query=logevent

Status & tagging log