WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
30341
Make float decimal formatting of CSS values consistent
https://bugs.webkit.org/show_bug.cgi?id=30341
Summary
Make float decimal formatting of CSS values consistent
Evan Martin
Reported
2009-10-13 14:42:02 PDT
When JS reads a float value from CSS, it gets it back as a string. As the following console session shows, we format long floats to six digits. This should be checked against other browsers, unified, and spec'd.
> document.foobar = 1/9;
0.1111111111111111
> document.foobar
0.1111111111111111
> var x = document.getElementById('header')
undefined
> x
<div id="header">
> x.style.opacity = 1/9;
0.1111111111111111
> x.style.opacity
0.111111
Attachments
Page for testing float handling
(2.41 KB, text/html)
2009-12-20 07:18 PST
,
Evan Martin
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Evan Martin
Comment 1
2009-10-13 14:46:05 PDT
Another related question is what the upper bound on CSS values are. E.g., can I set foobar.style.left = 100000000000000000000000px?
Evan Martin
Comment 2
2009-12-20 07:18:38 PST
Created
attachment 45276
[details]
Page for testing float handling
Evan Martin
Comment 3
2009-12-20 07:21:02 PST
+simon, in case he's curious The attachment tries to summarize some corner cases that browsers might have. Next I need to run this on various browsers and see if there's any pattern they might agree on. (I only have a Linux box at the moment, but when I'm back at work I can test IE, Safari, and Opera.)
Simon Fraser (smfr)
Comment 4
2009-12-21 07:47:10 PST
I can take this to the CSS Working group.
Evan Martin
Comment 5
2010-01-07 11:24:37 PST
By the way, I realized that this attachment is probably confusing things a bit because we might be doing a float -> string conversion to print out the result in the table. That's probably using another printf()-like call that will introduce exponential notation etc. that may not be part of the code this is intending to test.
Ahmad Saleem
Comment 6
2022-09-02 14:58:36 PDT
I notice that there are changes in the Safari Technology Preview 152 and other browsers (Chrome Canary 107 and Firefox Nightly 107) despite Webkit adopting CSS Parser. All browsers differ from each other in few cases. Just wanted to highlight. Thanks!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug