cdotyone / mochaui

development tree for MochaUI
http://mochaui.org/demo/
Other
290 stars 83 forks source link

desktop.js : Negative panel height fires an IE7 / IE8 error in Mootools 1.3 #111

Closed partikule closed 12 years ago

partikule commented 13 years ago

The Mootools 1.3 setStyle function generates an "Invalid argument" when trying to set a negative height value in IE7 and IE8 (not tested in IE9).

During Destop init, panel height are calculated by destop.js->panelHeight2() and sometimes, a negative value can be tried to be set to a panel (in my case, I have 2 columns with 1 panel in each column).

Found a solution :

In desktop.js, function panelHeight2(), replace :

if (remainingHeight != 0 && tallestPanelHeight > 0){
    tallestPanel.setStyle('height', tallestPanel.getStyle('height').toInt() + remainingHeight);
    if (tallestPanel.getStyle('height') < 1){
        tallestPanel.setStyle('height', 0);
    }
}

by:

if (remainingHeight != 0 && tallestPanelHeight > 0){
    var newHeight = tallestPanel.getStyle('height').toInt() + remainingHeight;
    if (newHeight > 0)
        tallestPanel.setStyle('height', newHeight);
}
altairis-tof commented 13 years ago

another solution is to use try/catch in the setStyle function (see this commit : https://github.com/cbattarel/mochaui/commit/6f71f3789b6131a9661f04b586f0e4ee3a6e70ce )

partikule commented 13 years ago

Example of the Mootools bug here : http://partikule.partikule.net/mootools_setstyle_bug/index.html

Mootools ticket : https://mootools.lighthouseapp.com/projects/2706-mootools/tickets/1258-setstyle-negative-value-and-ie7

partikule commented 13 years ago

Final answer from mootools : https://mootools.lighthouseapp.com/projects/2706-mootools/tickets/1258-setstyle-negative-value-and-ie7#ticket-1258-7

I agree with dimitar : MochaUI should check these kind of negative values and do so it is compatible with IE7. Thanks to god we do not speak about IE6 anymore, but IE7 and IE8 are widely used by people in important companies, so they are important browser (in the case you want to use mochaUI in the real worls and not only for geeks or to play during hollidays...)

cdotyone commented 12 years ago

It was also happening in IE9. This should no longer happen, at least it doesn't in IE9 on my machine. Let me know if I need to look at this for IE7-8. -Chris