- From: Domenic Denicola <notifications@github.com>
- Date: Fri, 24 Jan 2020 11:26:53 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/pull/836/c578266974@github.com>
I'm not 100% happy with how the hooks have turned out here, both for spec authors and for web developers using the constructor.
Here are some potential models:
* Two hooks, `before(value, index)` and `after(value, index)`, which get undefined for deletions.
* 6 hooks, `{before,after}Add(newValue, newIndex)`, `{before,after}Replace(newValue, index, oldValue)`, {before,after}Delete(oldValue, index)`.
* 4 hooks, `{before,after}Update(newValue, index)`, `{before,after}Delete(oldValue, index)`. (update = add or replace)
* 4 hooks, `{before,after}Add(newValue, newIndex)`, `{before,after}Delete(oldValue, index)`. This replacements as a delete then add.
* Variations of the above where all the after hooks are consolidated into one no-argument hook, on the assumption that specs and code will just iterate the new list contents.
I'm not sure what would be best. The `adoptedStyleSheets` case needs the `beforeAdd` hook only, for validation. (It doesn't need any after hooks, at least in the spec, since it can just say that the DocumentOrShadowRoot's adopted stylesheets are its `adoptedStyleSheetAttribute`'s backing observable array contents. But implementations would probably benefit from all of them.)
--
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/pull/836#issuecomment-578266974
Received on Friday, 24 January 2020 19:26:55 UTC