[csswg-drafts] [css-view-transitions] Making the callback param non-nullable (#9460)

vmpstr has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-view-transitions] Making the callback param non-nullable ==
In [css-view-transitions](https://drafts.csswg.org/css-view-transitions-1/#additions-to-document-api), we define the following, an optional nullable callback with the default value of null:
```
partial interface Document {
  ViewTransition startViewTransition(optional UpdateCallback? updateCallback = null);
};
```

In #8960 we resolved to change the callback (in Level 2) to take either a callback or a dictionary of options. Naively, this would have been the following
```
ViewTransition startViewtransition(optional (UpdateCallback or Dictionary)? param = null)
```

But that's not possible because of the [following restriction](https://webidl.spec.whatwg.org/#idl-nullable-type):
> A nullable type is an IDL type constructed from an existing type (called the inner type) [...] The [inner type](https://webidl.spec.whatwg.org/#dfn-inner-type) must not be:
> * [...]
> * a [union type](https://webidl.spec.whatwg.org/#dfn-union-type) that itself [includes a nullable type](https://webidl.spec.whatwg.org/#dfn-includes-a-nullable-type) or has a dictionary type as one of its [flattened member types](https://webidl.spec.whatwg.org/#dfn-flattened-union-member-types).

A simple solution is to just make these non-nullable:
```
ViewTransition startViewtransition(optional (UpdateCallback or Dictionary) param)
```

Additionally, for consistency, it would be nice to make the existing view transition callback non nullable as well, while still remaining optional:
```
ViewTransition startViewtransition(optional UpdateCallback updateCallback)
```

I _believe_ the only script visible change here is that this would preclude `startViewTransition(null)` from being valid. I could be wrong though. If I'm right, then I think that's fine, since that doesn't seem like a correct use of this API.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9460 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 12 October 2023 00:10:47 UTC