prototype: In IE, allow opacity to be set on elements not yet attached to the document. Closes #9904.

This commit is contained in:
Tobie Langel 2007-10-22 13:14:56 +00:00
parent f870fba94f
commit 16127b024a
3 changed files with 16 additions and 2 deletions

View File

@ -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]

View File

@ -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)) ?

View File

@ -223,6 +223,8 @@
<div id="style_test_2" class="style-test" style="font-size:11px;"></div>
<div id="style_test_3">blah</div>
<span id="style_test_4">blah</span>
<span id="style_test_5">blah</span>
<div id="style_test_dimensions_container">
<div id="style_test_dimensions" style="background:#ddd;padding:1px;margin:1px;border:1px solid #00f"><div style="height:5px;background:#eee;width:5px;padding:2px;margin:2px;border:2px solid #0f0"> </div>
@ -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) {