csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-shared-element-transitions-1] Should createDocumentTransition take an init dictionary or a callback

Open vmpstr opened this issue 2 years ago • 2 comments

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

vmpstr avatar Oct 04 '22 20:10 vmpstr

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.

khushalsagar avatar Oct 11 '22 20:10 khushalsagar

Related https://github.com/whatwg/webidl/issues/1191

jakearchibald avatar Oct 12 '22 06:10 jakearchibald

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?

khushalsagar avatar Oct 20 '22 23:10 khushalsagar