r24272 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24271‎ | r24272 | r24273 >
Date:15:33, 19 July 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 10642) Fix shift-click checkbox behavior for Opera 9.0+ and 6.0

The previous code was using the 'onmouseup' event to trigger the shift-click multiple selection behavior. This had a number of problems:
* Opera 6.0 doesn't fire this event on radio buttons
* Opera 7.x and 8.x flip the check state before sending the event, while Opera 9.x and other browsers flip it after
* A UA check for Opera was used to work around the state inconsistency for 7.x and 8.x, which broke on 9.x
* Minor quibble: the event fires if you click outside the radio and release while the mouse is over it, though that wouldn't normally count as a click on the radio.

I've switched it to use the 'onclick' event handler instead, which resolves this:
* Opera 6.x fires this event
* All tested browsers have flipped the check state before the event, so special-case code can be removed.

Tested browsers:
* Opera 9.2, 9.0, 8.5, 8.0, 7.5, 6.0/Mac
* Firefox 2/Mac
* Safari 2/Mac
* Safari 3/Win
* IE 7/Win
* IE 6/Win
* IE 5.2/Mac
* iCab 3/Mac
* Mozilla 1.1/Mac
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -728,7 +728,7 @@
729729 var end = checkboxes.length;
730730 checkboxes[end] = cb;
731731 cb.index = end;
732 - cb.onmouseup = checkboxMouseupHandler;
 732+ cb.onclick = checkboxMouseupHandler;
733733 }
734734
735735 if ( finish < inputs.length ) {
@@ -746,10 +746,7 @@
747747 lastCheckbox = this.index;
748748 return true;
749749 }
750 - var endState = !this.checked;
751 - if ( is_opera ) { // opera has already toggled the checkbox by this point
752 - endState = !endState;
753 - }
 750+ var endState = this.checked;
754751 var start, finish;
755752 if ( this.index < lastCheckbox ) {
756753 start = this.index + 1;
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1201,7 +1201,7 @@
12021202 * to ensure that client-side caches don't keep obsolete copies of global
12031203 * styles.
12041204 */
1205 -$wgStyleVersion = '89';
 1205+$wgStyleVersion = '90';
12061206
12071207
12081208 # Server-side caching:
Index: trunk/phase3/RELEASE-NOTES
@@ -314,7 +314,9 @@
315315 * (bug 10631) Warn when illegal characters are removed from filename at upload
316316 * Fix several JavaScript bugs under MSIE 5/Macintosh
317317 * (bug 10591) Use Arabic numerals (0,1,2...) for the Malayam language
 318+* (bug 10642) Fix shift-click checkbox behavior for Opera 9.0+ and 6.0
318319
 320+
319321 == API changes since 1.10 ==
320322
321323 Full API documentation is available at http://www.mediawiki.org/wiki/API

Follow-up revisions

RevisionCommit summaryAuthorDate
r24276Merged revisions 24213-24275 via svnmerge from...david20:20, 19 July 2007
r24419* (bug 10732) Protection chaining checkbox broken - this appears to have regr...robchurch23:09, 28 July 2007
r24502Merged revisions 24415-24479 via svnmerge from...david22:31, 31 July 2007

Status & tagging log