Re: [WebIDL] Worry on Enum type - binding seems inconsistently defined

Hi Harald.

Arthur Barstow:
> Hi Cameron, All - would you please respond to the question below about
> Web IDL? -Thanks, AB

Tab is right, I haven't been monitoring mailing lists as closely this 
week. :)

Harald Alvestrand:
> However, one detail makes the spec at this time a bit hard to
> understand: In section 3.5, the following is said:
> Note
> In the ECMAScript binding, assignment of an invalid string value to
> anattribute <>is
> ignored, while passing such a value as anoperation
> <>argument results in
> an exception being thrown.
> However, in the ECMAScript binding, section 4.2.18, it says:
> An ECMAScript value V is converted to an IDL enumeration type value as
> follows (where E is the enumeration):
> 1. Let S be the result of calling ToString(V).
> 2. If S is not one of E’s enumeration values, then throw a TypeError.
> 3. Return the enumeration value of type E that is equal to S.
> I'm not sure it says the same thing; more clarity on the expected
> behaviour would be useful.
> (My personal opinion is that it's most useful if assigment throws an
> exception; silent failure is rarely the best option.)

The current behaviour is that invalid enumeration values when assigned 
to attributes are ignored, whereas when they're passed to operations 
they cause an exception to be thrown.  This was done at Anne's request, 
and the reasoning given was that that's the way the various HTML DOM 
properties tend to work.



Received on Thursday, 12 January 2012 13:08:49 UTC