I have external C++ code that I'm exposing to the JavaScript runtime. I'd also like my external code to be able to dispatch custom events via the DOM event mechanism. For example <element onMyCustomEvent=function() {}> Now, if I'm beginning to understand Webkit (which is doubtful) it seems that I need to somehow create a new attribute node that's wired to my external code and serves as the EventTarget for event dispatches. I.e. somewhat similar to how this is described for Mozilla/Gecko The public interfaces in WebKit don't appear to provide the functionality I need. The private interfaces in WebCore appear that they might. Am I on the right track? If so, how are new elements added to the DOM? Is this the function of the NamedNodeMap, or am I completely lost in my understanding? Also, I'm assuming any custom event must also be registered somewhere. Thanks in advance for any insight or pointers to more information. Ross
On 08.04.2009, at 3:10, Ross Lillie wrote:
<element onMyCustomEvent=function() {}>
The public interfaces in WebKit don't appear to provide the functionality I need. The private interfaces in WebCore appear that they might. Am I on the right track?
WebCore internal methods are subject to frequent changes, so calling them directly is not recommended. You can avoid the need to do add the custom attribute by not using it, and registering the event handler via element.addEventListener() in your JavaScript code. - WBR, Alexey Proskuryakov
participants (2)
-
Alexey Proskuryakov
-
Ross Lillie