[webkit-dev] Creating custom DOM events

Ross Lillie ross.lillie at motorola.com
Tue Apr 7 16:10:00 PDT 2009


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




More information about the webkit-dev mailing list