This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I may have missed something but I initially read the ECMAScript bindings section for enumerations [1] and it said to throw a TypeError if the input value is not a valid value for this enumeration. However, I then noticed a Note in the non-ECMAScript enumeration section [2] that says we should only throw when converting operation arguments but NOT when assigning an attribute. If this is really the intended behavior for ECMAScript bindings, I think it would be worse specifying it in [1] instead of simply in a Note. [1] https://heycam.github.io/webidl/#es-enumeration [2] https://heycam.github.io/webidl/#idl-enums
I work on WebKit and looking at our ECMAScript bindings, it seems that we behave as indicated in the Note: """ Note In the ECMAScript binding, assignment of an invalid string value to an attribute is ignored, while passing such a value as an operation argument results in an exception being thrown. """
This behavior is specified in https://heycam.github.io/webidl/#dfn-attribute-setter step 4 which doesn't invoke https://heycam.github.io/webidl/#es-enumeration at all but instead uses a slightly different algorithm. So https://heycam.github.io/webidl/#es-enumeration is only invoked for operation arguments, dictionary members, sequence members, and so forth. I agree that it's a bit confusing to do it that way, but it avoids the problem of saying in https://heycam.github.io/webidl/#es-enumeration that the behavior depends on "where it's called from", which is a bit hard to define precisely.
(In reply to Boris Zbarsky from comment #2) > This behavior is specified in > https://heycam.github.io/webidl/#dfn-attribute-setter step 4 which doesn't > invoke https://heycam.github.io/webidl/#es-enumeration at all but instead > uses a slightly different algorithm. So > https://heycam.github.io/webidl/#es-enumeration is only invoked for > operation arguments, dictionary members, sequence members, and so forth. > > I agree that it's a bit confusing to do it that way, but it avoids the > problem of saying in https://heycam.github.io/webidl/#es-enumeration that > the behavior depends on "where it's called from", which is a bit hard to > define precisely. Ok, thank you. I assumed there was something I missed in the spec what I wanted to confirm. I think it is fine to leave as is then.