- From: Philip Taylor <excors+whatwg@gmail.com>
- Date: Wed, 16 May 2007 19:17:11 +0100
On 16/05/07, Darin Adler <darin at apple.com> wrote: > On May 15, 2007, at 6:36 PM, Ian Hickson wrote: > > >> For the graphics context functions that take floating point values, I > >> think the specification should say what the expected behavior is for: > >> > >> 1) NANs > >> 2) non-floating point values > >> 3) missing parameters > >> b) excess arguments > > > > 1, 3, and b now raise exceptions except if otherwise specified. I > > haven't > > yet defined 2. I'm not sure what it should say. > > I think that (2) should be the same as (1). I think it makes logical > sense and matches current implementations. I'm not sure how it should > be presented or worded. How is "non-floating point value" defined? Existing implementations seem to try converting the value into a JS number, which will always give a floating-point value, and that's just NaN if the conversion is not possible (e.g. from an object, or undefined, or a string that can't be parsed as a number). In that case, there aren't really non-floating point values at all - there are just values that get numberised into NaN before being passed to the canvas API and are then handled by case 1. http://canvex.lazyilluminati.com/misc/nonfloat.html sort of tests that (though it just checks for exceptions, not for whether strings are parsed into numbers properly) - it has no errors in Firefox (Minefield), and in Opera 9.20 it only has errors for unimplemented functions and for drawImage (bug?). > I think that for (b) we should specify ignoring the additional > parameters rather than raising an exception. That's more consistent > with the behavior of the JavaScript language in general, and I'm > pretty sure all existing implementations do this. http://canvex.lazyilluminati.com/misc/extra.html - Opera 9.20 ignores all additional parameters, and Firefox ignores them except for drawImage and for toDataURL (which is the one place where the spec explicitly says extra parameters must be allowed - but FF uses them for privileged content, and throws a security exception if normal content uses them). -- Philip Taylor excors at gmail.com
Received on Wednesday, 16 May 2007 11:17:11 UTC