Re: [heycam/webidl] Introduce the observable array type (#836)

Correct. So the spec author would need to track all such mutations and sync them back to their backing collection, which is not as convenient for cases like adoptedStyleSheets, where you want to instead replace the current spec text's

> The user agent must include all style sheets in the DocumentOrShadowRoot's adopted stylesheets inside its document or shadow root CSS style sheets.

with

> The user agent must include all style sheets in the DocumentOrShadowRoot's adoptedStyleSheet's attribute's backing observable array contents inside its document or shadow root CSS style sheets.

If you had to do this with the indexed setter, you'd have to convert each set into a manipulation of a backing list, and then have a sentence like the above that refers to the backing list.

Not a big deal, but a sharp edge.

(BTW, the examples of indexed setters I can find in the platform so far are https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-setter and https://svgwg.org/svg2-draft/types.html#ListInterfaces. It's interesting to contemplate how well they make use of the existing hooks.)

-- 
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-579426831

Received on Tuesday, 28 January 2020 19:56:38 UTC