[css3-regions] Improve the NamedFlow JS interface

The current NamedFlow interface seems very DOM0-y.  This isn't a good
thing.  Here's the current interface:

[Supplemental] interface Document {
  NamedFlow getFlowByName(DOMString name);
  NamedFlowCollection getNamedFlows();
};
interface NamedFlowCollection {
   readonly attribute unsigned long length;
   caller getter NamedFlow item (in unsigned long index);
};

This would be *much* better exposed as a simple map of names to flows,
something like the following:

document.namedFlows
 Returns a NamedFlowMap object for the Document representing the current
CSS named flows (created by the 'flow-into' CSS property)

interface NamedFlowMap {
 getter Element (DOMString name);
};

The *supported property names* on a NamedFlowMap object at any instant are
the names for each named flow in the document at that instant.

To *determine the value of a named property name* in a NamedFlowMap, the
user agent must return the NamedFlow object with the given name in the
document.

(Keep the current NamedFlow interface the same.)

This version is much easier to use - if you have something like "flow-into:
my-flow;" in the document, you can access it with
"document.namedFlows['my-flow']".  Additionally, you can automatically
enumerate the flows (this is specified in WebIDL), so you don't need to
know the names ahead of time - just inspect the object, or use a for-in
loop.

~TJ

Received on Tuesday, 7 February 2012 11:10:46 UTC