ExampleInterface interface

exampleMethod()
Define exampleMethod here...
url
Define url here...

Here is how you link!

The ExampleInterface or the ExampleInterface.exampleMethod()

Or like this: exampleMethod - which uses data-link-for

This fake spec tried to exercise all aspects of WebIDL so as to do regression testing in this complex piece of code.

CUSTOM PARAGRAPH

Testing records

Linking to WebIDL spec

Section with definitions

TestInterface interface TestCBInterface interface TestDictionary dictionary TestEnum enum TestMixin mixin interface TestCallBack callback TestTypedef typedef

More linking

      // makes sure that types and identifiers are not confused
      interface SimilarlyNamed {
        attribute TestInterface testInterface;
        attribute TestCBInterface testCBInterface;
        attribute TestDictionary testDictionary;
        attribute TestEnum testEnum;
        attribute TestTypedef testTypedef;
        readonly maplike<SimilarlyNamed, SimilarlyNamed>;
      };
      TestInterface includes TestMixin;
      interface TestInterface {};
      callback interface TestCBInterface {};
      typedef (TestInterface or TestCBInterface) TestTypedef;
      callback TestCallBack = TestCallBack ();
      dictionary TestDictionary {};
      enum TestEnum { "value" };
      interface mixin TestMixin {
        attribute Bar bar;
      };
      interface Bar {};
      

SimilarlyNamed interface

testInterface attribute; testCBInterface attribute; testDictionary attribute; testEnum attribute; testTypedef attribute;

bar attribute of TestMixin

ull() is a method. Its overloaded form returns a SuperStar/

dataLtOverride()

ParenthesisTest

basic()...

ext()...

paramed()...

withName()...

named()...

dfnDoesNotLinkToAnything()...

noParens...

ParenthesisTest.fullyQualified()...

ParenthesisTest.fullyQualifiedNoParens ...

1 basic

2 basic()

3 basic

4 basic

noParens

noParens()

noParens

noParens

noParens()

this also links

test qualified

ParenthesisTest.fullyQualifiedNoParens

ParenthesisTest.fullyQualifiedNoParens()

fullyQualifiedNoParens()

fullyQualifiedNoParens

Bar interface

Unsupported

The following aspects of WebIDL are not currently supported and are not yet tested for:

Support for these features will likely be added later.

The following features are supposedly supported but actually buggy:

Things that still need to be done:

Interfaces

Basic interface.

        interface SuperStar {};
      

Interface with extended attribute.

        [Something, Constructor()] interface SuperStar {};
      

Interface with extended attribute and RHS identifier list.

        [Global=Window, Exposed=(Window,Worker)] interface SuperStar {};
      

Interface with inheritance.

        interface SuperStar : HyperStar {};
      

Partial interface .

        partial interface SuperStar {};
      

Callback interface .

        callback interface SuperStar {};
      

Interface mixin .

        interface mixin SuperStar {};
      
        partial interface mixin SuperStar {};
      
        interface DocInterface {};
        interface DocIsNotCaseSensitive {};
        interface UndocInterface {};
        namespace Afterglow {};
      

DocInterface is an interface and so is DoCiSnOtCaSeSeNsItIvE. Afterglow is a namespace.

Constructors

Constructors on interfaces

        [Something,
         Constructor,
         Constructor(boolean bar, sequence<double> foo, Promise<double> blah)]
        interface SuperStar {};
      
        [Constructor] interface SuperStar {};
      

NamedConstructors

NamedConstructors on interfaces

        [Something,
         NamedConstructor=Sun(),
         NamedConstructor=Sun(boolean bar, Date foo)]
        interface SuperStar {};
      

Constants

