Fix another DOM test to pass in IE8.

This commit is contained in:
Juriy Zaytsev 2009-03-21 21:09:55 -04:00
parent 9bb8fbf2ff
commit eaa8b949c8
2 changed files with 25 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Fix DOM tests to use proper feature test when testing `setOpacity` (kangax)
* Fix another failure in IE8, `for`/`htmlFor` {get/set}Attribute translation. (kangax)
* Fix `Element#writeAttribute` and `Element#readAttribute` failures in IE8 due to lack of proper feature testing. (kangax)

View File

@ -814,7 +814,29 @@ new Test.Unit.Runner({
this.assert(
$('style_test_3').setOpacity(0.9999999).getStyle('opacity') > 0.999
);
if (Prototype.Browser.IE) {
/*
IE <= 7 needs a `hasLayout` for opacity ("filter") to function properly
`hasLayout` is triggered by setting `zoom` style to `1`,
In IE8 setting `zoom` does not affect `hasLayout`
and IE8 does not even need `hasLayout` for opacity to work
We do a proper feature test here
*/
var ZOOM_AFFECT_HAS_LAYOUT = (function(){
// IE7
var el = document.createElement('div');
el.style.zoom = 1;
var result = el.hasLayout;
el = null;
return result;
})();
if (ZOOM_AFFECT_HAS_LAYOUT) {
this.assert($('style_test_4').setOpacity(0.5).currentStyle.hasLayout);
this.assert(2, $('style_test_5').setOpacity(0.5).getStyle('zoom'));
this.assert(0.5, new Element('div').setOpacity(0.5).getOpacity());