Use capability testing instead of UA sniffing
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 16 Jul 2009 02:58:17 +0000 (02:58 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 16 Jul 2009 02:58:17 +0000 (02:58 +0000)
This should theoretically work fine, but I'm admittedly not *totally*
sure what this is supposed to do, so I haven't actually tested it.  The
old behavior was almost certainly wrong, though: is_khtml was returning
true for all WebKit, and non-ancient WebKit definitely supports
overflow-x.  Robert Stojnic/rainman should take a look at this to make
sure it's right, or anyone else who knows what this does.

skins/common/mwsuggest.js

index eeb8412..4adcb9d 100644 (file)
@@ -107,9 +107,9 @@ function os_showResults(r){
 }
 
 function os_operaWidthFix(x){
-       // TODO: better css2 incompatibility detection here
-       if(is_opera || is_khtml || navigator.userAgent.toLowerCase().indexOf('firefox/1')!=-1){
-               return 30; // opera&konqueror & old firefox don't understand overflow-x, estimate scrollbar width
+       // For browsers that don't understand overflow-x, estimate scrollbar width
+       if(typeof document.body.style.overflowX != "string"){
+               return 30;
        }
        return 0;
 }