All constants and some type testing

        interface ConstTest {
          // 1
          const boolean test = true;
          // 2
          const byte bite = 8;
          // 3
          const octet eight = 7;
          // 4
          const short small = 42;
          // 5
          const unsigned short shortish = 250;
          // 6
          const long notSoLong = 99999;
          // 7
          const unsigned long somewhatLong = 9999999;
          // 8
          const long long veryLong = 9999999999999;
          // 9
          const unsigned long long soLong = 99999999999999999;
          // 10
          const float ationDevice = 4.2;
          // 11
          const unrestricted float buoy = 4.2222222222;
          // 12
          const double twice = 4.222222222;
          // 13
          const unrestricted double rambaldi = 47.0;
          // 14
          const short inf = Infinity;
          // 15
          const short mininf = -Infinity;
          // 16
          const short cheese = NaN;
          // 17
          [Something] const short extAttr = NaN;
        };
      

rambaldi is a constant and so are bite and this other thing.

Attributes

Basic attributes testing.

The Performance interface.

The performance attribute.

        interface AttrBasic {
          // 1
          attribute DOMString regular;
          // 2
          readonly attribute DOMString ro;
          // 2.2
          readonly attribute DOMString _readonly;
          // 2.5
          inherit attribute DOMString in;
          // 2.7
          stringifier attribute DOMString st;
          // 3
          [Something] readonly attribute DOMString ext;
          // 3.10.31
          attribute FrozenArray<DOMString> alist;
          // 4.0
          attribute Promise<DOMString> operation;
          // 5.0
          readonly attribute Performance performance;
        };
      

readonly and regular are attributes.

Operations

Basic operations testing.

        interface StringifierTest {
          stringifier StringPass ();
          stringifier StringNamedPass named ();
        };
      
        interface GetterTest {
          getter GetterPass ();
          getter GetterNamedPass named ();
        };
      
        interface SetterTest {
          setter SetterPass ();
          setter SetterNamedPass named ();
        };
      

performance() method.

        interface MethBasic {
          // 1
          undefined basic();
          // 2
          [Something] undefined ext();
          // 3
          unsigned long long ull(short s, short n);
          // 3.5
          SuperStar? ull();
          // 5
          getter float ();
          // 6
          getter float withName ();
          // 7
          setter undefined ();
          // 8
          setter undefined named ();
          // 9
          static Promise<RTCCertificate>  generateCertificate(AlgorithmIdentifier keygenAlgorithm);
          // 10
          stringifier DOMString identifier();
          // 11
          stringifier DOMString ();
          // 12
          stringifier;
          Promise<undefined> complete(optional PaymentComplete result = "unknown");
          Promise<undefined> another(optional  /*trivia*/  PaymentComplete result = "unknown");
          Performance performance();
        };
      

ull is a method. Its overloaded form returns a SuperStar/

iterable/maplike/setlike declarations

        interface Yukina {
          iterable<DOMString>;
        };

        interface Sayo {
          iterable<DOMString, DOMString>;
        };

        interface Kasumi {
          maplike<DOMString, DOMString>;
        };

        interface Arisa {
          setlike<DOMString>;
        };
      
        interface MapLikeInterface {
          maplike<MapLikeInterface, MapLikeInterface>;
        };
        interface ReadOnlyMapLike {
          readonly maplike<ReadOnlyMapLike, ReadOnlyMapLike>;
        };
        interface SetLikeInterface {
          setlike<SetLikeInterface>;
        };
        interface ReadOnlySetLike {
          readonly setlike<ReadOnlySetLike>;
        };
      

Yukina interface Sayo interface Kasumi interface Arisa interface MapLikeInterface interface ReadOnlyMapLike interface SetLikeInterface interface ReadOnlySetLike interface

Comments

        interface SuperStar {
          // This is a comment
          // over two lines.
          /* This one
             has
             three. */
          
        };
      

Dictionaries

Basic dictionary.

        dictionary SuperStar {};
      

Inheriting dictionary.

        dictionary SuperStar : HyperStar {};
      

Data in dictionary.

        dictionary SuperStar {
          // 1
          DOMString value;
          // 2
          DOMString? nullable;
          // 3
          [Something]float ext;
          // 4
          unsigned long long longLong;

          // 5
          boolean test = true;
          // 6
          byte little = 2;
          // 7
          byte big = Infinity;
          // 8
          byte cheese = NaN;
          // 9
          DOMString blah = "blah blah";
        };
      
        dictionary SuperStar {
          required DOMString value;
          DOMString optValue;
        };
      
        dictionary DictDocTest {
          DOMString dictDocField;
          DOMString? otherField;
          long undocField;
        };
      
        dictionary OneThing {
          int x;
        };


        partial dictionary AnotherThing {
          int y;
        };
      

