Re: WebIDL Dictionaries

Hi Anssi,

On Sep 7, 2011, at 19:09 , Anssi Kostiainen wrote:
> Would it possible for the dictionary to show up within the same WebIDL block with other definitions? Currently it is wrapped within its own WebIDL block (or am I doing it wrong?), see:
> 
>  http://dev.w3.org/2009/dap/system-info/battery-status.html#batterystatusevent-interface
> 
> Some specs which do not use ReSpec.js but do use dictionaries seem to include dictionary within the same WebIDL block with other definitions which depend on it, e.g.:
> 
>  http://dev.w3.org/2006/webapi/progress/#interface-progressevent
> 
> I may try to get my hands dirty and hack with ReSpec.js myself, but I'm asking here first in case you have a preference because you're Mr. ReSpec.js :)

I can see how this is indeed nice, but given the way in which WebIDL support is implemented in ReSpec v1 it's a change I'd rather not make myself (the code is a mindless pile of horror). Supporting it in v2, which uses a proper WebIDL parser and templates in order to render it (or at least is getting there) would be easier, but I wouldn't advise switching to that for a mature spec such as Battery.

If you feel like hacking this in, here's what I'd do:

    0) Don't try to support this in the WebIDL code. Instead, make it as a step that runs *after* WebIDL and moves the right parts of the DOM around.
    1) Figure out a way to specify that a given IDL construct will merge one or more others into itself, e.g. data-merge="BatteryStatusEventInit OtherDictionary YetAnother" on the <dl> defining the interface.
    2) Grab the generated IDL for each dictionary to be merged, append it to the interface IDL.
    3) Grab the "Members" section for the dictionary, and append it after the Attributes, Methods, etc. sections (maybe rename it to "Dictionary Foo Members" for clarity).
    4) Kill the original dictionary section (this may lose some content, you could add what's left to the Member section.
    5) You should be good, everything else (e.g. definitions linking, section numbering) should just work. Don't blame me if you spend the night on it ;)

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Wednesday, 7 September 2011 19:22:23 UTC