Skip to content

getOpacity malfunctions with IE 9 #175

Description

@jwestbrook

previous lighthouse ticket #1671
by Matthew Schultz


getOpacity malfunctions with IE 9 by not setting it properly because it is retrieved as a string. The reason for this is getStyle is overwritten with this:

if ('styleFloat' in DIV.style) { methods.getStyle = getStyle_IE; methods.setOpacity = setOpacity_IE; methods.getOpacity = getOpacity_IE; }

Here's the trace of what happens to trigger this bug:

Element.getOpacity(element);
Element.getStyle(element, 'opacity'); <- overwritten
Element.getStyle_IE(element, 'opacity');
return $value; <- getOpacity_IE is not called because standard opacity is supported
I have enclosed a patch which will fix this problem. This ensures that when getOpacity_IE gets called and the standard opacity call is supported, it will actually call the standard call instead of using the overwritten one.

diff --git a/src/prototype/dom/dom.js b/src/prototype/dom/dom.js
index f14639b..b456875 100644
--- a/src/prototype/dom/dom.js+++ b/src/prototype/dom/dom.js@@ -2847,6 +2847,10 @@
* **/
function getStyle(element, style) {
+ return getDomStyle(element, style);+ }++ function getDomStyle(element, style) {
element = $(element);
style = normalizeStyleName(style);
@@ -2989,7 +2993,7 @@
* Returns the opacity of the element.
**/
function getOpacity(element) {
- return Element.getStyle(element, 'opacity');+ return getDomStyle(element, 'opacity');
}
function getOpacity_IE(element) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions