[cssom] Serialization of large numbers should use scientific notation
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
https://drafts.csswg.org/cssom/#serialize-a-css-component-value in the section has a note that says "scientific notation is not used." While this makes sense for small values so we serialize "0" instead of "6.123233995736766e-17" and this matches the behavior of Chrome and Firefox and I'm looking into implementing this in WebKit, for large numbers all browsers do use scientific notation, as illustrated by this simple example:
<body onload='checkLargeValues()'>
<script>
function checkLargeValues() {
let target = document.getElementById('p');
target.style['line-height'] = 1e+26;
alert(window.getComputedStyle(target)['line-height'])
}
</script>
<p id="p"></p>
</body>
The phrase "in the shortest form possible" is already in the text, which suggests to me that multiple forms are possible. I suggest the note be clarified to say something like "scientific notation is not used with negative exponents."
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the CSSOM “serialize a CSS component value” section linked in the issue, especially the serialization note, and compare it with the large-number example and current browser behavior. Done means the specification text clearly defines how scientific notation is handled for large values while preserving the intended treatment of small values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100