Skip to content

WebIDL: How to define an extended/inherited interface? #5457

Description

@rjksmith

I'm trying to define a new IDL interface that extends from an existing web interface.

interface MyInterface : WebInterface

The parent interface name does not resolve for HTML/DOM interfaces such as EventTarget or TextTrackCue, though this syntax does work if I substitute an interface defined within my own document.

I've not found an example of an inherited interface in the documentation and can't see how to resolve this issue. Please advise.

Example

In the following example, HTML TextTrackCue remains unresolved and causes an error.

    <section id='mycue-interface' data-dfn-for='MyCue'>
      <h2><dfn>MyCue</dfn> Interface</h2>
      <pre class='idl' title='MyCue Interface'>
        [Exposed=Window]
        interface MyCue : TextTrackCue {
          constructor(double startTime, unrestricted double endTime, any value);
          readonly attribute any value;
        };
      </pre>
      <dl>
        <dt>
          |cue| = new MyCue(startTime, endTime, value);
        </dt>
        <dd>
          Returns a new <a>MyCue</a> object.
        </dd>
        <dt>
          |cue|.<dfn>{{MyCue/value}}</dfn>
        </dt>
        <dd>
          Returns the value of a <a>MyCue</a> cue.
        </dd>
      </dl>
    </section>

Citing the parent interface as {{TextTrackCue}} doesn't fix the problem, and nor does adding pre class='idl no-link-warnings'. I'd welcome your guidance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions