W3C home > Mailing lists > Public > www-svg@w3.org > October 2013

Missing values in SVGPathElement API: What to do?

From: Stephen Chenney <schenney@chromium.org>
Date: Thu, 24 Oct 2013 11:33:13 -0400
Message-ID: <CAObCcUrtRXSga+SYgO-GSY2k_3=6NnF34ntr5A+Q1Wy4HuSXJg@mail.gmail.com>
To: "www-svg@w3.org" <www-svg@w3.org>
I just came across some undefined behavior in the spec that could easily be
defined. An example is the
http://www.w3.org/TR/SVG/paths.html#InterfaceSVGPathElement spec. It has
absolutely nothing to say about cases where the calling script does not
provide all of the necessary parameters. I could find no blanket statement
in the spec about what to do in such cases. The canvas spec is similarly

e.g. what to do with
pathSegment = pathElement.createSVGPathSegCurvetoCubicAbs(1.0)

Logical choices are either throw an exception or zero the missing values.

Right now Chromium, and presumably WebKit, pass NaN through to the back
end, which is bad and which I plan to somehow fix. I haven't checkout other
browsers yet.

The question is, what fix?
1) Exception and return null object
2) Exception but fill missing values with 0
3) Silently fill in missing values with 0.

I'm liking 1 right now.

Regardless of which option we choose, I think it would be helpful to have a
generic statement about this situation somewhere in the spec.

Received on Thursday, 24 October 2013 15:33:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:46 UTC