Re: Web IDL attributes and delegation

On 9/13/12 2:53 AM, Boris Zbarsky wrote:
> Ah, yes.  Then you do need some sort of delegation mechanism, if you
> want to filter access to the event object but not modify the event
> object itself.

Actually, let me just summarize the use case, if I may.  Please correct 
any parts that are wrong:

1)  You want to mediate access to a DOM object.
2)  You want to not modify the original DOM object.
3)  You don't care if all the methods and setters start to throw,
     because you're assuming only getters will be called.
4)  You want this mediation to not require lots of boilerplate [1]
5)  You want this to work as soon in the future as possible.

Is that about right?

-Boris

[1] Right now, you can in fact set up whatever delegation you want, in a 
browser implementing WebIDL or some semblance thereof by copying all the 
properties off the proto chain to your delegate, rebinding the 
getters/setters/methods to the actual object as you go, but swizzling 
the ones whose behavior you want to modify.  This does take a few lines 
of code, though.  Not many, all things considered.

Received on Thursday, 13 September 2012 02:09:47 UTC