DictDocTest contains dictDocField and otherField

Enumerations

Basic enumeration.

        enum EnumBasic {
          // 1
          "one",
          // 2
          "two"
          // 3
          , "three",

          // 4
          "white space"
        };
      

EnumBasic

one is first.

one is referenced with a [link-for] attribute.

white space

Enumeration with an empty string

EmptyEnum

""

...

not empty...

Multiple unique enums

        enum Test1 { "enum" };
        enum Test2 { "enum" };
      

enum enum

Callbacks

Basic callback.

        callback SuperStar = undefined();
      

Less basic callback.

        callback CbLessBasic = unsigned long long?(optional any value);
      

Callback with multiple arguments.

        callback SortCallback = undefined (any a, any b);
      

CbLessBasic

Typedefs

Basic typedef.

        typedef DOMString string;
      

Less basic typedef.

        typedef unsigned long long? tdLessBasic;
      

tdLessBasic

Typedef with an extended attribute.

        typedef ([Clamp] unsigned long or ConstrainULongRange) ConstrainULong;
      

Typedef with an extended attribute on union type.

        typedef [Clamp] (unsigned long or ConstrainULongRange) ConstrainULong2;
      
        /* test1 */ typedef /* test2 */ [Clamp] /* test3 */ (/* test4 */ unsigned long /* test5 */ or /* test6 */ ConstrainULongRange /* test7 */ ) /* test8 */ ConstrainULong3 /* test9 */;
      

Includes

Basic includes.

        Window includes Breakable;
      

Less basic includes.

        [Something]Window includes Breakable;
      

Documentation

        interface Documented {
          attribute DOMString docString;
          attribute DOMString notDefined;
          attribute DOMString definedElsewhere;
        };
      

docString is defined in a note.

Testing [link-for]: Some generic term isn't IDL. Some generic term also isn't part of Documented. docString is. notDefined is too, but isn't defined elsewhere.

Documented.definedElsewhere is defined by writing its fully-qualified name. Documented.docString is linked by writing its fully-qualified name.

IDL block with arbitrary CSS classes

        interface NotTested {};
      

Autolink to WebIDL spec for toJSON

        interface AutoLinkToIDLSpec {
          [Default] object toJSON();
        };
      

Autolink to WebIDL spec for toJSON with data-link-for

        interface AutoLinkToIDLSpecLinkFor {
          [Default] object toJSON();
        };
      

We can define our own toJSON()

        interface DefinedToJson {
          readonly attribute DOMString country;
          [Default] object toJSON();
          undefined toWhatever();
        };
      

toJSON() method

When toJSON() is called, run [[!WEBIDL]]'s default toJSON steps.

Optionals and trivia

        [Constructor(X x, optional Y y, /*trivia*/ Z y)]
        interface Foo {
          undefined foo(X x, optional Y y, /*trivia*/ optional Z z);
        };
        callback CallBack = Z? (X x, optional Y y, /*trivia*/ optional Z z);
      

CodedThings interface

        interface CodedThings {
          attribute DOMString definedElsewhere;
          attribute Bar barBar;
          undefined doTheFoo();
        };
        
doTheFoo() barBar

All these things surrounded by code elements

  1. CodedThings.definedElsewhere
  2. CodedThings.barBar
  3. barBar
  4. CodedThings.doTheFoo()
  5. CodedThings.doTheFoo
  6. doTheFoo()
  7. doTheFoo

It gives definitions the right idl type

          interface InterfaceType {
            readonly attribute DOMString attributeType;
            undefined operationType();
          };
          dictionary DictionaryType {
            DOMString fieldType;
          };
          enum EnumType {
            "enumValueType"
          };
        

InterfaceType attributeType operationType DictionaryType fieldType EnumType enumValueType