Dictionaries in WebIDL

Hi,

I'm trying to express in WebIDL an interface with a string attribute
"uri", and a string-string dictionary "options" that has no
restrictions on the keys.

In JS this would be something like this as a literal:

{
 uri: "",
 options: {}
}

Now I came up with the following WebIDL:

 /* arbitrary key-value hints */
 dictionary Options {};

 [Constructor]
 interface Item {
   attribute DOMString uri;
   attribute Options options;
 };

Which seems reasonable to me but the specification says "Dictionaries
must not be used as the type of an attribute, constant or exception
field".  Maybe I'm misreading the spec but doesn't this make my IDL
invalid?  Is there a better way of expressing what I want?

Related: is there a good tutorial/annotated reference/set of examples
for WebIDL?  The spec is quite... concise and isn't that great for
learning from. :)

Thanks,
Ross

Received on Friday, 7 October 2011 12:46:40 UTC