Last modified: 2011-11-09 16:16:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T34188, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 32188 - Replace $.client.test() with $.client.isBlacklisted()
Replace $.client.test() with $.client.isBlacklisted()
Status: NEW
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.20.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-11-03 19:36 UTC by Brion Vibber
Modified: 2011-11-09 16:16 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Brion Vibber 2011-11-03 19:36:39 UTC
Sometimes it does make sense to use user-agent sniffing for blacklisting known-buggy browsers; at some point jquery.client.js got switched in to allow unrecognized browsers to pass through as assumed-good (which is good!)

However  the version maps you pass to $.client.test() are in a whitelist format (eg, msie: [[">=", 7]] for "works on 7 or later") and it's hard to tell from calling code that it's actually a blacklist.

May encourage better coding practice to swap the order and use blacklist explicitly in the name, so eg WikiEditor's map might change to:

	'browsers': {
		// Left-to-right languages
		'ltr': {
			// The toolbar layout is broken in IE6
			'msie': [['<', 7]],
			// Layout issues in FF < 2
			'firefox': [['<', 2]],
			// Text selection bugs galore - this may be a different situation with the new iframe-based solution
			'opera': [['<', 9.6]],
			// jQuery minimums
			'safari': [['<', 3]],
			'chrome': [['<', 3]],
			'netscape': [['<', 9]],
			'blackberry': false,
			'ipod': false,
			'iphone': false
		},
		// Right-to-left languages
		'rtl': {
			// The toolbar layout is broken in IE 7 in RTL mode, and IE6 in any mode
			'msie': [['<', 8]],
			// Layout issues in FF < 2
			'firefox': [['<', 2]],
			// Text selection bugs galore - this may be a different situation with the new iframe-based solution
			'opera': [['<', 9.6]],
			// jQuery minimums
			'safari': [['<', 3]],
			'chrome': [['<', 3]],
			'netscape': [['<', 9]],
			'blackberry': false,
			'ipod': false,
			'iphone': false
		}

This also makes obvious that we can drop some of those items -- the jQuery minimum numbers don't need to be checked if we're already not loading any of this JS because jQuery won't be supported. :)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links