Re: Missing values in SVGPathElement API: What to do?

The document is in error if required attributes are not supplied.

I'm not sure where it says that, probably in the XML spec.

Here's the defined behaviour.

http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes


On Thu, Oct 24, 2013 at 11:33 AM, Stephen Chenney <schenney@chromium.org>wrote:

> 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
> unhelpful.
>
> 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.
>
> Stephen.
>



-- 
*Would be fair to suggest that perhaps Obama didn't lie when you clearly
saw his lips move?*
*
*

Received on Thursday, 24 October 2013 15:40:44 UTC