diff --git a/CHANGELOG b/CHANGELOG index 1970358..7b838e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* In IE, allow opacity to be set on elements not yet attached to the document. Closes #9904. [Thomas Fuchs, dcpedit, Tobie Langel] + * Avoid the try..catch block in Ajax.Response#_getResponseJSON unless required. [Tobie Langel] * Add more tests to Element.update. Closes #9327. [Tobie Langel] diff --git a/src/dom.js b/src/dom.js index ba86405..1512459 100644 --- a/src/dom.js +++ b/src/dom.js @@ -747,7 +747,11 @@ else if (Prototype.Browser.IE) { return filter.replace(/alpha\([^\)]*\)/gi,''); } element = $(element); - if (!element.currentStyle.hasLayout) element.style.zoom = 1; + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + var filter = element.getStyle('filter'), style = element.style; if (value == 1 || value === '') { (filter = stripAlpha(filter)) ? diff --git a/test/unit/dom.html b/test/unit/dom.html index dc4f901..a484583 100644 --- a/test/unit/dom.html +++ b/test/unit/dom.html @@ -223,6 +223,8 @@
blah
+blah +blah
@@ -1085,7 +1087,13 @@ assert( $('style_test_3').setOpacity(0.9999999).getStyle('opacity') > 0.999 ); - + if (Prototype.Browser.IE) { + assert($('style_test_4').setOpacity(0.5).currentStyle.hasLayout); + assert(2, $('style_test_5').setOpacity(0.5).getStyle('zoom')); + assert(0.5, new Element('div').setOpacity(0.5).getOpacity()); + assert(2, new Element('div').setOpacity(0.5).setStyle('zoom: 2;').getStyle('zoom')); + assert(2, new Element('div').setStyle('zoom: 2;').setOpacity(0.5).getStyle('zoom')); + } }}, testElementGetStyle: function() { with(this) {