Re: [heycam/webidl] Added a definition of {{StringContext}} extended attribute. (#841)

bzbarsky commented on this pull request.



> @@ -10496,6 +10504,40 @@ that does specify [{{SecureContext}}].
     </pre>
 </div>
 
+<h4 id="StringContext" extended-attribute lt="StringContext">[StringContext]</h4>
+
+If the [{{StringContext}}] [=extended attribute=] appears on {{DOMString}} or {{USVString}}, it
+modifies how the value is converted to the IDL type, causing additional value validation to
+adhere to the context the string is used in.
+
+The [{{StringContext}}] extended attribute must [=takes an identifier|take an identifier=]. The [=identifier=]
+must be one of "<code>html</code>", "<code>script-url</code>" and "<code>script</code>".
+
+A type annotated with the [{{StringContext}}] extended attribute must not appear in a construct
+that is not a [=regular attribute=] or a [=regular operation=]. A type annotated with the [{{StringContext}}]

Though again, at that point it could in theory also just happen at the top of the operation steps instead of intertwined with the other argument conversions, in which case it would not need any IDL hooks at all.  It's not clear to me which is easier or harder to reason about and implement in practice, or if there's a practical difference between them. 

All this assuming I now understand the proposal correctly...

-- 
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/841#discussion_r379283500

Received on Friday, 14 February 2020 07:28:44 UTC