csswg-drafts
csswg-drafts copied to clipboard
[css-shared-element-transitions-1] Should createDocumentTransition take an init dictionary or a callback
Currently the shared element transition spec says that createDocumentTransition (modulo any renames in #7788) should take a dictionary, with currently a single member: updateDOM.
Since updateDOM is a necessary, or at least a very commonly needed callback, should the signature instead be
createDocumentTransition(callback)
and then if needed we can extend that to createDocumentTransition(callback, initDictionary)
?
@jakearchibald
I have a mild preference for createDocumentTransition(callback, initDictionary)
. The non-optional parameter followed by an optional dictionary. This matches the element.animate(keyframes, options)
syntax too.
Related https://github.com/whatwg/webidl/issues/1191
Discussed this offline today and the conclusion was that createDocumentTransition(callback) is the simpler and preferable syntax. So proposed resolution: "createDocumentTransition takes a callback".
@jakearchibald if I'm reading the whatwg issue right, we want to make callback and dictionaries indistinguishable. So we'd eventually be able to change the API to take a dictionary and the existing code (which passes a callback) would still work. So the above resolution is good for when we eventually have more options to switch to a dictionary?