New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 668584 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

canvasrenderingcontex2d.fillStyle does not accept whitespace like firefox

Project Member Reported by dstockwell@google.com, Nov 25 2016

Issue description

eg. ctx.fillStyle = 'red' works, but ctx.fillStyle = ' red' does not.

http://output.jsbin.com/ketewagesa/1

Works in Firefox.
 
Cc: xidac...@chromium.org
Owner: junov@chromium.org
Status: Assigned (was: Untriaged)
Passing this junov@ who knows specs better. 

I briefly looked at the spec for fillStyle here:
https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-fillstyle

It states:
On setting, strings must be parsed as CSS <color> values and the color assigned.

In the above statement, "parsed as CSS <color> values" string is linked to:
https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value

I don't really know where " red" with a space is a valid value or not.
Tested on safari, it has the same behavior as chrome
I asked this question at blink-dev@, and it is pointed out that the spec here:
https://drafts.csswg.org/css-color/#named-colors

doesn't say anything about trimming the string before matching it. So ' red' doesn't seem to be a valid string for fillStyle.
I retract my previous comments, as it is pointed out here:
https://drafts.csswg.org/css-syntax/#rule-defs

The white space should be accepted. Following is the quote:
<whitespace-token> is never indicated in the grammar; <whitespace-token>s are allowed before, after, and between any two tokens, unless explicitly specified otherwise in prose definitions. (For example, if the prelude of a rule is a selector, whitespace is significant.)
Status: Fixed (was: Assigned)

Sign in to add a comment