mshtml: Added document keydown, keyup, dragstart and selectstart event implementation.
[wine/multimedia.git] / dlls / mshtml / htmlevent.c
blobc12bc89f4149f1c6dfdb03001968479ed816a9d1
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
29 #include "htmlevent.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 struct event_target_t {
36 IDispatch *event_table[EVENTID_LAST];
39 static const WCHAR blurW[] = {'b','l','u','r',0};
40 static const WCHAR onblurW[] = {'o','n','b','l','u','r',0};
42 static const WCHAR changeW[] = {'c','h','a','n','g','e',0};
43 static const WCHAR onchangeW[] = {'o','n','c','h','a','n','g','e',0};
45 static const WCHAR clickW[] = {'c','l','i','c','k',0};
46 static const WCHAR onclickW[] = {'o','n','c','l','i','c','k',0};
48 static const WCHAR dragW[] = {'d','r','a','g',0};
49 static const WCHAR ondragW[] = {'o','n','d','r','a','g',0};
51 static const WCHAR dragstartW[] = {'d','r','a','g','s','t','a','r','t',0};
52 static const WCHAR ondragstartW[] = {'o','n','d','r','a','g','s','t','a','r','t',0};
54 static const WCHAR focusW[] = {'f','o','c','u','s',0};
55 static const WCHAR onfocusW[] = {'o','n','f','o','c','u','s',0};
57 static const WCHAR keydownW[] = {'k','e','y','d','o','w','n',0};
58 static const WCHAR onkeydownW[] = {'o','n','k','e','y','d','o','w','n',0};
60 static const WCHAR keyupW[] = {'k','e','y','u','p',0};
61 static const WCHAR onkeyupW[] = {'o','n','k','e','y','u','p',0};
63 static const WCHAR loadW[] = {'l','o','a','d',0};
64 static const WCHAR onloadW[] = {'o','n','l','o','a','d',0};
66 static const WCHAR mousedownW[] = {'m','o','u','s','e','d','o','w','n',0};
67 static const WCHAR onmousedownW[] = {'o','n','m','o','u','s','e','d','o','w','n',0};
69 static const WCHAR mouseoverW[] = {'m','o','u','s','e','o','v','e','r',0};
70 static const WCHAR onmouseoverW[] = {'o','n','m','o','u','s','e','o','v','e','r',0};
72 static const WCHAR mouseupW[] = {'m','o','u','s','e','u','p',0};
73 static const WCHAR onmouseupW[] = {'o','n','m','o','u','s','e','u','p',0};
75 static const WCHAR pasteW[] = {'p','a','s','t','e',0};
76 static const WCHAR onpasteW[] = {'o','n','p','a','s','t','e',0};
78 static const WCHAR selectstartW[] = {'s','e','l','e','c','t','s','t','a','r','t',0};
79 static const WCHAR onselectstartW[] = {'o','n','s','e','l','e','c','t','s','t','a','r','t',0};
81 typedef struct {
82 LPCWSTR name;
83 LPCWSTR attr_name;
84 DWORD flags;
85 } event_info_t;
87 #define EVENT_DEFAULTLISTENER 0x0001
88 #define EVENT_BUBBLE 0x0002
90 static const event_info_t event_info[] = {
91 {blurW, onblurW, EVENT_DEFAULTLISTENER},
92 {changeW, onchangeW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
93 {clickW, onclickW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
94 {dragW, ondragW, 0},
95 {dragstartW, ondragstartW, 0},
96 {focusW, onfocusW, EVENT_DEFAULTLISTENER},
97 {keydownW, onkeydownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
98 {keyupW, onkeyupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
99 {loadW, onloadW, 0},
100 {mousedownW, onmousedownW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
101 {mouseoverW, onmouseoverW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
102 {mouseupW, onmouseupW, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
103 {pasteW, onpasteW, 0},
104 {selectstartW, onselectstartW, 0}
107 eventid_t str_to_eid(LPCWSTR str)
109 int i;
111 for(i=0; i < sizeof(event_info)/sizeof(event_info[0]); i++) {
112 if(!strcmpW(event_info[i].name, str))
113 return i;
116 ERR("unknown type %s\n", debugstr_w(str));
117 return EVENTID_LAST;
120 typedef struct {
121 DispatchEx dispex;
122 const IHTMLEventObjVtbl *lpIHTMLEventObjVtbl;
124 LONG ref;
126 HTMLDOMNode *target;
127 } HTMLEventObj;
129 #define HTMLEVENTOBJ(x) ((IHTMLEventObj*) &(x)->lpIHTMLEventObjVtbl)
131 #define HTMLEVENTOBJ_THIS(iface) DEFINE_THIS(HTMLEventObj, IHTMLEventObj, iface)
133 static HRESULT WINAPI HTMLEventObj_QueryInterface(IHTMLEventObj *iface, REFIID riid, void **ppv)
135 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
137 *ppv = NULL;
139 if(IsEqualGUID(&IID_IUnknown, riid)) {
140 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
141 *ppv = HTMLEVENTOBJ(This);
142 }else if(IsEqualGUID(&IID_IHTMLEventObj, riid)) {
143 TRACE("(%p)->(IID_IHTMLEventObj %p)\n", This, ppv);
144 *ppv = HTMLEVENTOBJ(This);
145 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
146 return *ppv ? S_OK : E_NOINTERFACE;
149 if(*ppv) {
150 IUnknown_AddRef((IUnknown*)*ppv);
151 return S_OK;
154 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
155 return E_NOINTERFACE;
158 static ULONG WINAPI HTMLEventObj_AddRef(IHTMLEventObj *iface)
160 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
161 LONG ref = InterlockedIncrement(&This->ref);
163 TRACE("(%p) ref=%d\n", This, ref);
165 return ref;
168 static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
170 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
171 LONG ref = InterlockedDecrement(&This->ref);
173 TRACE("(%p) ref=%d\n", This, ref);
175 if(!ref)
176 heap_free(This);
178 return ref;
181 static HRESULT WINAPI HTMLEventObj_GetTypeInfoCount(IHTMLEventObj *iface, UINT *pctinfo)
183 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
184 FIXME("(%p)->(%p)\n", This, pctinfo);
185 return E_NOTIMPL;
188 static HRESULT WINAPI HTMLEventObj_GetTypeInfo(IHTMLEventObj *iface, UINT iTInfo,
189 LCID lcid, ITypeInfo **ppTInfo)
191 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
192 FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
193 return E_NOTIMPL;
196 static HRESULT WINAPI HTMLEventObj_GetIDsOfNames(IHTMLEventObj *iface, REFIID riid,
197 LPOLESTR *rgszNames, UINT cNames,
198 LCID lcid, DISPID *rgDispId)
200 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
201 FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
202 lcid, rgDispId);
203 return E_NOTIMPL;
206 static HRESULT WINAPI HTMLEventObj_Invoke(IHTMLEventObj *iface, DISPID dispIdMember,
207 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
208 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
210 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
211 FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
212 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
213 return E_NOTIMPL;
216 static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p)
218 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
220 TRACE("(%p)->(%p)\n", This, p);
222 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(This->target), &IID_IHTMLElement, (void**)p);
225 static HRESULT WINAPI HTMLEventObj_get_altKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
227 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
228 FIXME("(%p)->(%p)\n", This, p);
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLEventObj_get_ctrlKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
234 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
235 FIXME("(%p)->(%p)\n", This, p);
236 return E_NOTIMPL;
239 static HRESULT WINAPI HTMLEventObj_get_shiftKey(IHTMLEventObj *iface, VARIANT_BOOL *p)
241 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
242 FIXME("(%p)->(%p)\n", This, p);
243 return E_NOTIMPL;
246 static HRESULT WINAPI HTMLEventObj_put_returnValue(IHTMLEventObj *iface, VARIANT v)
248 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
249 FIXME("(%p)->()\n", This);
250 return E_NOTIMPL;
253 static HRESULT WINAPI HTMLEventObj_get_returnValue(IHTMLEventObj *iface, VARIANT *p)
255 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
256 FIXME("(%p)->(%p)\n", This, p);
257 return E_NOTIMPL;
260 static HRESULT WINAPI HTMLEventObj_put_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL v)
262 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
263 FIXME("(%p)->(%x)\n", This, v);
264 return E_NOTIMPL;
267 static HRESULT WINAPI HTMLEventObj_get_cancelBubble(IHTMLEventObj *iface, VARIANT_BOOL *p)
269 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
270 FIXME("(%p)->(%p)\n", This, p);
271 return E_NOTIMPL;
274 static HRESULT WINAPI HTMLEventObj_get_fromElement(IHTMLEventObj *iface, IHTMLElement **p)
276 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
277 FIXME("(%p)->(%p)\n", This, p);
278 return E_NOTIMPL;
281 static HRESULT WINAPI HTMLEventObj_get_toElement(IHTMLEventObj *iface, IHTMLElement **p)
283 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
284 FIXME("(%p)->(%p)\n", This, p);
285 return E_NOTIMPL;
288 static HRESULT WINAPI HTMLEventObj_put_keyCode(IHTMLEventObj *iface, long v)
290 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
291 FIXME("(%p)->(%ld)\n", This, v);
292 return E_NOTIMPL;
295 static HRESULT WINAPI HTMLEventObj_get_keyCode(IHTMLEventObj *iface, long *p)
297 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
298 FIXME("(%p)->(%p)\n", This, p);
299 return E_NOTIMPL;
302 static HRESULT WINAPI HTMLEventObj_get_button(IHTMLEventObj *iface, long *p)
304 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
305 FIXME("(%p)->(%p)\n", This, p);
306 return E_NOTIMPL;
309 static HRESULT WINAPI HTMLEventObj_get_type(IHTMLEventObj *iface, BSTR *p)
311 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
312 FIXME("(%p)->(%p)\n", This, p);
313 return E_NOTIMPL;
316 static HRESULT WINAPI HTMLEventObj_get_qualifier(IHTMLEventObj *iface, BSTR *p)
318 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
319 FIXME("(%p)->(%p)\n", This, p);
320 return E_NOTIMPL;
323 static HRESULT WINAPI HTMLEventObj_get_reason(IHTMLEventObj *iface, long *p)
325 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
326 FIXME("(%p)->(%p)\n", This, p);
327 return E_NOTIMPL;
330 static HRESULT WINAPI HTMLEventObj_get_x(IHTMLEventObj *iface, long *p)
332 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
333 FIXME("(%p)->(%p)\n", This, p);
334 return E_NOTIMPL;
337 static HRESULT WINAPI HTMLEventObj_get_y(IHTMLEventObj *iface, long *p)
339 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
340 FIXME("(%p)->(%p)\n", This, p);
341 return E_NOTIMPL;
344 static HRESULT WINAPI HTMLEventObj_get_clientX(IHTMLEventObj *iface, long *p)
346 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
347 FIXME("(%p)->(%p)\n", This, p);
348 return E_NOTIMPL;
351 static HRESULT WINAPI HTMLEventObj_get_clientY(IHTMLEventObj *iface, long *p)
353 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
354 FIXME("(%p)->(%p)\n", This, p);
355 return E_NOTIMPL;
358 static HRESULT WINAPI HTMLEventObj_get_offsetX(IHTMLEventObj *iface, long *p)
360 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
361 FIXME("(%p)->(%p)\n", This, p);
362 return E_NOTIMPL;
365 static HRESULT WINAPI HTMLEventObj_get_offsetY(IHTMLEventObj *iface, long *p)
367 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
368 FIXME("(%p)->(%p)\n", This, p);
369 return E_NOTIMPL;
372 static HRESULT WINAPI HTMLEventObj_get_screenX(IHTMLEventObj *iface, long *p)
374 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
375 FIXME("(%p)->(%p)\n", This, p);
376 return E_NOTIMPL;
379 static HRESULT WINAPI HTMLEventObj_get_screenY(IHTMLEventObj *iface, long *p)
381 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
382 FIXME("(%p)->(%p)\n", This, p);
383 return E_NOTIMPL;
386 static HRESULT WINAPI HTMLEventObj_get_srcFilter(IHTMLEventObj *iface, IDispatch **p)
388 HTMLEventObj *This = HTMLEVENTOBJ_THIS(iface);
389 FIXME("(%p)->(%p)\n", This, p);
390 return E_NOTIMPL;
393 #undef HTMLEVENTOBJ_THIS
395 static const IHTMLEventObjVtbl HTMLEventObjVtbl = {
396 HTMLEventObj_QueryInterface,
397 HTMLEventObj_AddRef,
398 HTMLEventObj_Release,
399 HTMLEventObj_GetTypeInfoCount,
400 HTMLEventObj_GetTypeInfo,
401 HTMLEventObj_GetIDsOfNames,
402 HTMLEventObj_Invoke,
403 HTMLEventObj_get_srcElement,
404 HTMLEventObj_get_altKey,
405 HTMLEventObj_get_ctrlKey,
406 HTMLEventObj_get_shiftKey,
407 HTMLEventObj_put_returnValue,
408 HTMLEventObj_get_returnValue,
409 HTMLEventObj_put_cancelBubble,
410 HTMLEventObj_get_cancelBubble,
411 HTMLEventObj_get_fromElement,
412 HTMLEventObj_get_toElement,
413 HTMLEventObj_put_keyCode,
414 HTMLEventObj_get_keyCode,
415 HTMLEventObj_get_button,
416 HTMLEventObj_get_type,
417 HTMLEventObj_get_qualifier,
418 HTMLEventObj_get_reason,
419 HTMLEventObj_get_x,
420 HTMLEventObj_get_y,
421 HTMLEventObj_get_clientX,
422 HTMLEventObj_get_clientY,
423 HTMLEventObj_get_offsetX,
424 HTMLEventObj_get_offsetY,
425 HTMLEventObj_get_screenX,
426 HTMLEventObj_get_screenY,
427 HTMLEventObj_get_srcFilter
430 static const tid_t HTMLEventObj_iface_tids[] = {
431 IHTMLEventObj_tid,
435 static dispex_static_data_t HTMLEventObj_dispex = {
436 NULL,
437 DispCEventObj_tid,
438 NULL,
439 HTMLEventObj_iface_tids
442 static IHTMLEventObj *create_event(HTMLDOMNode *target)
444 HTMLEventObj *ret;
446 ret = heap_alloc(sizeof(*ret));
447 ret->lpIHTMLEventObjVtbl = &HTMLEventObjVtbl;
448 ret->ref = 1;
449 ret->target = target;
450 IHTMLDOMNode_AddRef(HTMLDOMNODE(target));
452 init_dispex(&ret->dispex, (IUnknown*)HTMLEVENTOBJ(ret), &HTMLEventObj_dispex);
454 return HTMLEVENTOBJ(ret);
457 void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target)
459 IHTMLEventObj *prev_event, *event_obj = NULL;
460 nsIDOMNode *parent, *nsnode;
461 HTMLDOMNode *node;
462 PRUint16 node_type;
464 nsIDOMNode_GetNodeType(target, &node_type);
465 if(node_type != ELEMENT_NODE) {
466 FIXME("node type %d node supported\n", node_type);
467 return;
470 prev_event = doc->window->event;
471 nsnode = target;
472 nsIDOMNode_AddRef(nsnode);
474 while(1) {
475 node = get_node(doc, nsnode, FALSE);
477 if(node && node->event_target && node->event_target->event_table[eid]) {
478 if(!event_obj)
479 event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
481 TRACE("%s >>>\n", debugstr_w(event_info[eid].name));
482 call_disp_func(doc, node->event_target->event_table[eid], (IDispatch*)HTMLDOMNODE(node));
483 TRACE("%s <<<\n", debugstr_w(event_info[eid].name));
486 if(!(event_info[eid].flags & EVENT_BUBBLE))
487 break;
489 nsIDOMNode_GetParentNode(nsnode, &parent);
490 nsIDOMNode_Release(nsnode);
491 nsnode = parent;
492 if(!nsnode)
493 break;
495 nsIDOMNode_GetNodeType(nsnode, &node_type);
496 if(node_type != ELEMENT_NODE)
497 break;
500 if(nsnode)
501 nsIDOMNode_Release(nsnode);
503 if((event_info[eid].flags & EVENT_BUBBLE) && doc->event_target && doc->event_target->event_table[eid]) {
504 if(!event_obj)
505 event_obj = doc->window->event = create_event(get_node(doc, target, TRUE));
507 TRACE("doc %s >>>\n", debugstr_w(event_info[eid].name));
508 call_disp_func(doc, doc->event_target->event_table[eid], (IDispatch*)HTMLDOC(doc));
509 TRACE("doc %s <<<\n", debugstr_w(event_info[eid].name));
512 if(event_obj) {
513 IHTMLEventObj_Release(event_obj);
514 doc->window->event = prev_event;
518 static HRESULT set_event_handler_disp(event_target_t **event_target, HTMLDocument *doc, eventid_t eid, IDispatch *disp)
520 if(!*event_target)
521 *event_target = heap_alloc_zero(sizeof(event_target_t));
522 else if((*event_target)->event_table[eid])
523 IDispatch_Release((*event_target)->event_table[eid]);
525 (*event_target)->event_table[eid] = disp;
526 if(!disp)
527 return S_OK;
528 IDispatch_AddRef(disp);
530 if(event_info[eid].flags & EVENT_DEFAULTLISTENER) {
531 if(!doc->nscontainer->event_vector) {
532 doc->nscontainer->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
533 if(!doc->nscontainer->event_vector)
534 return E_OUTOFMEMORY;
537 if(!doc->nscontainer->event_vector[eid]) {
538 doc->nscontainer->event_vector[eid] = TRUE;
539 add_nsevent_listener(doc->nscontainer, event_info[eid].name);
543 return S_OK;
546 HRESULT set_event_handler(event_target_t **event_target, HTMLDocument *doc, eventid_t eid, VARIANT *var)
548 switch(V_VT(var)) {
549 case VT_NULL:
550 if(*event_target && (*event_target)->event_table[eid]) {
551 IDispatch_Release((*event_target)->event_table[eid]);
552 (*event_target)->event_table[eid] = NULL;
554 break;
556 case VT_DISPATCH:
557 return set_event_handler_disp(event_target, doc, eid, V_DISPATCH(var));
559 default:
560 FIXME("not supported vt=%d\n", V_VT(var));
561 return E_NOTIMPL;
564 return S_OK;
567 HRESULT get_event_handler(event_target_t **event_target, eventid_t eid, VARIANT *var)
569 if(*event_target && (*event_target)->event_table[eid]) {
570 V_VT(var) = VT_DISPATCH;
571 V_DISPATCH(var) = (*event_target)->event_table[eid];
572 IDispatch_AddRef(V_DISPATCH(var));
573 }else {
574 V_VT(var) = VT_NULL;
577 return S_OK;
580 void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
582 const PRUnichar *attr_value;
583 nsAString attr_name_str, attr_value_str;
584 IDispatch *disp;
585 HTMLDOMNode *node;
586 int i;
587 nsresult nsres;
589 nsAString_Init(&attr_value_str, NULL);
590 nsAString_Init(&attr_name_str, NULL);
592 for(i=0; i < EVENTID_LAST; i++) {
593 nsAString_SetData(&attr_name_str, event_info[i].attr_name);
594 nsres = nsIDOMElement_GetAttribute(nselem, &attr_name_str, &attr_value_str);
595 if(NS_SUCCEEDED(nsres)) {
596 nsAString_GetData(&attr_value_str, &attr_value);
597 if(!*attr_value)
598 continue;
600 TRACE("%p.%s = %s\n", nselem, debugstr_w(event_info[i].attr_name), debugstr_w(attr_value));
602 disp = script_parse_event(doc, attr_value);
603 if(disp) {
604 node = get_node(doc, (nsIDOMNode*)nselem, TRUE);
605 set_event_handler_disp(&node->event_target, node->doc, i, disp);
606 IDispatch_Release(disp);
611 nsAString_Finish(&attr_value_str);
612 nsAString_Finish(&attr_name_str);
615 void release_event_target(event_target_t *event_target)
617 int i;
619 for(i=0; i < EVENTID_LAST; i++) {
620 if(event_target->event_table[i])
621 IDispatch_Release(event_target->event_table[i]);
624 heap_free(event_target);