[heycam/webidl] Does `TreatNullAs` apply to `DOMString` inside a union type? (#441)

Assume something like:

```
attribute [TreatNullAs=EmptyString] (DOMString or SomeObjectType) thing;
```

Does the `TreatNullAs` annotation mean that `obj.thing = null` results in the assignment of `""`? Or does the normal behavior of stringifying `null` to `"null"` kick in?

On IRC, @annevk noted that https://heycam.github.io/webidl/#es-union has "[includes a nullable type](https://heycam.github.io/webidl/#dfn-includes-a-nullable-type)", which talks about [annotated types](https://heycam.github.io/webidl/#annotated-types), which suggests that a nullable inner type would make the union type nullable. But `TreatNullAs` doesn't say one way or the other whether it makes the underlying `DOMString` nullable.

For https://github.com/mikewest/trusted-types, I think I'd like the `""` behavior rather than the `"null"` behavior, as it would make the whole thing simpler to layer on top of the existing web.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/441

Received on Tuesday, 19 September 2017 08:44:22 UTC