W3C home > Mailing lists > Public > www-style@w3.org > February 2012

[css3-regions] Improve the NamedFlow JS interface

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 7 Feb 2012 03:06:15 -0800
Message-ID: <CAAWBYDBGgwUFDb2dQRdduh6mqV7tdWGog2Q_1dNXjdNdwQ4YPA@mail.gmail.com>
To: www-style list <www-style@w3.org>
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

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:10 UTC