RESOLVED FIXED 7430
Invalid opacity values are treated incorrectly
https://bugs.webkit.org/show_bug.cgi?id=7430
Summary Invalid opacity values are treated incorrectly
Brad Fults
Reported 2006-02-23 10:51:17 PST
CSS styles exposed through the DOM should be treated as numbers (floats specifically) when the style takes a unitless float value. A simple example of this is opacity: el.style.opacity = 0.3; //works fine el.style.opacity = 1.3877787807814457e-16; // fails -- Webkit invalidates the style altogether (yielding opacity == 1.0) This will also fail for values specified in octal or hexadecimal, as they are treated as strings. This does work as expected in Firefox 1.5 (converting the numbers), however.
Attachments
Test case: simple fader. (1.74 KB, text/html)
2006-02-23 10:52 PST, Brad Fults
no flags
reduced test case (553 bytes, text/html)
2006-05-02 05:32 PDT, Alexey Proskuryakov
no flags
Brad Fults
Comment 1 2006-02-23 10:52:05 PST
Created attachment 6681 [details] Test case: simple fader.
Alexey Proskuryakov
Comment 2 2006-05-02 05:32:55 PDT
Created attachment 8069 [details] reduced test case
Alexey Proskuryakov
Comment 3 2006-05-02 05:39:09 PDT
Trying to set the opacity to an invalid value such as 1e-16 has no effect in Firefox, but resets it in Safari. I'm not quite sure about what constitutes an invalid value, but the issue doesn't look like related to strings to me.
Brad Fults
Comment 4 2006-05-02 06:01:50 PDT
The so-called "invalid value" is a valid Number literal in JS. I suppose whether it's an "invalid value" depends entirely on whether the DOM as bound to by JS is supposed to only accept numbers in a specific format (decimal) or if any JS Number should be converted to a value suitable for DOM assignment.
Alexey Proskuryakov
Comment 5 2007-01-06 16:06:04 PST
(In reply to comment #4) > The so-called "invalid value" is a valid Number literal in JS. That's correct, but then it's converted back to a string and passed to CSS parser, which doesn't understand scientific notation. The problem with handling invalid values has been recently fixed, see bug 7296. The test case now works just like it does in Firefox. We just don't log an error to the console yet, unlike Firefox.
Note You need to log in before you can comment on or make changes to this bug.