Le 31/01/2013 19:12, François REMY a écrit :
In this instance, it's possible for you as a polyfill author to replace
Element.prototype.style by your own getter which returns your special
proxy objects which do what you expect on property set.
For the style case, it's *maybe* possible to do so (in a WebIDL compatible 
browser at least, not sure it would work on Chrome for example).
hmm... we're sidetracking a bit but Chrome doesn't have proxies, so you can't polyfill what you want anyway. By the time Chrome does have proxies, maybe its WebIDL conformance will be better.

For the dispatchEvent/addEventListener case, it's possible for you to
override these methods (and maybe the Proxy constructor?) to accept
proxies the way you want them to.
How would I do so? It seems impossible to me, or at least very tedious. Do not 
forget that the browser itself will add event handlers on objects via Web 
Components, Decorators, HTML Attributes, ...
I'm not familiar with this.
Do you have links to spec saying that the browser adds native event handlers?

A point I hadn't answered:
The problem is that in the case of polyfilling you can't be sure the browser 
will think about proxy usage when they first implement the API then you're out 
of luck.
The best that can be done here is contact the DOM Core people (that's where events are now apparently), and ask them to specifically say they accept proxies in dispatchEvent. Then, write test cases, file (or fix) bugs in browsers in case some tests fails. Nothing better can be done I think.

David
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to