Re: [heycam/webidl] Replace serializers by toJSON and [Default] extended attribute (#323)

tobie commented on this pull request.



> +
+    To invoke the <dfn>collect attribute values</dfn> abstract operation
+    with [=stack=] |stack| and [=ordered map=] |map| as arguments,
+    run the the following steps:
+
+    1.  Let |I| be the result of invoking [=stack/pop=] from |stack|.
+    1.  [=list|For each=] [=implements statements=] where the left-hand side [=identifier=] references |I|:
+        1.  Let |rhs| be the [=interface=] represented by the right-hand side [=identifier=].
+        1.  Let |interfaces| be the result of [=create an inheritance stack|creating an inheritance stack=]
+            for [=interface=] |rhs|.
+        1.  invoke [=collect attribute values=], passing it |interfaces| and |map|.
+    1.  If a “toJSON” operation with a [{{Default}}] [=extended attribute=] is declared on |I|, then
+        [=list|for each=] [=exposed=] [=regular attribute=] |attr|
+        that is an [=interface member=] of |I|, in order:
+        1.  Let |id| be the [=identifier=] of |attr|.
+        1.  Let |value| be the underlying value of |attr|.

Would adding something like the below in [§2.2.2 Attributes](https://heycam.github.io/webidl/#idl-attributes) do?

```
    To get the value of an [=attribute=] |attribute| declared in interface |I|,
    implemented by object |O|, run the following steps:

    1.  Let |R| be the result of performing the actions listed in the
        description of |attribute| that occur on getting
        (or those listed in the description of the inherited attribute,
        if this attribute is declared to [=inherit its getter=]),
        on |O| if |O| is not <emu-val>null</emu-val>. 
    1.  Return |R|.
```

How would you handle the "on |O| if |O| is not <emu-val>null</emu-val>" part keeping it in WebIDL, though? 


-- 
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/323#discussion_r116510991

Received on Monday, 15 May 2017 14:48:59 UTC