Re: [heycam/webidl] Editorial: simplify the example on default toJSON() (#980)

@TimothyGu commented on this pull request.



> @@ -12088,29 +12088,17 @@ A [=regular operation=] that does not [=have default method steps=] must not be
     1.  Return |stack|.
 </div>
 
-<div class=example id=example-tojson-default-inheritance-and-mixins>
+<div class=example id=example-tojson-default-inheritance>

Add an `oldids`?

> -          [Default] object toJSON();
-          attribute DOMString m2;
-        };
-
-        interface mixin M3 {
-          attribute DOMString m3;
-        };
-
-        interface mixin M4 {
-          attribute DOMString m4;
-        };
-
-        A includes M1;
-        A includes M2;
-        B includes M3;
-        C includes M4;

While I agree the original example was way too complicated, I do think a short and sweet example showing `[Default] toJSON()` in an interface mixin would be helpful to implementers, so that they don't miss that case.

Maybe create a new interface to avoid mixing up with the existing hierarchy?

```webidl
        [Exposed=Window]
        interface D {
          attribute DOMString d;
        };

        interface mixin M {
          [Default] object toJSON();
          attribute DOMString m;
        };

        D includes M;
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/980#pullrequestreview-643745442

Received on Saturday, 24 April 2021 03:01:47 UTC