[whatwg] Why CanvasRenderingContext2D uses WebIDL unrestricted float type?

Hi everybody.

I have a question about the definition of CanvasRenderingContext2D's behavior.

The current spec about CanvasRenderingContext2D says the following:

> Except where otherwise specified, for the 2D context interface,
> any method call with a numeric argument whose value is infinite
> or a NaN value must be ignored.
https://html.spec.whatwg.org/multipage/scripting.html#canvasrenderingcontext2d

But I think that, why don't  CanvasRenderingContext2D use restricted
float type defined in WebIDL if these methods ignore the value when
its is not finite?

By the current WebIDL spec
(http://heycam.github.io/webidl/#es-double), restricted values,
'float' & 'double', will raise TypeError in conversion phase under
ECMAScript environment if the passed value is a NaN or +-Infinity.

For the purpose to ignore non-restricted values, I feel that it's more
better to restrict by IDL type. So the definitions by the current spec
is for backward compatibility, or simply a spec issue?

Thanks.

-- 
Tetsuharu OHZEKI

Received on Tuesday, 24 March 2015 20:07:05 UTC