[css-view-transitions] Making the callback param non-nullable #9460
In css-view-transitions, 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:
A nullable type is an IDL type constructed from an existing type (called the inner type) [...] The inner type must not be:
- [...]
- a flattened 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.
Activity