[Bug 20299] New: [Custom]: Extensions to the document interface are not valid WebIDL

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20299

            Bug ID: 20299
           Summary: [Custom]: Extensions to the document interface are not
                    valid WebIDL
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: bzbarsky@mit.edu
        QA Contact: public-webapps-bugzilla@w3.org
            Blocks: 14968

The spec draft says:

  partial interface Document { 
    Function register(DOMString name, optional Options options);
  } 
  dictionary Options { 
    object? prototype; 
    DocumentFragment? template; 
    LifecycleCallbacks? lifecycle; 
  }
  dictionary LifecycleCallbacks {
     void created(); 
  }

There are a bunch of issues here:

1) There need to be semicolons between the toplevel things.
2) Putting a generic name like "Options" in a flat namespace is a bit weird. 
It
   needs a name that's less likely to be confusing to people and less likely to
   cause collisions.
3) "optional" is not valid on dictionary arguments.  They're always optional,
so
   adding it gives you a parse error.
4) LifecycleCallbacks is presumably meant to be a callback interface, not a
   dictionary right?  But did you really want to use a callback interface here,
   not a callback function?
5) There seems to be some confusion in the prose that follows because it only
   talks about what to do if "prototype" is missing, say, not what to do if
   it's null.  Strictly speaking, the current spec says to throw if it's null,
   but then it makes no sense to declare it nullable in the dictionary.
6) Nothing says what should happen if "template" is missing.
7) Nothing says what should happen if "callbacks" are missing.

In any case, something like this might be more what you meant:

  callback ElementConstructor = Element();
  partial interface Document { 
    ElementConstructor register(DOMString name,
                                ElementRegistrationOptions options);
  };
  dictionary ElementRegistrationOptions { 
    object? prototype = null; 
    DocumentFragment? template = null; 
    LifecycleCallbacks? lifecycle = null; 
  };
  callback interface LifecycleCallbacks {
     void created(); 
  };

and then you don't have to worry about missing optional things, only null ones.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Saturday, 8 December 2012 02:01:54 UTC