Re: [heycam/webidl] Investigate banning nullable enums (#213)

> https://drafts.csswg.org/web-animations/#dictdef-basecomputedkeyframe
>     https://drafts.csswg.org/web-animations/#dictdef-basepropertyindexedkeyframe
>     https://drafts.csswg.org/web-animations/#dictdef-basekeyframe
> 
> Yeah, this one is a bit weird. It might have been nicer to have an explicit "default" value or something... @birtles do you recall why null was picked here? I should have asked this in https://bugzilla.mozilla.org/show_bug.cgi?id=1429671...

We could have a "default" value, I guess. The reasoning at the time is mostly covered in https://github.com/w3c/csswg-drafts/issues/2072#issuecomment-349195346, where consistency with `offset`, which uses `null` for "auto"-like values, seems to be the main reason. (The second reason listed there concerns whether we represent auto-values by lack of a value or an explicit sentinel value--but either `null` or "default" would work for that).

That is you can write:

```js
elem.animate({
  backgroundColor: ['red', 'green', 'blue', 'orange', 'purple'],
  offset: [0, null, null, 0.95, 1],
}, 1000);
```

(where `null` means, "Calculate the offset for me").

So, it made sense that `composite` should use the same notation (where `null`
means, "Use the composite mode specified on the effect"):

i.e.

```js
elem.animate({
  backgroundColor: ['red', 'green', 'blue', 'orange', 'purple'],
  offset: [0, null, null, 0.95, 1],
  composite: ['replace', null, null, null, 'replace'],
}, 1000);
```

With a default value that would become:

```js
elem.animate({
  backgroundColor: ['red', 'green', 'blue', 'orange', 'purple'],
  offset: [0, null, null, 0.95, 1],
  composite: ['replace', 'auto', 'auto', 'auto', 'replace'],
}, 1000);
```

Which could work.

We haven't shipped composite modes in any browser but we are planning to ship
`getKeyframes()` in Firefox 63 which exposes `BaseComputedKeyframe`, i.e. will
return objects with `composite` set to `null`. However we'd still be in time to
change this if we want to.

-- 
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/213#issuecomment-411587572

Received on Wednesday, 8 August 2018 23:35:28 UTC