Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define behaviour of <stop> if offset value not specified. #217

Closed
BigBadaboom opened this issue Jul 26, 2016 · 1 comment
Closed

Define behaviour of <stop> if offset value not specified. #217

BigBadaboom opened this issue Jul 26, 2016 · 1 comment

Comments

@BigBadaboom
Copy link
Contributor

BigBadaboom commented Jul 26, 2016

A user of my rendering library has just discovered a bug triggered by an SVG file which has gradients defined with a missing offset value on the first stop elements.

<stop stop-color="#288549"/>

While checking the correct behaviour, I was surprised to discover that neither SVG 1.1 not SVG 2 have anything to say about what the initial value of offset should be if it is not specified.

From testing it seems that all browsers treat a missing offset as 0 (0%), rather than an error.

https://jsfiddle.net/kLc17qjg/

So I suggest making that explicit in the definition, by changing the first bullet point in section 13.3.5.3 to read:

Gradient offset values less than 0 (or less than 0%) are rounded up to 0%. Gradient offset values greater than 1 (or greater than 100%) are rounded down to 100%. If offset is not specified, the effect is as if a value of '0%' were specified.

@nikosandronikos
Copy link
Member

Interesting that it says 'see notes below'.

Agree that zero should be the initial value.

This rule would have an effect also depending on where in the list the stop is:

Each gradient offset value is required to be equal to or greater than the previous gradient stop's offset value. If a given gradient stop's offset value is not equal to or greater than all previous offset values, then the offset value is adjusted to be equal to the largest of all previous offset values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants