IEFixes: Remove relativeforfloats() as it doesn't work
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 10 Apr 2014 18:44:59 +0000 (11:44 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 11 Apr 2014 18:32:52 +0000 (18:32 +0000)
This is intended for IE6 where there is supposedly a bug with elements
that have inline 'style="float: left/right;"' which would
need position:relative as fix-up.

Aside from that bug being questionable, the way it was implemented
doesn't actually work in IE6 (or any version of IE for that matter).

The CSSOM property for 'float' is 'Node.style.cssFloat', and in
old versions of IE (including IE6) it was 'Node.style.styleFloat',
but it was never 'Node.style.float'.

Confirmed in browserstack with Windows XP/IE6, an element like
<div style="float: left;"></div> has .cssFloat, .float does not
exist and this code does nothing.

When testing I used style['float'] to ensure this isn't just broken
because of reserved words in property names (though it doesn't matter
because .float actually works fine in ES3 engines).

Fun fact: Regardless of the spec, Chrome actually implements
'Node.style.float' as well (only Chrome though; IE and Firefox
don't). So though this is only loaded in IE6 (where it doesn't
work), if this is loaded in Chrome, it actually works.

We could find out what this bug is and provide a working patch
(if needed), but since this is legacy code and we're not actively
in the habit of providing more fixes for IE6, and since this is
and has been broken for years, removing it seems a sensible move.

Follows-up 28cca60.

Change-Id: I7d4b4bcb81b4bdaeab40bcbbb34dff0aa51f2e22

skins/common/IEFixes.js

index 6f240eb..545acad 100644 (file)
@@ -2,7 +2,7 @@
  * IE fixes javascript loaded by wikibits.js for IE <= 6.0
  */
 /*global isMSIE55:true, doneIETransform:true, doneIEAlphaFix:true */
-/*global hookit:true, fixalpha:true, relativeforfloats:true, setrelative:true */
+/*global hookit:true, fixalpha:true */
 ( function ( mw, $ ) {
 
 var expandedURLs, hasClass;
@@ -17,7 +17,6 @@ doneIEAlphaFix = false;
 hookit = function () {
        if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) {
                doneIETransform = true;
-               relativeforfloats();
                fixalpha();
        }
 };
@@ -79,31 +78,6 @@ if ( isMSIE55 ) {
        $( fixalpha );
 }
 
-// fix ie6 disappering float bug
-relativeforfloats = function () {
-       var bc, tables, divs;
-       bc = document.getElementById( 'bodyContent' );
-       if ( bc ) {
-               tables = bc.getElementsByTagName( 'table' );
-               divs = bc.getElementsByTagName( 'div' );
-               setrelative( tables );
-               setrelative( divs );
-       }
-};
-
-setrelative = function ( nodes ) {
-       var i = 0;
-       while ( i < nodes.length ) {
-               if ( ( ( nodes[i].style['float'] && nodes[i].style['float'] !== ( 'none' ) ||
-                       ( nodes[i].align && nodes[i].align !== ( 'none' ) ) ) &&
-                       ( !nodes[i].style.position || nodes[i].style.position !== 'relative' ) ) )
-               {
-                       nodes[i].style.position = 'relative';
-               }
-               i++;
-       }
-};
-
 // Expand links for printing
 hasClass = function ( classText, classWanted ) {
        var i = 0, classArr = classText.split(/\s/);