Closed Bug 42025 Opened 24 years ago Closed 24 years ago

Can't retrieve the opacity value of an object

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

VERIFIED INVALID

People

(Reporter: shashi, Assigned: jst)

Details

I have the following script:

function fadeImage(start, finish, step, speed){       
   if (start < finish){      	   
    document.getElementById("image").style.opacity = start;  
    start=start+step; 
    setTimeout("fadeImage("+start+","+finish+","+step+","+speed+")",speed);
   }
   if (start == 0.33) {
    someFunction();
   }	       
}

Of key interest is the second "if" statement. Once the opacity reaches 0.33, I 
want another function to kick-in. But the problem is that Mozilla is unable to 
retrieve the opacity value so the second function never gets started.

This problem does not occur with any other CSS property. It is strictly limited 
to opacity.
'opacity' is not a CSS property, and should probably be renamed to 
'-moz-opacity'.  (It is in SVG, though, but we don't really support SVG...)
I know that opacity is not a CSS property but since it is "used" like a CSS 
property, for practical purposes it makes life easier by calling it one.

But we aren't here for semantics, are we???
I can't see any place in that code where you're retrieving the opacity of an
object. If the problem is that "start" never reaches 0.33 in the above code and
there's no other code involved, the code doesn't show any problem with
retrieving the opacity from an object. All I see that sets the value of "start"
is "start = start+step", no opacity retrieveing involved AFAIK.

I ran a small test that does:

  element.style.opacity = 0.5;
  dump(element.style.opacity + "\n");

and I do get "0.5" on the console.

Looks like there's either a problem in the JS above, or the caller of that code
doesn't pass the correct arguments if start never reaches 0.33

And yes, David it right, opacity will probably be renamed to -moz-opacity (and
the DOM property will be renambed to some other name since '-' is not allowd
in property names).

Marking INVALID.
Status: UNCONFIRMED → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
Source code problem. Not ours, marking as verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.