- From: Harald Alvestrand <harald@alvestrand.no>
- Date: Thu, 12 Jan 2012 14:50:03 +0100
- To: Cameron McCormack <cam@mcc.id.au>
- CC: Arthur Barstow <art.barstow@nokia.com>, public-script-coord <public-script-coord@w3.org>
On 01/12/2012 02:08 PM, Cameron McCormack wrote: > 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 <http://dev.w3.org/2006/webapi/WebIDL/#dfn-attribute>is >> ignored, while passing such a value as anoperation >> <http://dev.w3.org/2006/webapi/WebIDL/#dfn-operation>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. Thanks! Anne, are you on this list? (don't know if my posting makes this list, since it's another list I'm likely not a member of). Does "ignored" in this case mean that the attribute retains its previous value? This seems to me to be likely to lead to hard-to-debug errors, or "set-and-test" type programming - but I'm not an experienced DOM programmer... Harald
Received on Thursday, 12 January 2012 13:50:43 UTC