[css-houdini-drafts] [css-typed-om] Why does `get` return by reference and `getAll` by value?

bzbarsky has just created a new issue for https://github.com/w3c/css-houdini-drafts:

== [css-typed-om] Why does `get` return by reference and `getAll` by value? ==
If you compare https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get and https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getall the former returns a reference to the internal value.  The latter returns a copied list of references to internal values.

Concretely, say you have a `background-size` property that's a list of `cover`/`contain` keywords.  If you want to change one of the keywords in the list, you can `getAll('background-size')[0].value = "contain"`.  But if you want to change the length of the list, you need to end up doing https://www.w3.org/TR/css-typed-om-1/#dom-stylepropertymap-set as far as I can tell, right?

Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/721 using your GitHub account

Received on Friday, 2 March 2018 16:19:01 UTC