[whatwg] Canvas: dash list API
Anne van Kesteren
annevk at annevk.nl
Sat Dec 22 05:40:07 PST 2012
On Sat, Dec 22, 2012 at 2:12 PM, Cameron McCormack <cam at mcc.id.au> wrote:
> Does it need to inherit from Array? I think we can do this as long as the
> canvas context object does not need to "watch" the Array object for changes.
> (This is technically already possible by just using "object" as the type,
> and handling assignments of non-Array objects in the attribute definition.)
> We could have an Array type in Web IDL, which just means "a reference to an
> Array object" and which also doesn't do any type coercion when assigning to
> array elements or anything.
I think we want it to have the same operations as array, such as
push() and pop(), but have it restricted to the type given in IDL. And
assignment needs to update the underlying object so there would need
to be hooks for that too. And in particular for path segments more
normalization seems required, such as percent encoding "/".
So for all intents and purposes it would be an array, except that
modifying values would have pre-processing rules (e.g. type coercion
and percent encoding), and possible post-processing rules (updating
the URL object).
I guess dashList is somewhat simpler, but I think it would be nice if
it still did type coercion.
More information about the whatwg