Do not load old CSS fixes for new browsers
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 12 Jul 2009 18:52:32 +0000 (18:52 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 12 Jul 2009 18:52:32 +0000 (18:52 +0000)
It's bad form to load a fix for "version X and later".  That means that
if the browser vendor fixes the underlying bug, they'll be served
incorrect markup and break.  On the other hand, if you check for just
"version X", then if they fix the bug they'll be fine, but if they
*don't* fix the bug they'll break, which is as it should be.  :)

Specifically, I disabled loading RTL fixes for Opera 9.6: my testing
shows that they worsen display, don't improve it.  All other fixes were
already not being loaded for browsers later than they should have been.
(Other than the five-year-old KHTML fix I removed outright in r53141,
which was loading for modern-day Safari and Chrome despite the
underlying bug very possibly having been fixed before WebKit even
existed . . .)

While I was at it, I made the variable names a bit saner.  I kept the
old weird ones (none are clear on which versions they include) for
backward compatibility in case scripts were relying on them.  Except
is_ff2_, which was so atrociously named that I had to put it out of its
misery.  For the others, I added new xxx_bugs variables to make it clear
that's all they were tracking.

RELEASE-NOTES
skins/common/wikibits.js

index e13d13b..c60ff67 100644 (file)
@@ -247,6 +247,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 19442) Show/hide options on watchlist only work once
 * (bug 19602) PubMed Magic links now use updated NIH url
 * (bug 19637) externallinks have links to self
+* Don't load Opera 9.5 RTL fixes for Opera 9.6
 
 == API changes in 1.16 ==
 
index 10a2ad9..03a7b03 100644 (file)
@@ -12,7 +12,7 @@ if (webkit_match) {
 }
 // For accesskeys; note that FF3+ is included here!
 var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
-var is_ff2_ = /firefox\/2/.test( clientPC );
+var ff2_bugs = /firefox\/2/.test( clientPC );
 // These aren't used here, but some custom scripts rely on them
 var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1;
 var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1;
@@ -20,7 +20,10 @@ if (clientPC.indexOf('opera') != -1) {
        var is_opera = true;
        var is_opera_preseven = window.opera && !document.childNodes;
        var is_opera_seven = window.opera && document.childNodes;
-       var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC );
+       var is_opera_95 = /opera\/(9\.[5-9]|[1-9][0-9])/.test( clientPC );
+       var opera6_bugs = is_opera_preseven;
+       var opera7_bugs = is_opera_seven && !is_opera_95;
+       var opera95_bugs = /opera\/(9\.5)/.test( clientPC );
 }
 
 // Global external objects used by this script.
@@ -93,13 +96,15 @@ function appendCSS(text) {
 
 // special stylesheet links
 if (typeof stylepath != 'undefined' && typeof skin != 'undefined') {
-       if (is_opera_preseven) {
+       // FIXME: This tries to load the stylesheets even for skins where they
+       // don't exist, i.e., everything but Monobook.
+       if (opera6_bugs) {
                importStylesheetURI(stylepath+'/'+skin+'/Opera6Fixes.css');
-       } else if (is_opera_seven && !is_opera_95) {
+       } else if (opera7_bugs) {
                importStylesheetURI(stylepath+'/'+skin+'/Opera7Fixes.css');
-       } else if (is_opera_95) {
+       } else if (opera95_bugs) {
                importStylesheetURI(stylepath+'/'+skin+'/Opera9Fixes.css');
-       } else if (is_ff2_) {
+       } else if (ff2_bugs) {
                importStylesheetURI(stylepath+'/'+skin+'/FF2Fixes.css');
        }
 }