https://bugzilla.wikimedia.org/show_bug.cgi?id=32188

       Web browser: ---
             Bug #: 32188
           Summary: Replace $.client.test() with $.client.isBlacklisted()
           Product: MediaWiki
           Version: 1.19-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Javascript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


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. :)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to