Enable mwsuggest datalist implementation
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 31 Dec 2010 19:30:29 +0000 (19:30 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 31 Dec 2010 19:30:29 +0000 (19:30 +0000)
Tested in Firefox 4.0b8, which is the only browser it will trigger for
due to the feature test.  Opera is explicitly blacklisted for the reason
given in the comment.  This feature was added in r61348 but remained
disabled by default because no browser actually supported it properly
(due to Opera's bug).  Of course, this is somewhat obsolescent given the
fancy new Vector search, but it's a two-line change, so why not.

I was reminded of this by Jonas Sicking, a Firefox developer, remarking
on how <datalist> should indeed be usable for this purpose in Firefox 4:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-December/029577.html

skins/common/mwsuggest.js

index 5870cd7..9bc38c6 100644 (file)
@@ -43,14 +43,16 @@ window.os_animation_timer = null;
 /**
  * <datalist> is a new HTML5 element that allows you to manually supply
  * suggestion lists and have them rendered according to the right platform
- * conventions.  However, the only shipping browser as of early 2010 is Opera,
- * and that has a fatal problem: the suggestion lags behind what the user types
- * by one keypress.  (Reported as DSK-276870 to Opera's secret bug tracker.)
- * The code here otherwise seems to work, though, so this can be flipped on
- * (maybe with a UA check) when some browser has a better implementation.
+ * conventions.  Opera as of version 11 has a fatal problem: the suggestion
+ * lags behind what the user types by one keypress.  (Reported as DSK-276870 to
+ * Opera's secret bug tracker.)  However, Firefox 4 supports it without
+ * problems, so Opera is just blacklisted here.  Ideally we wouldn't blacklist
+ * future versions, in case they fix it, but the fallback isn't bad at all and
+ * the failure if they don't fix it is very annoying, so in this case we'll
+ * blacklist future versions too.
  */
-// var os_use_datalist = 'list' in document.createElement( 'input' );
-window.os_use_datalist = false;
+window.os_use_datalist = 'list' in document.createElement( 'input' )
+       && $.client.profile.name != 'opera';
 
 /** Timeout timer class that will fetch the results */
 window.os_Timer = function( id, r, query ) {