2 * Copyright 2006 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
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 #include "mshtml_private.h"
35 #include "htmlevent.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
41 #define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
43 static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
44 REFIID riid, void **ppv)
46 HTMLElement *This = HTMLELEM_THIS(iface);
48 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv);
51 static ULONG WINAPI HTMLElement_AddRef(IHTMLElement *iface)
53 HTMLElement *This = HTMLELEM_THIS(iface);
55 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node));
58 static ULONG WINAPI HTMLElement_Release(IHTMLElement *iface)
60 HTMLElement *This = HTMLELEM_THIS(iface);
62 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node));
65 static HRESULT WINAPI HTMLElement_GetTypeInfoCount(IHTMLElement *iface, UINT *pctinfo)
67 HTMLElement *This = HTMLELEM_THIS(iface);
68 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->node.dispex), pctinfo);
71 static HRESULT WINAPI HTMLElement_GetTypeInfo(IHTMLElement *iface, UINT iTInfo,
72 LCID lcid, ITypeInfo **ppTInfo)
74 HTMLElement *This = HTMLELEM_THIS(iface);
75 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->node.dispex), iTInfo, lcid, ppTInfo);
78 static HRESULT WINAPI HTMLElement_GetIDsOfNames(IHTMLElement *iface, REFIID riid,
79 LPOLESTR *rgszNames, UINT cNames,
80 LCID lcid, DISPID *rgDispId)
82 HTMLElement *This = HTMLELEM_THIS(iface);
83 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
86 static HRESULT WINAPI HTMLElement_Invoke(IHTMLElement *iface, DISPID dispIdMember,
87 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
88 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
90 HTMLElement *This = HTMLELEM_THIS(iface);
91 return IDispatchEx_Invoke(DISPATCHEX(&This->node.dispex), dispIdMember, riid, lcid,
92 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
95 static HRESULT WINAPI HTMLElement_setAttribute(IHTMLElement *iface, BSTR strAttributeName,
96 VARIANT AttributeValue, LONG lFlags)
98 HTMLElement *This = HTMLELEM_THIS(iface);
103 VARIANT AttributeValueChanged;
105 WARN("(%p)->(%s . %08x)\n", This, debugstr_w(strAttributeName), lFlags);
108 FIXME("NULL nselem\n");
112 VariantInit(&AttributeValueChanged);
114 hres = VariantChangeType(&AttributeValueChanged, &AttributeValue, 0, VT_BSTR);
116 WARN("couldn't convert input attribute value %d to VT_BSTR\n", V_VT(&AttributeValue));
120 nsAString_Init(&attr_str, strAttributeName);
121 nsAString_Init(&value_str, V_BSTR(&AttributeValueChanged));
123 TRACE("setting %s to %s\n", debugstr_w(strAttributeName),
124 debugstr_w(V_BSTR(&AttributeValueChanged)));
126 nsres = nsIDOMHTMLElement_SetAttribute(This->nselem, &attr_str, &value_str);
127 nsAString_Finish(&attr_str);
128 nsAString_Finish(&value_str);
130 if(NS_SUCCEEDED(nsres)) {
133 ERR("SetAttribute failed: %08x\n", nsres);
140 static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttributeName,
141 LONG lFlags, VARIANT *AttributeValue)
143 HTMLElement *This = HTMLELEM_THIS(iface);
146 const PRUnichar *value;
150 WARN("(%p)->(%s %08x %p)\n", This, debugstr_w(strAttributeName), lFlags, AttributeValue);
153 FIXME("NULL nselem\n");
154 V_VT(AttributeValue) = VT_NULL;
158 V_VT(AttributeValue) = VT_NULL;
160 nsAString_Init(&attr_str, strAttributeName);
161 nsAString_Init(&value_str, NULL);
163 nsres = nsIDOMHTMLElement_GetAttribute(This->nselem, &attr_str, &value_str);
164 nsAString_Finish(&attr_str);
166 if(NS_SUCCEEDED(nsres)) {
167 static const WCHAR wszSRC[] = {'s','r','c',0};
168 nsAString_GetData(&value_str, &value);
169 if(!strcmpiW(strAttributeName, wszSRC))
174 hres = IHTMLDocument2_get_URL(HTMLDOC(This->node.doc), &bstrBaseUrl);
175 if(SUCCEEDED(hres)) {
176 hres = CoInternetCombineUrl(bstrBaseUrl, value,
177 URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
178 buffer, sizeof(buffer)/sizeof(WCHAR), &len, 0);
179 SysFreeString(bstrBaseUrl);
180 if(SUCCEEDED(hres)) {
181 V_VT(AttributeValue) = VT_BSTR;
182 V_BSTR(AttributeValue) = SysAllocString(buffer);
183 TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
187 V_VT(AttributeValue) = VT_BSTR;
188 V_BSTR(AttributeValue) = SysAllocString(value);
189 TRACE("attr_value=%s\n", debugstr_w(V_BSTR(AttributeValue)));
192 ERR("GetAttribute failed: %08x\n", nsres);
196 nsAString_Finish(&value_str);
201 static HRESULT WINAPI HTMLElement_removeAttribute(IHTMLElement *iface, BSTR strAttributeName,
202 LONG lFlags, VARIANT_BOOL *pfSuccess)
204 HTMLElement *This = HTMLELEM_THIS(iface);
205 FIXME("(%p)->()\n", This);
209 static HRESULT WINAPI HTMLElement_put_className(IHTMLElement *iface, BSTR v)
211 HTMLElement *This = HTMLELEM_THIS(iface);
212 nsAString classname_str;
215 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
218 FIXME("NULL nselem\n");
222 nsAString_Init(&classname_str, v);
223 nsres = nsIDOMHTMLElement_SetClassName(This->nselem, &classname_str);
224 nsAString_Finish(&classname_str);
226 ERR("SetClassName failed: %08x\n", nsres);
231 static HRESULT WINAPI HTMLElement_get_className(IHTMLElement *iface, BSTR *p)
233 HTMLElement *This = HTMLELEM_THIS(iface);
238 TRACE("(%p)->(%p)\n", This, p);
241 FIXME("NULL nselem\n");
245 nsAString_Init(&class_str, NULL);
246 nsres = nsIDOMHTMLElement_GetClassName(This->nselem, &class_str);
248 if(NS_SUCCEEDED(nsres)) {
249 const PRUnichar *class;
250 nsAString_GetData(&class_str, &class);
251 *p = *class ? SysAllocString(class) : NULL;
253 ERR("GetClassName failed: %08x\n", nsres);
257 nsAString_Finish(&class_str);
259 TRACE("className=%s\n", debugstr_w(*p));
263 static HRESULT WINAPI HTMLElement_put_id(IHTMLElement *iface, BSTR v)
265 HTMLElement *This = HTMLELEM_THIS(iface);
269 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
272 FIXME("nselem == NULL\n");
276 nsAString_Init(&id_str, v);
277 nsres = nsIDOMHTMLElement_SetId(This->nselem, &id_str);
278 nsAString_Finish(&id_str);
280 ERR("SetId failed: %08x\n", nsres);
285 static HRESULT WINAPI HTMLElement_get_id(IHTMLElement *iface, BSTR *p)
287 HTMLElement *This = HTMLELEM_THIS(iface);
292 TRACE("(%p)->(%p)\n", This, p);
299 nsAString_Init(&id_str, NULL);
300 nsres = nsIDOMHTMLElement_GetId(This->nselem, &id_str);
301 nsAString_GetData(&id_str, &id);
304 ERR("GetId failed: %08x\n", nsres);
306 *p = SysAllocString(id);
308 nsAString_Finish(&id_str);
312 static HRESULT WINAPI HTMLElement_get_tagName(IHTMLElement *iface, BSTR *p)
314 HTMLElement *This = HTMLELEM_THIS(iface);
315 const PRUnichar *tag;
319 TRACE("(%p)->(%p)\n", This, p);
322 static const WCHAR comment_tagW[] = {'!',0};
324 WARN("NULL nselem, assuming comment\n");
326 *p = SysAllocString(comment_tagW);
330 nsAString_Init(&tag_str, NULL);
331 nsres = nsIDOMHTMLElement_GetTagName(This->nselem, &tag_str);
332 if(NS_SUCCEEDED(nsres)) {
333 nsAString_GetData(&tag_str, &tag);
334 *p = SysAllocString(tag);
336 ERR("GetTagName failed: %08x\n", nsres);
339 nsAString_Finish(&tag_str);
344 static HRESULT WINAPI HTMLElement_get_parentElement(IHTMLElement *iface, IHTMLElement **p)
346 HTMLElement *This = HTMLELEM_THIS(iface);
350 TRACE("(%p)->(%p)\n", This, p);
352 hres = IHTMLDOMNode_get_parentNode(HTMLDOMNODE(&This->node), &node);
356 hres = IHTMLDOMNode_QueryInterface(node, &IID_IHTMLElement, (void**)p);
357 IHTMLDOMNode_Release(node);
364 static HRESULT WINAPI HTMLElement_get_style(IHTMLElement *iface, IHTMLStyle **p)
366 HTMLElement *This = HTMLELEM_THIS(iface);
367 nsIDOMElementCSSInlineStyle *nselemstyle;
368 nsIDOMCSSStyleDeclaration *nsstyle;
371 TRACE("(%p)->(%p)\n", This, p);
374 FIXME("NULL nselem\n");
378 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMElementCSSInlineStyle,
379 (void**)&nselemstyle);
380 if(NS_FAILED(nsres)) {
381 ERR("Coud not get nsIDOMCSSStyleDeclaration interface: %08x\n", nsres);
385 nsres = nsIDOMElementCSSInlineStyle_GetStyle(nselemstyle, &nsstyle);
386 nsIDOMElementCSSInlineStyle_Release(nselemstyle);
387 if(NS_FAILED(nsres)) {
388 ERR("GetStyle failed: %08x\n", nsres);
392 /* FIXME: Store style instead of creating a new instance in each call */
393 *p = HTMLStyle_Create(nsstyle);
395 nsIDOMCSSStyleDeclaration_Release(nsstyle);
399 static HRESULT WINAPI HTMLElement_put_onhelp(IHTMLElement *iface, VARIANT v)
401 HTMLElement *This = HTMLELEM_THIS(iface);
402 FIXME("(%p)->()\n", This);
406 static HRESULT WINAPI HTMLElement_get_onhelp(IHTMLElement *iface, VARIANT *p)
408 HTMLElement *This = HTMLELEM_THIS(iface);
409 FIXME("(%p)->(%p)\n", This, p);
413 static HRESULT WINAPI HTMLElement_put_onclick(IHTMLElement *iface, VARIANT v)
415 HTMLElement *This = HTMLELEM_THIS(iface);
417 TRACE("(%p)->()\n", This);
419 return set_node_event(&This->node, EVENTID_CLICK, &v);
422 static HRESULT WINAPI HTMLElement_get_onclick(IHTMLElement *iface, VARIANT *p)
424 HTMLElement *This = HTMLELEM_THIS(iface);
425 FIXME("(%p)->(%p)\n", This, p);
429 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
431 HTMLElement *This = HTMLELEM_THIS(iface);
432 FIXME("(%p)->()\n", This);
436 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
438 HTMLElement *This = HTMLELEM_THIS(iface);
439 FIXME("(%p)->(%p)\n", This, p);
443 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
445 HTMLElement *This = HTMLELEM_THIS(iface);
447 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
449 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
452 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
454 HTMLElement *This = HTMLELEM_THIS(iface);
456 TRACE("(%p)->(%p)\n", This, p);
458 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
461 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
463 HTMLElement *This = HTMLELEM_THIS(iface);
465 TRACE("(%p)->()\n", This);
467 return set_node_event(&This->node, EVENTID_KEYUP, &v);
470 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
472 HTMLElement *This = HTMLELEM_THIS(iface);
473 FIXME("(%p)->(%p)\n", This, p);
477 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
479 HTMLElement *This = HTMLELEM_THIS(iface);
480 FIXME("(%p)->()\n", This);
484 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
486 HTMLElement *This = HTMLELEM_THIS(iface);
487 FIXME("(%p)->(%p)\n", This, p);
491 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
493 HTMLElement *This = HTMLELEM_THIS(iface);
494 FIXME("(%p)->()\n", This);
498 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
500 HTMLElement *This = HTMLELEM_THIS(iface);
501 FIXME("(%p)->(%p)\n", This, p);
505 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
507 HTMLElement *This = HTMLELEM_THIS(iface);
509 TRACE("(%p)->()\n", This);
511 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
514 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
516 HTMLElement *This = HTMLELEM_THIS(iface);
518 TRACE("(%p)->(%p)\n", This, p);
520 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
523 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
525 HTMLElement *This = HTMLELEM_THIS(iface);
526 FIXME("(%p)->()\n", This);
530 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
532 HTMLElement *This = HTMLELEM_THIS(iface);
533 FIXME("(%p)->(%p)\n", This, p);
537 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
539 HTMLElement *This = HTMLELEM_THIS(iface);
541 TRACE("(%p)->()\n", This);
543 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
546 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
548 HTMLElement *This = HTMLELEM_THIS(iface);
550 TRACE("(%p)->(%p)\n", This, p);
552 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
555 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
557 HTMLElement *This = HTMLELEM_THIS(iface);
559 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
561 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
564 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
566 HTMLElement *This = HTMLELEM_THIS(iface);
568 TRACE("(%p)->(%p)\n", This, p);
570 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
573 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
575 HTMLElement *This = HTMLELEM_THIS(iface);
576 FIXME("(%p)->(%p)\n", This, p);
580 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
582 HTMLElement *This = HTMLELEM_THIS(iface);
586 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
588 nsAString_Init(&title_str, v);
589 nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
590 nsAString_Finish(&title_str);
592 ERR("SetTitle failed: %08x\n", nsres);
597 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
599 HTMLElement *This = HTMLELEM_THIS(iface);
603 TRACE("(%p)->(%p)\n", This, p);
605 nsAString_Init(&title_str, NULL);
606 nsres = nsIDOMHTMLElement_GetTitle(This->nselem, &title_str);
607 if(NS_SUCCEEDED(nsres)) {
608 const PRUnichar *title;
610 nsAString_GetData(&title_str, &title);
611 *p = *title ? SysAllocString(title) : NULL;
613 ERR("GetTitle failed: %08x\n", nsres);
620 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
622 HTMLElement *This = HTMLELEM_THIS(iface);
623 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
627 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
629 HTMLElement *This = HTMLELEM_THIS(iface);
630 FIXME("(%p)->(%p)\n", This, p);
634 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
636 HTMLElement *This = HTMLELEM_THIS(iface);
637 FIXME("(%p)->()\n", This);
641 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
643 HTMLElement *This = HTMLELEM_THIS(iface);
644 FIXME("(%p)->(%p)\n", This, p);
648 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
650 HTMLElement *This = HTMLELEM_THIS(iface);
651 FIXME("(%p)->()\n", This);
655 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
656 VARIANT_BOOL *pfResult)
658 HTMLElement *This = HTMLELEM_THIS(iface);
659 FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
663 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, long *p)
665 HTMLElement *This = HTMLELEM_THIS(iface);
666 FIXME("(%p)->(%p)\n", This, p);
670 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
672 HTMLElement *This = HTMLELEM_THIS(iface);
673 FIXME("(%p)->(%p)\n", This, p);
677 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
679 HTMLElement *This = HTMLELEM_THIS(iface);
680 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
684 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
686 HTMLElement *This = HTMLELEM_THIS(iface);
687 FIXME("(%p)->(%p)\n", This, p);
691 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, long *p)
693 HTMLElement *This = HTMLELEM_THIS(iface);
694 FIXME("(%p)->(%p)\n", This, p);
698 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, long *p)
700 HTMLElement *This = HTMLELEM_THIS(iface);
701 nsIDOMNSHTMLElement *nselem;
705 TRACE("(%p)->(%p)\n", This, p);
707 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
708 if(NS_FAILED(nsres)) {
709 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
713 nsres = nsIDOMNSHTMLElement_GetOffsetTop(nselem, &top);
714 nsIDOMNSHTMLElement_Release(nselem);
715 if(NS_FAILED(nsres)) {
716 ERR("GetOffsetTop failed: %08x\n", nsres);
724 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, long *p)
726 HTMLElement *This = HTMLELEM_THIS(iface);
727 nsIDOMNSHTMLElement *nselem;
731 TRACE("(%p)->(%p)\n", This, p);
733 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
734 if(NS_FAILED(nsres)) {
735 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
739 nsres = nsIDOMNSHTMLElement_GetOffsetWidth(nselem, &offset);
740 nsIDOMNSHTMLElement_Release(nselem);
741 if(NS_FAILED(nsres)) {
742 ERR("GetOffsetWidth failed: %08x\n", nsres);
750 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, long *p)
752 HTMLElement *This = HTMLELEM_THIS(iface);
753 nsIDOMNSHTMLElement *nselem;
757 TRACE("(%p)->(%p)\n", This, p);
759 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
760 if(NS_FAILED(nsres)) {
761 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
765 nsres = nsIDOMNSHTMLElement_GetOffsetHeight(nselem, &offset);
766 nsIDOMNSHTMLElement_Release(nselem);
767 if(NS_FAILED(nsres)) {
768 ERR("GetOffsetHeight failed: %08x\n", nsres);
776 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
778 HTMLElement *This = HTMLELEM_THIS(iface);
779 FIXME("(%p)->(%p)\n", This, p);
783 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
785 HTMLElement *This = HTMLELEM_THIS(iface);
786 nsIDOMNSHTMLElement *nselem;
790 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
793 FIXME("NULL nselem\n");
797 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
798 if(NS_FAILED(nsres)) {
799 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
803 nsAString_Init(&html_str, v);
804 nsres = nsIDOMNSHTMLElement_SetInnerHTML(nselem, &html_str);
805 nsAString_Finish(&html_str);
807 if(NS_FAILED(nsres)) {
808 FIXME("SetInnerHtml failed %08x\n", nsres);
815 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
817 HTMLElement *This = HTMLELEM_THIS(iface);
818 FIXME("(%p)->(%p)\n", This, p);
822 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
824 HTMLElement *This = HTMLELEM_THIS(iface);
825 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
829 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
831 HTMLElement *This = HTMLELEM_THIS(iface);
832 FIXME("(%p)->(%p)\n", This, p);
836 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
838 HTMLElement *This = HTMLELEM_THIS(iface);
839 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
843 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
845 HTMLElement *This = HTMLELEM_THIS(iface);
846 FIXME("(%p)->(%p)\n", This, p);
850 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
852 HTMLElement *This = HTMLELEM_THIS(iface);
853 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
857 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
859 HTMLElement *This = HTMLELEM_THIS(iface);
860 FIXME("(%p)->(%p)\n", This, p);
864 static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsIDOMNode *nsnode)
866 static const WCHAR wszBeforeBegin[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
867 static const WCHAR wszAfterBegin[] = {'a','f','t','e','r','B','e','g','i','n',0};
868 static const WCHAR wszBeforeEnd[] = {'b','e','f','o','r','e','E','n','d',0};
869 static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
873 FIXME("NULL nselem\n");
877 if (!strcmpiW(where, wszBeforeBegin))
881 nsres = nsIDOMNode_GetParentNode(This->nselem, &parent);
882 if (!parent) return E_INVALIDARG;
883 nsres = nsIDOMNode_InsertBefore(parent, nsnode,
884 (nsIDOMNode *)This->nselem, &unused);
885 if (unused) nsIDOMNode_Release(unused);
886 nsIDOMNode_Release(parent);
888 else if (!strcmpiW(where, wszAfterBegin))
891 nsIDOMNode *first_child;
892 nsIDOMNode_GetFirstChild(This->nselem, &first_child);
893 nsres = nsIDOMNode_InsertBefore(This->nselem, nsnode, first_child, &unused);
894 if (unused) nsIDOMNode_Release(unused);
895 if (first_child) nsIDOMNode_Release(first_child);
897 else if (!strcmpiW(where, wszBeforeEnd))
900 nsres = nsIDOMNode_AppendChild(This->nselem, nsnode, &unused);
901 if (unused) nsIDOMNode_Release(unused);
903 else if (!strcmpiW(where, wszAfterEnd))
906 nsIDOMNode *next_sibling;
908 nsIDOMNode_GetParentNode(This->nselem, &parent);
909 if (!parent) return E_INVALIDARG;
911 nsIDOMNode_GetNextSibling(This->nselem, &next_sibling);
914 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
915 nsIDOMNode_Release(next_sibling);
918 nsres = nsIDOMNode_AppendChild(parent, nsnode, &unused);
919 nsIDOMNode_Release(parent);
920 if (unused) nsIDOMNode_Release(unused);
924 ERR("invalid where: %s\n", debugstr_w(where));
928 if (NS_FAILED(nsres))
934 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
937 HTMLElement *This = HTMLELEM_THIS(iface);
938 nsIDOMDocumentRange *nsdocrange;
940 nsIDOMNSRange *nsrange;
946 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
948 if(!This->node.doc->nsdoc) {
949 WARN("NULL nsdoc\n");
953 nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
956 ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
959 nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &range);
960 nsIDOMDocumentRange_Release(nsdocrange);
963 ERR("CreateRange failed: %08x\n", nsres);
967 nsIDOMRange_SetStartBefore(range, (nsIDOMNode *)This->nselem);
969 nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
970 nsIDOMRange_Release(range);
973 ERR("getting nsIDOMNSRange failed: %08x\n", nsres);
977 nsAString_Init(&ns_html, html);
979 nsres = nsIDOMNSRange_CreateContextualFragment(nsrange, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
980 nsIDOMNSRange_Release(nsrange);
981 nsAString_Finish(&ns_html);
983 if(NS_FAILED(nsres) || !nsnode)
985 ERR("CreateTextNode failed: %08x\n", nsres);
989 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
990 nsIDOMNode_Release(nsnode);
995 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
998 HTMLElement *This = HTMLELEM_THIS(iface);
1004 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
1006 if(!This->node.doc->nsdoc) {
1007 WARN("NULL nsdoc\n");
1008 return E_UNEXPECTED;
1012 nsAString_Init(&ns_text, text);
1013 nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
1014 nsAString_Finish(&ns_text);
1016 if(NS_FAILED(nsres) || !nsnode)
1018 ERR("CreateTextNode failed: %08x\n", nsres);
1022 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
1023 nsIDOMNode_Release(nsnode);
1028 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
1030 HTMLElement *This = HTMLELEM_THIS(iface);
1031 FIXME("(%p)->(%p)\n", This, p);
1035 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
1037 HTMLElement *This = HTMLELEM_THIS(iface);
1038 FIXME("(%p)->(%p)\n", This, p);
1042 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
1044 HTMLElement *This = HTMLELEM_THIS(iface);
1045 FIXME("(%p)\n", This);
1049 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
1050 IHTMLFiltersCollection **p)
1052 HTMLElement *This = HTMLELEM_THIS(iface);
1053 FIXME("(%p)->(%p)\n", This, p);
1057 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
1059 HTMLElement *This = HTMLELEM_THIS(iface);
1060 FIXME("(%p)->()\n", This);
1064 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
1066 HTMLElement *This = HTMLELEM_THIS(iface);
1067 FIXME("(%p)->(%p)\n", This, p);
1071 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
1073 HTMLElement *This = HTMLELEM_THIS(iface);
1074 FIXME("(%p)->(%p)\n", This, String);
1078 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
1080 HTMLElement *This = HTMLELEM_THIS(iface);
1081 FIXME("(%p)->()\n", This);
1085 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
1087 HTMLElement *This = HTMLELEM_THIS(iface);
1088 FIXME("(%p)->(%p)\n", This, p);
1092 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
1094 HTMLElement *This = HTMLELEM_THIS(iface);
1095 FIXME("(%p)->()\n", This);
1099 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
1101 HTMLElement *This = HTMLELEM_THIS(iface);
1102 FIXME("(%p)->(%p)\n", This, p);
1106 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
1108 HTMLElement *This = HTMLELEM_THIS(iface);
1109 FIXME("(%p)->()\n", This);
1113 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
1115 HTMLElement *This = HTMLELEM_THIS(iface);
1116 FIXME("(%p)->(%p)\n", This, p);
1120 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
1122 HTMLElement *This = HTMLELEM_THIS(iface);
1123 FIXME("(%p)->()\n", This);
1127 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
1129 HTMLElement *This = HTMLELEM_THIS(iface);
1130 FIXME("(%p)->(%p)\n", This, p);
1134 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
1136 HTMLElement *This = HTMLELEM_THIS(iface);
1137 FIXME("(%p)->()\n", This);
1141 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
1143 HTMLElement *This = HTMLELEM_THIS(iface);
1144 FIXME("(%p)->(%p)\n", This, p);
1148 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
1150 HTMLElement *This = HTMLELEM_THIS(iface);
1151 FIXME("(%p)->()\n", This);
1155 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
1157 HTMLElement *This = HTMLELEM_THIS(iface);
1158 FIXME("(%p)->(%p)\n", This, p);
1162 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
1164 HTMLElement *This = HTMLELEM_THIS(iface);
1165 FIXME("(%p)->()\n", This);
1169 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
1171 HTMLElement *This = HTMLELEM_THIS(iface);
1172 FIXME("(%p)->(%p)\n", This, p);
1176 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
1178 HTMLElement *This = HTMLELEM_THIS(iface);
1179 FIXME("(%p)->()\n", This);
1183 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
1185 HTMLElement *This = HTMLELEM_THIS(iface);
1186 FIXME("(%p)->(%p)\n", This, p);
1190 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
1192 HTMLElement *This = HTMLELEM_THIS(iface);
1193 FIXME("(%p)->()\n", This);
1197 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
1199 HTMLElement *This = HTMLELEM_THIS(iface);
1200 FIXME("(%p)->(%p)\n", This, p);
1204 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
1206 HTMLElement *This = HTMLELEM_THIS(iface);
1207 nsIDOMNodeList *nsnode_list;
1210 TRACE("(%p)->(%p)\n", This, p);
1212 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
1213 if(NS_FAILED(nsres)) {
1214 ERR("GetChildNodes failed: %08x\n", nsres);
1218 *p = (IDispatch*)create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nsnode_list);
1220 nsIDOMNodeList_Release(nsnode_list);
1224 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
1226 HTMLElement *This = HTMLELEM_THIS(iface);
1228 TRACE("(%p)->(%p)\n", This, p);
1230 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
1234 #undef HTMLELEM_THIS
1236 static const IHTMLElementVtbl HTMLElementVtbl = {
1237 HTMLElement_QueryInterface,
1239 HTMLElement_Release,
1240 HTMLElement_GetTypeInfoCount,
1241 HTMLElement_GetTypeInfo,
1242 HTMLElement_GetIDsOfNames,
1244 HTMLElement_setAttribute,
1245 HTMLElement_getAttribute,
1246 HTMLElement_removeAttribute,
1247 HTMLElement_put_className,
1248 HTMLElement_get_className,
1251 HTMLElement_get_tagName,
1252 HTMLElement_get_parentElement,
1253 HTMLElement_get_style,
1254 HTMLElement_put_onhelp,
1255 HTMLElement_get_onhelp,
1256 HTMLElement_put_onclick,
1257 HTMLElement_get_onclick,
1258 HTMLElement_put_ondblclick,
1259 HTMLElement_get_ondblclick,
1260 HTMLElement_put_onkeydown,
1261 HTMLElement_get_onkeydown,
1262 HTMLElement_put_onkeyup,
1263 HTMLElement_get_onkeyup,
1264 HTMLElement_put_onkeypress,
1265 HTMLElement_get_onkeypress,
1266 HTMLElement_put_onmouseout,
1267 HTMLElement_get_onmouseout,
1268 HTMLElement_put_onmouseover,
1269 HTMLElement_get_onmouseover,
1270 HTMLElement_put_onmousemove,
1271 HTMLElement_get_onmousemove,
1272 HTMLElement_put_onmousedown,
1273 HTMLElement_get_onmousedown,
1274 HTMLElement_put_onmouseup,
1275 HTMLElement_get_onmouseup,
1276 HTMLElement_get_document,
1277 HTMLElement_put_title,
1278 HTMLElement_get_title,
1279 HTMLElement_put_language,
1280 HTMLElement_get_language,
1281 HTMLElement_put_onselectstart,
1282 HTMLElement_get_onselectstart,
1283 HTMLElement_scrollIntoView,
1284 HTMLElement_contains,
1285 HTMLElement_get_sourceIndex,
1286 HTMLElement_get_recordNumber,
1287 HTMLElement_put_lang,
1288 HTMLElement_get_lang,
1289 HTMLElement_get_offsetLeft,
1290 HTMLElement_get_offsetTop,
1291 HTMLElement_get_offsetWidth,
1292 HTMLElement_get_offsetHeight,
1293 HTMLElement_get_offsetParent,
1294 HTMLElement_put_innerHTML,
1295 HTMLElement_get_innerHTML,
1296 HTMLElement_put_innerText,
1297 HTMLElement_get_innerText,
1298 HTMLElement_put_outerHTML,
1299 HTMLElement_get_outerHTML,
1300 HTMLElement_put_outerText,
1301 HTMLElement_get_outerText,
1302 HTMLElement_insertAdjacentHTML,
1303 HTMLElement_insertAdjacentText,
1304 HTMLElement_get_parentTextEdit,
1305 HTMLElement_get_isTextEdit,
1307 HTMLElement_get_filters,
1308 HTMLElement_put_ondragstart,
1309 HTMLElement_get_ondragstart,
1310 HTMLElement_toString,
1311 HTMLElement_put_onbeforeupdate,
1312 HTMLElement_get_onbeforeupdate,
1313 HTMLElement_put_onafterupdate,
1314 HTMLElement_get_onafterupdate,
1315 HTMLElement_put_onerrorupdate,
1316 HTMLElement_get_onerrorupdate,
1317 HTMLElement_put_onrowexit,
1318 HTMLElement_get_onrowexit,
1319 HTMLElement_put_onrowenter,
1320 HTMLElement_get_onrowenter,
1321 HTMLElement_put_ondatasetchanged,
1322 HTMLElement_get_ondatasetchanged,
1323 HTMLElement_put_ondataavailable,
1324 HTMLElement_get_ondataavailable,
1325 HTMLElement_put_ondatasetcomplete,
1326 HTMLElement_get_ondatasetcomplete,
1327 HTMLElement_put_onfilterchange,
1328 HTMLElement_get_onfilterchange,
1329 HTMLElement_get_children,
1333 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1335 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1339 if(IsEqualGUID(&IID_IUnknown, riid)) {
1340 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1341 *ppv = HTMLELEM(This);
1342 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1343 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1344 *ppv = HTMLELEM(This);
1345 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
1346 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
1347 *ppv = HTMLELEM(This);
1348 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
1349 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This, ppv);
1350 *ppv = HTMLELEM2(This);
1351 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
1352 TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This, ppv);
1353 *ppv = HTMLELEM3(This);
1354 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
1355 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
1356 *ppv = CONPTCONT(&This->cp_container);
1360 IHTMLElement_AddRef(HTMLELEM(This));
1364 return HTMLDOMNode_QI(&This->node, riid, ppv);
1367 void HTMLElement_destructor(HTMLDOMNode *iface)
1369 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1371 ConnectionPointContainer_Destroy(&This->cp_container);
1374 nsIDOMHTMLElement_Release(This->nselem);
1376 HTMLDOMNode_destructor(&This->node);
1379 static const NodeImplVtbl HTMLElementImplVtbl = {
1381 HTMLElement_destructor
1384 static const tid_t HTMLElement_iface_tids[] = {
1393 static dispex_static_data_t HTMLElement_dispex = {
1395 DispHTMLUnknownElement_tid,
1397 HTMLElement_iface_tids
1400 void HTMLElement_Init(HTMLElement *This)
1402 This->lpHTMLElementVtbl = &HTMLElementVtbl;
1404 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)HTMLELEM(This));
1406 HTMLElement2_Init(This);
1407 HTMLElement3_Init(This);
1409 if(!This->node.dispex.data)
1410 init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex);
1413 HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_generic)
1415 nsIDOMHTMLElement *nselem;
1416 HTMLElement *ret = NULL;
1417 nsAString class_name_str;
1418 const PRUnichar *class_name;
1421 static const WCHAR wszA[] = {'A',0};
1422 static const WCHAR wszBODY[] = {'B','O','D','Y',0};
1423 static const WCHAR wszIFRAME[] = {'I','F','R','A','M','E',0};
1424 static const WCHAR wszIMG[] = {'I','M','G',0};
1425 static const WCHAR wszINPUT[] = {'I','N','P','U','T',0};
1426 static const WCHAR wszOPTION[] = {'O','P','T','I','O','N',0};
1427 static const WCHAR wszSCRIPT[] = {'S','C','R','I','P','T',0};
1428 static const WCHAR wszSELECT[] = {'S','E','L','E','C','T',0};
1429 static const WCHAR wszTABLE[] = {'T','A','B','L','E',0};
1430 static const WCHAR wszTR[] = {'T','R',0};
1431 static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
1433 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
1434 if(NS_FAILED(nsres))
1437 nsAString_Init(&class_name_str, NULL);
1438 nsIDOMHTMLElement_GetTagName(nselem, &class_name_str);
1440 nsAString_GetData(&class_name_str, &class_name);
1442 if(!strcmpW(class_name, wszA))
1443 ret = HTMLAnchorElement_Create(nselem);
1444 else if(!strcmpW(class_name, wszBODY))
1445 ret = HTMLBodyElement_Create(nselem);
1446 else if(!strcmpW(class_name, wszIFRAME))
1447 ret = HTMLIFrame_Create(nselem);
1448 else if(!strcmpW(class_name, wszIMG))
1449 ret = HTMLImgElement_Create(nselem);
1450 else if(!strcmpW(class_name, wszINPUT))
1451 ret = HTMLInputElement_Create(nselem);
1452 else if(!strcmpW(class_name, wszOPTION))
1453 ret = HTMLOptionElement_Create(nselem);
1454 else if(!strcmpW(class_name, wszSCRIPT))
1455 ret = HTMLScriptElement_Create(nselem);
1456 else if(!strcmpW(class_name, wszSELECT))
1457 ret = HTMLSelectElement_Create(nselem);
1458 else if(!strcmpW(class_name, wszTABLE))
1459 ret = HTMLTable_Create(nselem);
1460 else if(!strcmpW(class_name, wszTR))
1461 ret = HTMLTableRow_Create(nselem);
1462 else if(!strcmpW(class_name, wszTEXTAREA))
1463 ret = HTMLTextAreaElement_Create(nselem);
1464 else if(use_generic)
1465 ret = HTMLGenericElement_Create(nselem);
1468 ret = heap_alloc_zero(sizeof(HTMLElement));
1469 HTMLElement_Init(ret);
1470 ret->node.vtbl = &HTMLElementImplVtbl;
1473 TRACE("%s ret %p\n", debugstr_w(class_name), ret);
1475 nsAString_Finish(&class_name_str);
1477 ret->nselem = nselem;
1478 HTMLDOMNode_Init(doc, &ret->node, (nsIDOMNode*)nselem);