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

> I feel like I'm missing something, but would something like [TrustedTypeCallbacks] TrustedHTML or [TrustedTypeCallbacks] DOMString not preserve doing callbacks at IDL time while also not requiring changes to strings?

The main problem with this solution is that it's a union type. This means that, like all union types, specification writers need to branch on which type they recieved. So specification writers need to write something like:

1. If _arg_'s type is `[TrustedTypeCallbacks] TrustedHTML`, then extract the string (somehow) and use it.
1. If _arg_'s type is `[TrustedTypeCallbacks] DOMString`, then use the string directly.

The desired experience, by using `[StringContext=html] DOMString`, is to remove this branching, and let spec authors say

1. Use _arg_ as a string.

-- 
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#issuecomment-590989370

Received on Tuesday, 25 February 2020 18:06:06 UTC