r79363 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79362‎ | r79363 | r79364 >
Date:19:30, 31 December 2010
Author:simetrical
Status:resolved (Comments)
Tags:
Comment:
Enable mwsuggest datalist implementation

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
Modified paths:
  • /trunk/phase3/skins/common/mwsuggest.js (modified) (history)

Diff [purge]

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

Follow-up revisions

RevisionCommit summaryAuthorDate
r79364Update dependencies for r79363 per Roan's advicesimetrical19:53, 31 December 2010
r79369RELEASE-NOTES update for r79363simetrical20:43, 31 December 2010
r79462Fix broken blacklisting code from r79363...simetrical00:10, 2 January 2011
r100348Revert r79363, r79364, and r79369 to disable datalists support entirely based...mah14:46, 20 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61348Add disabled <datalist> support to mwsuggest...simetrical00:51, 22 January 2010

Comments

#Comment by Krinkle (talk | contribs)   15:49, 1 January 2011

I've tested in Firefox 3, 4 and Safari 5 but $.client.profile.name returns an empty string.

"$.client.profile" is a function, which retuns an object.

See also http://www.mediawiki.org/wiki/ResourceLoader/Default_modules#jQuery.client

Use:

var prof = $.client.profile();
prof.name != 'opera'

or chain direcly if only needed once

$.client.profile().name != 'opera'
#Comment by Simetrical (talk | contribs)   00:11, 2 January 2011

Yeah, that page was wrong until you changed it. Fixed in r79462, thanks for the report.

#Comment by Krinkle (talk | contribs)   16:53, 20 October 2011

test test test

#Comment by Krinkle (talk | contribs)   15:50, 1 January 2011

Difference is small but the "()" is missing in the commit.

Status & tagging log