Bug 41541
| Summary: | Dots are changed into commas in numbers when reading a css value from javascript | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | dysinscr |
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ap |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | PC | ||
| OS: | Linux | ||
dysinscr
Hi,
I have discovered that WebKit is changing dots into comas in CSS numbers when reading them in Javascript.
For example, 17.5 becomes 17,5. This is correct although it can be a problem.
Let's try this :
- Open your favorite WebKit based browser that supports the web inspector, like chromium or epiphany-webkit.
- Load your favorite page, like about:blank.
- Load the Web Inspector (Developer Tools in chromium) and go to the "Console" tab.
Run theses commands :
d = document.createElement('div'); // we create a new DIV element
document.body.appendChild(d); // append it to body
d.style.WebkitTransform = 'rotate(50deg)'; // rotation.
/* Now, we are going to read this transformation value */
document.defaultView.getComputedStyle(d,null).getPropertyValue('-webkit-transform');
=> This give me "matrix(0,642788, 0,766044, -0,766044, 0,642788, 0, 0)"
I was first expecting "rotate(50deg)" (like Opera, which gives a rad value though) but matrix() is fine too (like Mozilla).
The problem is : I would prefer getting : "matrix(0.642788, 0.766044, -0.766044, 0.642788, 0, 0)"
This would be nicer because currently, commas are used for separating value AND for decimal separator.
That's not very convenient. Moreover, Javascript's parseFloat expects a dot for decimal separator.
This is the same behavior for opacity : if I set d.style.opacity="0.5", I get "0,5". So that's not a -webkit-transform specific issue.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
*** This bug has been marked as a duplicate of bug 18994 ***