[webkit-dev] FW: Creating custom DOM events
Ross Lillie
ross.lillie at motorola.com
Wed Apr 8 09:19:15 PDT 2009
Thanks for the reply.
To clarify, it¹s the external process generating an event representing the
process¹ completion status that I want to dispatch into a DOM target. I
understand that I can simply add and event listener to a DOM element,
however if I want my custom event handler to be an attribute of a DOM
element, then I¹m assuming that I need to a) create a custom DOM attribute
that b) implements the EventTarget interface. My external code then
dispatches it¹s custom event to my custom attribute/eventTarget. This would
then allow my HTML markup to be of the form:
<div onMyExternalProcessComplete=function()>
I¹m not saying that this is necessarily the best way to accomplish this, but
am just trying to understand how everything is connected within the webkit
framework. However, if my understanding is correct, then what is the best
way to add a custom attribute/eventTarget into the DOM?
thanks again for the insights,
Ross
On 4/8/09 4:10 AM, "ZHOU Xiao-bo" <zhxb.ustc at gmail.com> wrote:
> " external code to be able to dispatch custom events "
> you mean that your c++ code can be triggered by a custom event or your code
> can
> generate a custom envent?
>
> if former, I think you should implement your own onxxx attribute, and add some
> eventlisteners;
> if latter, maybe you can add your own eventlistener to some node and create an
> event and call
> handlelocalevent
>
> 2009/4/8 Ross Lillie <ross.lillie at motorola.com>
>> 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
>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
------ End of Forwarded Message
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090408/211ea879/attachment.html>
More information about the webkit-dev
mailing list