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);
426 TRACE("(%p)->(%p)\n", This, p);
428 return get_node_event(&This->node, EVENTID_CLICK, p);
431 static HRESULT WINAPI HTMLElement_put_ondblclick(IHTMLElement *iface, VARIANT v)
433 HTMLElement *This = HTMLELEM_THIS(iface);
434 FIXME("(%p)->()\n", This);
438 static HRESULT WINAPI HTMLElement_get_ondblclick(IHTMLElement *iface, VARIANT *p)
440 HTMLElement *This = HTMLELEM_THIS(iface);
441 FIXME("(%p)->(%p)\n", This, p);
445 static HRESULT WINAPI HTMLElement_put_onkeydown(IHTMLElement *iface, VARIANT v)
447 HTMLElement *This = HTMLELEM_THIS(iface);
449 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
451 return set_node_event(&This->node, EVENTID_KEYDOWN, &v);
454 static HRESULT WINAPI HTMLElement_get_onkeydown(IHTMLElement *iface, VARIANT *p)
456 HTMLElement *This = HTMLELEM_THIS(iface);
458 TRACE("(%p)->(%p)\n", This, p);
460 return get_node_event(&This->node, EVENTID_KEYDOWN, p);
463 static HRESULT WINAPI HTMLElement_put_onkeyup(IHTMLElement *iface, VARIANT v)
465 HTMLElement *This = HTMLELEM_THIS(iface);
467 TRACE("(%p)->()\n", This);
469 return set_node_event(&This->node, EVENTID_KEYUP, &v);
472 static HRESULT WINAPI HTMLElement_get_onkeyup(IHTMLElement *iface, VARIANT *p)
474 HTMLElement *This = HTMLELEM_THIS(iface);
475 FIXME("(%p)->(%p)\n", This, p);
479 static HRESULT WINAPI HTMLElement_put_onkeypress(IHTMLElement *iface, VARIANT v)
481 HTMLElement *This = HTMLELEM_THIS(iface);
482 FIXME("(%p)->()\n", This);
486 static HRESULT WINAPI HTMLElement_get_onkeypress(IHTMLElement *iface, VARIANT *p)
488 HTMLElement *This = HTMLELEM_THIS(iface);
489 FIXME("(%p)->(%p)\n", This, p);
493 static HRESULT WINAPI HTMLElement_put_onmouseout(IHTMLElement *iface, VARIANT v)
495 HTMLElement *This = HTMLELEM_THIS(iface);
497 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
499 return set_node_event(&This->node, EVENTID_MOUSEOUT, &v);
502 static HRESULT WINAPI HTMLElement_get_onmouseout(IHTMLElement *iface, VARIANT *p)
504 HTMLElement *This = HTMLELEM_THIS(iface);
506 TRACE("(%p)->(%p)\n", This, p);
508 return get_node_event(&This->node, EVENTID_MOUSEOUT, p);
511 static HRESULT WINAPI HTMLElement_put_onmouseover(IHTMLElement *iface, VARIANT v)
513 HTMLElement *This = HTMLELEM_THIS(iface);
515 TRACE("(%p)->()\n", This);
517 return set_node_event(&This->node, EVENTID_MOUSEOVER, &v);
520 static HRESULT WINAPI HTMLElement_get_onmouseover(IHTMLElement *iface, VARIANT *p)
522 HTMLElement *This = HTMLELEM_THIS(iface);
524 TRACE("(%p)->(%p)\n", This, p);
526 return get_node_event(&This->node, EVENTID_MOUSEOVER, p);
529 static HRESULT WINAPI HTMLElement_put_onmousemove(IHTMLElement *iface, VARIANT v)
531 HTMLElement *This = HTMLELEM_THIS(iface);
532 FIXME("(%p)->()\n", This);
536 static HRESULT WINAPI HTMLElement_get_onmousemove(IHTMLElement *iface, VARIANT *p)
538 HTMLElement *This = HTMLELEM_THIS(iface);
539 FIXME("(%p)->(%p)\n", This, p);
543 static HRESULT WINAPI HTMLElement_put_onmousedown(IHTMLElement *iface, VARIANT v)
545 HTMLElement *This = HTMLELEM_THIS(iface);
547 TRACE("(%p)->()\n", This);
549 return set_node_event(&This->node, EVENTID_MOUSEDOWN, &v);
552 static HRESULT WINAPI HTMLElement_get_onmousedown(IHTMLElement *iface, VARIANT *p)
554 HTMLElement *This = HTMLELEM_THIS(iface);
556 TRACE("(%p)->(%p)\n", This, p);
558 return get_node_event(&This->node, EVENTID_MOUSEDOWN, p);
561 static HRESULT WINAPI HTMLElement_put_onmouseup(IHTMLElement *iface, VARIANT v)
563 HTMLElement *This = HTMLELEM_THIS(iface);
565 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
567 return set_node_event(&This->node, EVENTID_MOUSEUP, &v);
570 static HRESULT WINAPI HTMLElement_get_onmouseup(IHTMLElement *iface, VARIANT *p)
572 HTMLElement *This = HTMLELEM_THIS(iface);
574 TRACE("(%p)->(%p)\n", This, p);
576 return get_node_event(&This->node, EVENTID_MOUSEUP, p);
579 static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **p)
581 HTMLElement *This = HTMLELEM_THIS(iface);
582 FIXME("(%p)->(%p)\n", This, p);
586 static HRESULT WINAPI HTMLElement_put_title(IHTMLElement *iface, BSTR v)
588 HTMLElement *This = HTMLELEM_THIS(iface);
592 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
594 nsAString_Init(&title_str, v);
595 nsres = nsIDOMHTMLElement_SetTitle(This->nselem, &title_str);
596 nsAString_Finish(&title_str);
598 ERR("SetTitle failed: %08x\n", nsres);
603 static HRESULT WINAPI HTMLElement_get_title(IHTMLElement *iface, BSTR *p)
605 HTMLElement *This = HTMLELEM_THIS(iface);
609 TRACE("(%p)->(%p)\n", This, p);
611 nsAString_Init(&title_str, NULL);
612 nsres = nsIDOMHTMLElement_GetTitle(This->nselem, &title_str);
613 if(NS_SUCCEEDED(nsres)) {
614 const PRUnichar *title;
616 nsAString_GetData(&title_str, &title);
617 *p = *title ? SysAllocString(title) : NULL;
619 ERR("GetTitle failed: %08x\n", nsres);
626 static HRESULT WINAPI HTMLElement_put_language(IHTMLElement *iface, BSTR v)
628 HTMLElement *This = HTMLELEM_THIS(iface);
629 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
633 static HRESULT WINAPI HTMLElement_get_language(IHTMLElement *iface, BSTR *p)
635 HTMLElement *This = HTMLELEM_THIS(iface);
636 FIXME("(%p)->(%p)\n", This, p);
640 static HRESULT WINAPI HTMLElement_put_onselectstart(IHTMLElement *iface, VARIANT v)
642 HTMLElement *This = HTMLELEM_THIS(iface);
644 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
646 return set_node_event(&This->node, EVENTID_SELECTSTART, &v);
649 static HRESULT WINAPI HTMLElement_get_onselectstart(IHTMLElement *iface, VARIANT *p)
651 HTMLElement *This = HTMLELEM_THIS(iface);
653 TRACE("(%p)->(%p)\n", This, p);
655 return get_node_event(&This->node, EVENTID_SELECTSTART, p);
658 static HRESULT WINAPI HTMLElement_scrollIntoView(IHTMLElement *iface, VARIANT varargStart)
660 HTMLElement *This = HTMLELEM_THIS(iface);
661 FIXME("(%p)->()\n", This);
665 static HRESULT WINAPI HTMLElement_contains(IHTMLElement *iface, IHTMLElement *pChild,
666 VARIANT_BOOL *pfResult)
668 HTMLElement *This = HTMLELEM_THIS(iface);
669 FIXME("(%p)->(%p %p)\n", This, pChild, pfResult);
673 static HRESULT WINAPI HTMLElement_get_sourceIndex(IHTMLElement *iface, long *p)
675 HTMLElement *This = HTMLELEM_THIS(iface);
676 FIXME("(%p)->(%p)\n", This, p);
680 static HRESULT WINAPI HTMLElement_get_recordNumber(IHTMLElement *iface, VARIANT *p)
682 HTMLElement *This = HTMLELEM_THIS(iface);
683 FIXME("(%p)->(%p)\n", This, p);
687 static HRESULT WINAPI HTMLElement_put_lang(IHTMLElement *iface, BSTR v)
689 HTMLElement *This = HTMLELEM_THIS(iface);
690 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
694 static HRESULT WINAPI HTMLElement_get_lang(IHTMLElement *iface, BSTR *p)
696 HTMLElement *This = HTMLELEM_THIS(iface);
697 FIXME("(%p)->(%p)\n", This, p);
701 static HRESULT WINAPI HTMLElement_get_offsetLeft(IHTMLElement *iface, long *p)
703 HTMLElement *This = HTMLELEM_THIS(iface);
704 FIXME("(%p)->(%p)\n", This, p);
708 static HRESULT WINAPI HTMLElement_get_offsetTop(IHTMLElement *iface, long *p)
710 HTMLElement *This = HTMLELEM_THIS(iface);
711 nsIDOMNSHTMLElement *nselem;
715 TRACE("(%p)->(%p)\n", This, p);
717 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
718 if(NS_FAILED(nsres)) {
719 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
723 nsres = nsIDOMNSHTMLElement_GetOffsetTop(nselem, &top);
724 nsIDOMNSHTMLElement_Release(nselem);
725 if(NS_FAILED(nsres)) {
726 ERR("GetOffsetTop failed: %08x\n", nsres);
734 static HRESULT WINAPI HTMLElement_get_offsetWidth(IHTMLElement *iface, long *p)
736 HTMLElement *This = HTMLELEM_THIS(iface);
737 nsIDOMNSHTMLElement *nselem;
741 TRACE("(%p)->(%p)\n", This, p);
743 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
744 if(NS_FAILED(nsres)) {
745 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
749 nsres = nsIDOMNSHTMLElement_GetOffsetWidth(nselem, &offset);
750 nsIDOMNSHTMLElement_Release(nselem);
751 if(NS_FAILED(nsres)) {
752 ERR("GetOffsetWidth failed: %08x\n", nsres);
760 static HRESULT WINAPI HTMLElement_get_offsetHeight(IHTMLElement *iface, long *p)
762 HTMLElement *This = HTMLELEM_THIS(iface);
763 nsIDOMNSHTMLElement *nselem;
767 TRACE("(%p)->(%p)\n", This, p);
769 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
770 if(NS_FAILED(nsres)) {
771 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
775 nsres = nsIDOMNSHTMLElement_GetOffsetHeight(nselem, &offset);
776 nsIDOMNSHTMLElement_Release(nselem);
777 if(NS_FAILED(nsres)) {
778 ERR("GetOffsetHeight failed: %08x\n", nsres);
786 static HRESULT WINAPI HTMLElement_get_offsetParent(IHTMLElement *iface, IHTMLElement **p)
788 HTMLElement *This = HTMLELEM_THIS(iface);
789 FIXME("(%p)->(%p)\n", This, p);
793 static HRESULT WINAPI HTMLElement_put_innerHTML(IHTMLElement *iface, BSTR v)
795 HTMLElement *This = HTMLELEM_THIS(iface);
796 nsIDOMNSHTMLElement *nselem;
800 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
803 FIXME("NULL nselem\n");
807 nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
808 if(NS_FAILED(nsres)) {
809 ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
813 nsAString_Init(&html_str, v);
814 nsres = nsIDOMNSHTMLElement_SetInnerHTML(nselem, &html_str);
815 nsAString_Finish(&html_str);
817 if(NS_FAILED(nsres)) {
818 FIXME("SetInnerHtml failed %08x\n", nsres);
825 static HRESULT WINAPI HTMLElement_get_innerHTML(IHTMLElement *iface, BSTR *p)
827 HTMLElement *This = HTMLELEM_THIS(iface);
828 FIXME("(%p)->(%p)\n", This, p);
832 static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
834 HTMLElement *This = HTMLELEM_THIS(iface);
835 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
839 static HRESULT WINAPI HTMLElement_get_innerText(IHTMLElement *iface, BSTR *p)
841 HTMLElement *This = HTMLELEM_THIS(iface);
842 FIXME("(%p)->(%p)\n", This, p);
846 static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
848 HTMLElement *This = HTMLELEM_THIS(iface);
849 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
853 static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
855 HTMLElement *This = HTMLELEM_THIS(iface);
856 FIXME("(%p)->(%p)\n", This, p);
860 static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
862 HTMLElement *This = HTMLELEM_THIS(iface);
863 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
867 static HRESULT WINAPI HTMLElement_get_outerText(IHTMLElement *iface, BSTR *p)
869 HTMLElement *This = HTMLELEM_THIS(iface);
870 FIXME("(%p)->(%p)\n", This, p);
874 static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsIDOMNode *nsnode)
876 static const WCHAR wszBeforeBegin[] = {'b','e','f','o','r','e','B','e','g','i','n',0};
877 static const WCHAR wszAfterBegin[] = {'a','f','t','e','r','B','e','g','i','n',0};
878 static const WCHAR wszBeforeEnd[] = {'b','e','f','o','r','e','E','n','d',0};
879 static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
883 FIXME("NULL nselem\n");
887 if (!strcmpiW(where, wszBeforeBegin))
891 nsres = nsIDOMNode_GetParentNode(This->nselem, &parent);
892 if (!parent) return E_INVALIDARG;
893 nsres = nsIDOMNode_InsertBefore(parent, nsnode,
894 (nsIDOMNode *)This->nselem, &unused);
895 if (unused) nsIDOMNode_Release(unused);
896 nsIDOMNode_Release(parent);
898 else if (!strcmpiW(where, wszAfterBegin))
901 nsIDOMNode *first_child;
902 nsIDOMNode_GetFirstChild(This->nselem, &first_child);
903 nsres = nsIDOMNode_InsertBefore(This->nselem, nsnode, first_child, &unused);
904 if (unused) nsIDOMNode_Release(unused);
905 if (first_child) nsIDOMNode_Release(first_child);
907 else if (!strcmpiW(where, wszBeforeEnd))
910 nsres = nsIDOMNode_AppendChild(This->nselem, nsnode, &unused);
911 if (unused) nsIDOMNode_Release(unused);
913 else if (!strcmpiW(where, wszAfterEnd))
916 nsIDOMNode *next_sibling;
918 nsIDOMNode_GetParentNode(This->nselem, &parent);
919 if (!parent) return E_INVALIDARG;
921 nsIDOMNode_GetNextSibling(This->nselem, &next_sibling);
924 nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
925 nsIDOMNode_Release(next_sibling);
928 nsres = nsIDOMNode_AppendChild(parent, nsnode, &unused);
929 nsIDOMNode_Release(parent);
930 if (unused) nsIDOMNode_Release(unused);
934 ERR("invalid where: %s\n", debugstr_w(where));
938 if (NS_FAILED(nsres))
944 static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR where,
947 HTMLElement *This = HTMLELEM_THIS(iface);
948 nsIDOMDocumentRange *nsdocrange;
950 nsIDOMNSRange *nsrange;
956 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
958 if(!This->node.doc->nsdoc) {
959 WARN("NULL nsdoc\n");
963 nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
966 ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
969 nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &range);
970 nsIDOMDocumentRange_Release(nsdocrange);
973 ERR("CreateRange failed: %08x\n", nsres);
977 nsIDOMRange_SetStartBefore(range, (nsIDOMNode *)This->nselem);
979 nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
980 nsIDOMRange_Release(range);
983 ERR("getting nsIDOMNSRange failed: %08x\n", nsres);
987 nsAString_Init(&ns_html, html);
989 nsres = nsIDOMNSRange_CreateContextualFragment(nsrange, &ns_html, (nsIDOMDocumentFragment **)&nsnode);
990 nsIDOMNSRange_Release(nsrange);
991 nsAString_Finish(&ns_html);
993 if(NS_FAILED(nsres) || !nsnode)
995 ERR("CreateTextNode failed: %08x\n", nsres);
999 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
1000 nsIDOMNode_Release(nsnode);
1005 static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR where,
1008 HTMLElement *This = HTMLELEM_THIS(iface);
1014 TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
1016 if(!This->node.doc->nsdoc) {
1017 WARN("NULL nsdoc\n");
1018 return E_UNEXPECTED;
1022 nsAString_Init(&ns_text, text);
1023 nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
1024 nsAString_Finish(&ns_text);
1026 if(NS_FAILED(nsres) || !nsnode)
1028 ERR("CreateTextNode failed: %08x\n", nsres);
1032 hr = HTMLElement_InsertAdjacentNode(This, where, nsnode);
1033 nsIDOMNode_Release(nsnode);
1038 static HRESULT WINAPI HTMLElement_get_parentTextEdit(IHTMLElement *iface, IHTMLElement **p)
1040 HTMLElement *This = HTMLELEM_THIS(iface);
1041 FIXME("(%p)->(%p)\n", This, p);
1045 static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BOOL *p)
1047 HTMLElement *This = HTMLELEM_THIS(iface);
1048 FIXME("(%p)->(%p)\n", This, p);
1052 static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
1054 HTMLElement *This = HTMLELEM_THIS(iface);
1055 FIXME("(%p)\n", This);
1059 static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,
1060 IHTMLFiltersCollection **p)
1062 HTMLElement *This = HTMLELEM_THIS(iface);
1063 FIXME("(%p)->(%p)\n", This, p);
1067 static HRESULT WINAPI HTMLElement_put_ondragstart(IHTMLElement *iface, VARIANT v)
1069 HTMLElement *This = HTMLELEM_THIS(iface);
1070 FIXME("(%p)->()\n", This);
1074 static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT *p)
1076 HTMLElement *This = HTMLELEM_THIS(iface);
1077 FIXME("(%p)->(%p)\n", This, p);
1081 static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String)
1083 HTMLElement *This = HTMLELEM_THIS(iface);
1084 FIXME("(%p)->(%p)\n", This, String);
1088 static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v)
1090 HTMLElement *This = HTMLELEM_THIS(iface);
1091 FIXME("(%p)->()\n", This);
1095 static HRESULT WINAPI HTMLElement_get_onbeforeupdate(IHTMLElement *iface, VARIANT *p)
1097 HTMLElement *This = HTMLELEM_THIS(iface);
1098 FIXME("(%p)->(%p)\n", This, p);
1102 static HRESULT WINAPI HTMLElement_put_onafterupdate(IHTMLElement *iface, VARIANT v)
1104 HTMLElement *This = HTMLELEM_THIS(iface);
1105 FIXME("(%p)->()\n", This);
1109 static HRESULT WINAPI HTMLElement_get_onafterupdate(IHTMLElement *iface, VARIANT *p)
1111 HTMLElement *This = HTMLELEM_THIS(iface);
1112 FIXME("(%p)->(%p)\n", This, p);
1116 static HRESULT WINAPI HTMLElement_put_onerrorupdate(IHTMLElement *iface, VARIANT v)
1118 HTMLElement *This = HTMLELEM_THIS(iface);
1119 FIXME("(%p)->()\n", This);
1123 static HRESULT WINAPI HTMLElement_get_onerrorupdate(IHTMLElement *iface, VARIANT *p)
1125 HTMLElement *This = HTMLELEM_THIS(iface);
1126 FIXME("(%p)->(%p)\n", This, p);
1130 static HRESULT WINAPI HTMLElement_put_onrowexit(IHTMLElement *iface, VARIANT v)
1132 HTMLElement *This = HTMLELEM_THIS(iface);
1133 FIXME("(%p)->()\n", This);
1137 static HRESULT WINAPI HTMLElement_get_onrowexit(IHTMLElement *iface, VARIANT *p)
1139 HTMLElement *This = HTMLELEM_THIS(iface);
1140 FIXME("(%p)->(%p)\n", This, p);
1144 static HRESULT WINAPI HTMLElement_put_onrowenter(IHTMLElement *iface, VARIANT v)
1146 HTMLElement *This = HTMLELEM_THIS(iface);
1147 FIXME("(%p)->()\n", This);
1151 static HRESULT WINAPI HTMLElement_get_onrowenter(IHTMLElement *iface, VARIANT *p)
1153 HTMLElement *This = HTMLELEM_THIS(iface);
1154 FIXME("(%p)->(%p)\n", This, p);
1158 static HRESULT WINAPI HTMLElement_put_ondatasetchanged(IHTMLElement *iface, VARIANT v)
1160 HTMLElement *This = HTMLELEM_THIS(iface);
1161 FIXME("(%p)->()\n", This);
1165 static HRESULT WINAPI HTMLElement_get_ondatasetchanged(IHTMLElement *iface, VARIANT *p)
1167 HTMLElement *This = HTMLELEM_THIS(iface);
1168 FIXME("(%p)->(%p)\n", This, p);
1172 static HRESULT WINAPI HTMLElement_put_ondataavailable(IHTMLElement *iface, VARIANT v)
1174 HTMLElement *This = HTMLELEM_THIS(iface);
1175 FIXME("(%p)->()\n", This);
1179 static HRESULT WINAPI HTMLElement_get_ondataavailable(IHTMLElement *iface, VARIANT *p)
1181 HTMLElement *This = HTMLELEM_THIS(iface);
1182 FIXME("(%p)->(%p)\n", This, p);
1186 static HRESULT WINAPI HTMLElement_put_ondatasetcomplete(IHTMLElement *iface, VARIANT v)
1188 HTMLElement *This = HTMLELEM_THIS(iface);
1189 FIXME("(%p)->()\n", This);
1193 static HRESULT WINAPI HTMLElement_get_ondatasetcomplete(IHTMLElement *iface, VARIANT *p)
1195 HTMLElement *This = HTMLELEM_THIS(iface);
1196 FIXME("(%p)->(%p)\n", This, p);
1200 static HRESULT WINAPI HTMLElement_put_onfilterchange(IHTMLElement *iface, VARIANT v)
1202 HTMLElement *This = HTMLELEM_THIS(iface);
1203 FIXME("(%p)->()\n", This);
1207 static HRESULT WINAPI HTMLElement_get_onfilterchange(IHTMLElement *iface, VARIANT *p)
1209 HTMLElement *This = HTMLELEM_THIS(iface);
1210 FIXME("(%p)->(%p)\n", This, p);
1214 static HRESULT WINAPI HTMLElement_get_children(IHTMLElement *iface, IDispatch **p)
1216 HTMLElement *This = HTMLELEM_THIS(iface);
1217 nsIDOMNodeList *nsnode_list;
1220 TRACE("(%p)->(%p)\n", This, p);
1222 nsres = nsIDOMNode_GetChildNodes(This->node.nsnode, &nsnode_list);
1223 if(NS_FAILED(nsres)) {
1224 ERR("GetChildNodes failed: %08x\n", nsres);
1228 *p = (IDispatch*)create_collection_from_nodelist(This->node.doc, (IUnknown*)HTMLELEM(This), nsnode_list);
1230 nsIDOMNodeList_Release(nsnode_list);
1234 static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
1236 HTMLElement *This = HTMLELEM_THIS(iface);
1238 TRACE("(%p)->(%p)\n", This, p);
1240 *p = (IDispatch*)create_all_collection(&This->node, FALSE);
1244 #undef HTMLELEM_THIS
1246 static const IHTMLElementVtbl HTMLElementVtbl = {
1247 HTMLElement_QueryInterface,
1249 HTMLElement_Release,
1250 HTMLElement_GetTypeInfoCount,
1251 HTMLElement_GetTypeInfo,
1252 HTMLElement_GetIDsOfNames,
1254 HTMLElement_setAttribute,
1255 HTMLElement_getAttribute,
1256 HTMLElement_removeAttribute,
1257 HTMLElement_put_className,
1258 HTMLElement_get_className,
1261 HTMLElement_get_tagName,
1262 HTMLElement_get_parentElement,
1263 HTMLElement_get_style,
1264 HTMLElement_put_onhelp,
1265 HTMLElement_get_onhelp,
1266 HTMLElement_put_onclick,
1267 HTMLElement_get_onclick,
1268 HTMLElement_put_ondblclick,
1269 HTMLElement_get_ondblclick,
1270 HTMLElement_put_onkeydown,
1271 HTMLElement_get_onkeydown,
1272 HTMLElement_put_onkeyup,
1273 HTMLElement_get_onkeyup,
1274 HTMLElement_put_onkeypress,
1275 HTMLElement_get_onkeypress,
1276 HTMLElement_put_onmouseout,
1277 HTMLElement_get_onmouseout,
1278 HTMLElement_put_onmouseover,
1279 HTMLElement_get_onmouseover,
1280 HTMLElement_put_onmousemove,
1281 HTMLElement_get_onmousemove,
1282 HTMLElement_put_onmousedown,
1283 HTMLElement_get_onmousedown,
1284 HTMLElement_put_onmouseup,
1285 HTMLElement_get_onmouseup,
1286 HTMLElement_get_document,
1287 HTMLElement_put_title,
1288 HTMLElement_get_title,
1289 HTMLElement_put_language,
1290 HTMLElement_get_language,
1291 HTMLElement_put_onselectstart,
1292 HTMLElement_get_onselectstart,
1293 HTMLElement_scrollIntoView,
1294 HTMLElement_contains,
1295 HTMLElement_get_sourceIndex,
1296 HTMLElement_get_recordNumber,
1297 HTMLElement_put_lang,
1298 HTMLElement_get_lang,
1299 HTMLElement_get_offsetLeft,
1300 HTMLElement_get_offsetTop,
1301 HTMLElement_get_offsetWidth,
1302 HTMLElement_get_offsetHeight,
1303 HTMLElement_get_offsetParent,
1304 HTMLElement_put_innerHTML,
1305 HTMLElement_get_innerHTML,
1306 HTMLElement_put_innerText,
1307 HTMLElement_get_innerText,
1308 HTMLElement_put_outerHTML,
1309 HTMLElement_get_outerHTML,
1310 HTMLElement_put_outerText,
1311 HTMLElement_get_outerText,
1312 HTMLElement_insertAdjacentHTML,
1313 HTMLElement_insertAdjacentText,
1314 HTMLElement_get_parentTextEdit,
1315 HTMLElement_get_isTextEdit,
1317 HTMLElement_get_filters,
1318 HTMLElement_put_ondragstart,
1319 HTMLElement_get_ondragstart,
1320 HTMLElement_toString,
1321 HTMLElement_put_onbeforeupdate,
1322 HTMLElement_get_onbeforeupdate,
1323 HTMLElement_put_onafterupdate,
1324 HTMLElement_get_onafterupdate,
1325 HTMLElement_put_onerrorupdate,
1326 HTMLElement_get_onerrorupdate,
1327 HTMLElement_put_onrowexit,
1328 HTMLElement_get_onrowexit,
1329 HTMLElement_put_onrowenter,
1330 HTMLElement_get_onrowenter,
1331 HTMLElement_put_ondatasetchanged,
1332 HTMLElement_get_ondatasetchanged,
1333 HTMLElement_put_ondataavailable,
1334 HTMLElement_get_ondataavailable,
1335 HTMLElement_put_ondatasetcomplete,
1336 HTMLElement_get_ondatasetcomplete,
1337 HTMLElement_put_onfilterchange,
1338 HTMLElement_get_onfilterchange,
1339 HTMLElement_get_children,
1343 HRESULT HTMLElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
1345 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1349 if(IsEqualGUID(&IID_IUnknown, riid)) {
1350 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
1351 *ppv = HTMLELEM(This);
1352 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
1353 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
1354 *ppv = HTMLELEM(This);
1355 }else if(IsEqualGUID(&IID_IHTMLElement, riid)) {
1356 TRACE("(%p)->(IID_IHTMLElement %p)\n", This, ppv);
1357 *ppv = HTMLELEM(This);
1358 }else if(IsEqualGUID(&IID_IHTMLElement2, riid)) {
1359 TRACE("(%p)->(IID_IHTMLElement2 %p)\n", This, ppv);
1360 *ppv = HTMLELEM2(This);
1361 }else if(IsEqualGUID(&IID_IHTMLElement3, riid)) {
1362 TRACE("(%p)->(IID_IHTMLElement3 %p)\n", This, ppv);
1363 *ppv = HTMLELEM3(This);
1364 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
1365 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
1366 *ppv = CONPTCONT(&This->cp_container);
1370 IHTMLElement_AddRef(HTMLELEM(This));
1374 return HTMLDOMNode_QI(&This->node, riid, ppv);
1377 void HTMLElement_destructor(HTMLDOMNode *iface)
1379 HTMLElement *This = HTMLELEM_NODE_THIS(iface);
1381 ConnectionPointContainer_Destroy(&This->cp_container);
1384 nsIDOMHTMLElement_Release(This->nselem);
1386 HTMLDOMNode_destructor(&This->node);
1389 static const NodeImplVtbl HTMLElementImplVtbl = {
1391 HTMLElement_destructor
1394 static const tid_t HTMLElement_iface_tids[] = {
1403 static dispex_static_data_t HTMLElement_dispex = {
1405 DispHTMLUnknownElement_tid,
1407 HTMLElement_iface_tids
1410 void HTMLElement_Init(HTMLElement *This)
1412 This->lpHTMLElementVtbl = &HTMLElementVtbl;
1414 ConnectionPointContainer_Init(&This->cp_container, (IUnknown*)HTMLELEM(This));
1416 HTMLElement2_Init(This);
1417 HTMLElement3_Init(This);
1419 if(!This->node.dispex.data)
1420 init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex);
1423 HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_generic)
1425 nsIDOMHTMLElement *nselem;
1426 HTMLElement *ret = NULL;
1427 nsAString class_name_str;
1428 const PRUnichar *class_name;
1431 static const WCHAR wszA[] = {'A',0};
1432 static const WCHAR wszBODY[] = {'B','O','D','Y',0};
1433 static const WCHAR wszIFRAME[] = {'I','F','R','A','M','E',0};
1434 static const WCHAR wszIMG[] = {'I','M','G',0};
1435 static const WCHAR wszINPUT[] = {'I','N','P','U','T',0};
1436 static const WCHAR wszOPTION[] = {'O','P','T','I','O','N',0};
1437 static const WCHAR wszSCRIPT[] = {'S','C','R','I','P','T',0};
1438 static const WCHAR wszSELECT[] = {'S','E','L','E','C','T',0};
1439 static const WCHAR wszTABLE[] = {'T','A','B','L','E',0};
1440 static const WCHAR wszTR[] = {'T','R',0};
1441 static const WCHAR wszTEXTAREA[] = {'T','E','X','T','A','R','E','A',0};
1443 nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMHTMLElement, (void**)&nselem);
1444 if(NS_FAILED(nsres))
1447 nsAString_Init(&class_name_str, NULL);
1448 nsIDOMHTMLElement_GetTagName(nselem, &class_name_str);
1450 nsAString_GetData(&class_name_str, &class_name);
1452 if(!strcmpW(class_name, wszA))
1453 ret = HTMLAnchorElement_Create(nselem);
1454 else if(!strcmpW(class_name, wszBODY))
1455 ret = HTMLBodyElement_Create(nselem);
1456 else if(!strcmpW(class_name, wszIFRAME))
1457 ret = HTMLIFrame_Create(nselem);
1458 else if(!strcmpW(class_name, wszIMG))
1459 ret = HTMLImgElement_Create(nselem);
1460 else if(!strcmpW(class_name, wszINPUT))
1461 ret = HTMLInputElement_Create(nselem);
1462 else if(!strcmpW(class_name, wszOPTION))
1463 ret = HTMLOptionElement_Create(nselem);
1464 else if(!strcmpW(class_name, wszSCRIPT))
1465 ret = HTMLScriptElement_Create(nselem);
1466 else if(!strcmpW(class_name, wszSELECT))
1467 ret = HTMLSelectElement_Create(nselem);
1468 else if(!strcmpW(class_name, wszTABLE))
1469 ret = HTMLTable_Create(nselem);
1470 else if(!strcmpW(class_name, wszTR))
1471 ret = HTMLTableRow_Create(nselem);
1472 else if(!strcmpW(class_name, wszTEXTAREA))
1473 ret = HTMLTextAreaElement_Create(nselem);
1474 else if(use_generic)
1475 ret = HTMLGenericElement_Create(nselem);
1478 ret = heap_alloc_zero(sizeof(HTMLElement));
1479 HTMLElement_Init(ret);
1480 ret->node.vtbl = &HTMLElementImplVtbl;
1483 TRACE("%s ret %p\n", debugstr_w(class_name), ret);
1485 nsAString_Finish(&class_name_str);
1487 ret->nselem = nselem;
1488 HTMLDOMNode_Init(doc, &ret->node, (nsIDOMNode*)nselem);