This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Consider the legacy color value " #fff". The spec doesn't strip the whitespace from input, only from keyword, so it fails to remove the leading space and doesn't treat the # specially. Then it replaces all non-hex characters by "0", so it gets "00fff". Then it's not a multiple of three, so it pads to "00fff0". This translates to #00fff0, a.k.a. rgb(0, 255, 240). Likewise, " fff" becomes "0fff00". Test case: <!doctype html> <font color=" #fff">Test</font> <font color="#fff">Test</font> <font color=" fff">Test</font> <font color="fff">Test</font> <script>document.body.textContent = getComputedStyle(document.querySelectorAll("font")[0]).color + getComputedStyle(document.querySelectorAll("font")[1]).color + getComputedStyle(document.querySelectorAll("font")[2]).color + getComputedStyle(document.querySelectorAll("font")[3]).color;</script> Spec: #00fff0#ffffff#0fff00#0f0f0f IE 9 RC: #0f0f0f#0f0f0f#0f0f0f#0f0f0f Firefox 4 RC: #ffffff#ffffff#0f0f0f#0f0f0f Chrome 11 dev: #ffffff#ffffff#ffffff#ffffff Opera 11: #0fff00#0f0f0f#0f0f0f#0f0f0f (I've translated rgb() syntax to hex for easier interpretation.) If the spec stripped whitespace, it would be: #ffffff#ffffff#0f0f0f#0f0f0f which exactly matches Gecko. The current spec doesn't match any browser for the leading-whitespace cases, while this change would make it match two or three browsers respectively.
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document: http://dev.w3.org/html5/decision-policy/decision-policy.html Status: Accepted Change Description: see diff given below Rationale: Concurred with reporter's comments.
Checked in as WHATWG revision r6123. Check-in comment: Looks like whitespace stripping needs to happen to non-keywords too. http://html5.org/tools/web-apps-tracker?from=6122&to=6123
BTW, see bug 9847 and r5359 for history.
mass-moved component to LC1