Re: [css-regions] Reworking getNamedFlows()

On Mon, Jul 29, 2013 at 6:46 AM, Mihnea-Vlad Ovidenie <> wrote:
> François REMY <> wrote:
>> I would prefer getNamedFlows() to return a [MapLike] object instead of this
>> hybrid collection with getters.
> This is something that was brought in the past (1).  At this moment, the
> NamedFlowsCollection interface is modeled to resemble the HTMLCollection
> interface.
> Previous discussions on NamedFlowsCollection can be found at [2] and [3].

HTMLCollection is a legacy interface and is not meant to be emulated.
TC39 warns against designing "catch-all" object interfaces like this,
for the precise reasons that François outlines: you can't have
language-defined methods or attributes on the object or its prototypes
without either risking them being overwritten by user code, or
explicitly preventing user code from overriding them.  Both are bad
when we have ways to avoid them, and the latter is a future-compat
hazard.  Further, they don't play nicely with the newer iterator-based
things in JS.

This is precisely why I proposed [MapLike] and WebIDL and got it added.

>> My main reason not to like it is that it causes issues when some flow is
>> named "length" or "item" because developers expect
>> document.getNamedFlows()[flowName] to return the flow, which it doesn't.
> Does the HTMLCollection interface have the same issue?

It has lots of issues.  ^_^


Received on Monday, 29 July 2013 16:31:12 UTC