- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 27 Jun 2013 09:58:26 -0700
- To: Cameron McCormack <cam@mcc.id.au>
- Cc: "public-script-coord@w3.org" <public-script-coord@w3.org>
On Thu, Jun 27, 2013 at 2:27 AM, Cameron McCormack <cam@mcc.id.au> wrote: > Tab Atkins Jr. wrote: >> I've gone ahead and started using some pretend syntax for this in >> <http://dev.w3.org/csswg/css-variables/#the-CSSVariablesMap-interface>: > > I've added most of this now: > > http://dev.w3.org/2006/webapi/WebIDL/#MapClass > http://dev.w3.org/2006/webapi/WebIDL/#es-map-members Awesome! >> [MapClass(DOMString, DOMString)] >> interface CSSVariablesMap { >> DOMString get(DOMString varName); >> boolean has(DOMString varName); >> void set(DOMString varName, DOMString varValue); >> DOMString delete(DOMString varName); >> } >> >> The [MapClass(keyType, valType, iteratorType?)] extended attribute >> takes two or three arguments. The first two specify the types >> required of its keys and values. The interface MUST define the "map >> tuples" for the interface, which consist of a unique key paired with a >> value. Unless manually defined in the interface, the entries(), >> keys(), and values() methods, and the .size attribute, are >> automatically defined in terms of the "map tuples". The third >> argument to the extended attribute defines which of the three is used >> for the @@iterator() method, and must be either "entries", "keys", >> "values", or omitted (which is the same as "entries"). > > I haven't added the iterator type argument to [MapClass] yet. Can you go > into some more detail about how that would work? It looks like that's not really necessary anyway, I suppose. I wasn't aware of WebIDL's existing "iterator" thing, which is sufficient for this. As long as [MapClass] things default to iterating with .entries(), it's fine. > The spec needs a bunch of updating for iterators defined by @@iterator > anyway. > > Please have a look at the new text and let me know if there are any issues. Looks great so far! ~TJ
Received on Thursday, 27 June 2013 16:59:13 UTC