[MSHTML]
[reactos.git] / reactos / dll / win32 / mshtml / htmlanchor.c
1 /*
2 * Copyright 2007 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19 #include <stdarg.h>
20 #include <stdio.h>
21
22 #define COBJMACROS
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28
29 #include "wine/debug.h"
30
31 #include "mshtml_private.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34
35 typedef struct {
36 HTMLElement element;
37
38 const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl;
39
40 nsIDOMHTMLAnchorElement *nsanchor;
41 } HTMLAnchorElement;
42
43 #define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl)
44
45 #define HTMLANCHOR_THIS(iface) DEFINE_THIS(HTMLAnchorElement, HTMLAnchorElement, iface)
46
47 static HRESULT WINAPI HTMLAnchorElement_QueryInterface(IHTMLAnchorElement *iface,
48 REFIID riid, void **ppv)
49 {
50 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
51
52 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
53 }
54
55 static ULONG WINAPI HTMLAnchorElement_AddRef(IHTMLAnchorElement *iface)
56 {
57 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
58
59 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
60 }
61
62 static ULONG WINAPI HTMLAnchorElement_Release(IHTMLAnchorElement *iface)
63 {
64 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
65
66 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
67 }
68
69 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfoCount(IHTMLAnchorElement *iface, UINT *pctinfo)
70 {
71 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
72 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->element.node.dispex), pctinfo);
73 }
74
75 static HRESULT WINAPI HTMLAnchorElement_GetTypeInfo(IHTMLAnchorElement *iface, UINT iTInfo,
76 LCID lcid, ITypeInfo **ppTInfo)
77 {
78 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
79 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->element.node.dispex), iTInfo, lcid, ppTInfo);
80 }
81
82 static HRESULT WINAPI HTMLAnchorElement_GetIDsOfNames(IHTMLAnchorElement *iface, REFIID riid,
83 LPOLESTR *rgszNames, UINT cNames,
84 LCID lcid, DISPID *rgDispId)
85 {
86 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
87 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
88 }
89
90 static HRESULT WINAPI HTMLAnchorElement_Invoke(IHTMLAnchorElement *iface, DISPID dispIdMember,
91 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
92 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
93 {
94 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
95 return IDispatchEx_Invoke(DISPATCHEX(&This->element.node.dispex), dispIdMember, riid, lcid,
96 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
97 }
98
99 static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR v)
100 {
101 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
102 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
103 return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p)
107 {
108 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
109 nsAString href_str;
110 nsresult nsres;
111 HRESULT hres;
112
113 TRACE("(%p)->(%p)\n", This, p);
114
115 nsAString_Init(&href_str, NULL);
116 nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
117 if(NS_SUCCEEDED(nsres)) {
118 const PRUnichar *href;
119
120 nsAString_GetData(&href_str, &href);
121 hres = nsuri_to_url(href, TRUE, p);
122 }else {
123 ERR("GetHref failed: %08x\n", nsres);
124 hres = E_FAIL;
125 }
126
127 nsAString_Finish(&href_str);
128 return hres;
129 }
130
131 static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v)
132 {
133 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
134 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
135 return E_NOTIMPL;
136 }
137
138 static HRESULT WINAPI HTMLAnchorElement_get_target(IHTMLAnchorElement *iface, BSTR *p)
139 {
140 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
141 FIXME("(%p)->(%p)\n", This, p);
142 return E_NOTIMPL;
143 }
144
145 static HRESULT WINAPI HTMLAnchorElement_put_rel(IHTMLAnchorElement *iface, BSTR v)
146 {
147 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
148 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
149 return E_NOTIMPL;
150 }
151
152 static HRESULT WINAPI HTMLAnchorElement_get_rel(IHTMLAnchorElement *iface, BSTR *p)
153 {
154 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
155 FIXME("(%p)->(%p)\n", This, p);
156 return E_NOTIMPL;
157 }
158
159 static HRESULT WINAPI HTMLAnchorElement_put_rev(IHTMLAnchorElement *iface, BSTR v)
160 {
161 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
162 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
163 return E_NOTIMPL;
164 }
165
166 static HRESULT WINAPI HTMLAnchorElement_get_rev(IHTMLAnchorElement *iface, BSTR *p)
167 {
168 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
169 FIXME("(%p)->(%p)\n", This, p);
170 return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI HTMLAnchorElement_put_urn(IHTMLAnchorElement *iface, BSTR v)
174 {
175 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
176 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
177 return E_NOTIMPL;
178 }
179
180 static HRESULT WINAPI HTMLAnchorElement_get_urn(IHTMLAnchorElement *iface, BSTR *p)
181 {
182 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
183 FIXME("(%p)->(%p)\n", This, p);
184 return E_NOTIMPL;
185 }
186
187 static HRESULT WINAPI HTMLAnchorElement_put_Methods(IHTMLAnchorElement *iface, BSTR v)
188 {
189 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
190 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
191 return E_NOTIMPL;
192 }
193
194 static HRESULT WINAPI HTMLAnchorElement_get_Methods(IHTMLAnchorElement *iface, BSTR *p)
195 {
196 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
197 FIXME("(%p)->(%p)\n", This, p);
198 return E_NOTIMPL;
199 }
200
201 static HRESULT WINAPI HTMLAnchorElement_put_name(IHTMLAnchorElement *iface, BSTR v)
202 {
203 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
204 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
205 return E_NOTIMPL;
206 }
207
208 static HRESULT WINAPI HTMLAnchorElement_get_name(IHTMLAnchorElement *iface, BSTR *p)
209 {
210 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
211 FIXME("(%p)->(%p)\n", This, p);
212 return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI HTMLAnchorElement_put_host(IHTMLAnchorElement *iface, BSTR v)
216 {
217 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
218 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
219 return E_NOTIMPL;
220 }
221
222 static HRESULT WINAPI HTMLAnchorElement_get_host(IHTMLAnchorElement *iface, BSTR *p)
223 {
224 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
225 FIXME("(%p)->(%p)\n", This, p);
226 return E_NOTIMPL;
227 }
228
229 static HRESULT WINAPI HTMLAnchorElement_put_hostname(IHTMLAnchorElement *iface, BSTR v)
230 {
231 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
232 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
233 return E_NOTIMPL;
234 }
235
236 static HRESULT WINAPI HTMLAnchorElement_get_hostname(IHTMLAnchorElement *iface, BSTR *p)
237 {
238 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
239 FIXME("(%p)->(%p)\n", This, p);
240 return E_NOTIMPL;
241 }
242
243 static HRESULT WINAPI HTMLAnchorElement_put_pathname(IHTMLAnchorElement *iface, BSTR v)
244 {
245 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
246 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
247 return E_NOTIMPL;
248 }
249
250 static HRESULT WINAPI HTMLAnchorElement_get_pathname(IHTMLAnchorElement *iface, BSTR *p)
251 {
252 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
253 FIXME("(%p)->(%p)\n", This, p);
254 return E_NOTIMPL;
255 }
256
257 static HRESULT WINAPI HTMLAnchorElement_put_port(IHTMLAnchorElement *iface, BSTR v)
258 {
259 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
260 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
261 return E_NOTIMPL;
262 }
263
264 static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR *p)
265 {
266 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
267 FIXME("(%p)->(%p)\n", This, p);
268 return E_NOTIMPL;
269 }
270
271 static HRESULT WINAPI HTMLAnchorElement_put_protocol(IHTMLAnchorElement *iface, BSTR v)
272 {
273 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
274 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
275 return E_NOTIMPL;
276 }
277
278 static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, BSTR *p)
279 {
280 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
281 FIXME("(%p)->(%p)\n", This, p);
282 return E_NOTIMPL;
283 }
284
285 static HRESULT WINAPI HTMLAnchorElement_put_search(IHTMLAnchorElement *iface, BSTR v)
286 {
287 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
288 FIXME("(%p)->(%p)\n", This, debugstr_w(v));
289 return E_NOTIMPL;
290 }
291
292 static HRESULT WINAPI HTMLAnchorElement_get_search(IHTMLAnchorElement *iface, BSTR *p)
293 {
294 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
295 FIXME("(%p)->(%p)\n", This, p);
296 return E_NOTIMPL;
297 }
298
299 static HRESULT WINAPI HTMLAnchorElement_put_hash(IHTMLAnchorElement *iface, BSTR v)
300 {
301 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
302 FIXME("(%p)->(%s)\n", This, debugstr_w(v));
303 return E_NOTIMPL;
304 }
305
306 static HRESULT WINAPI HTMLAnchorElement_get_hash(IHTMLAnchorElement *iface, BSTR *p)
307 {
308 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
309 FIXME("(%p)->(%p)\n", This, p);
310 return E_NOTIMPL;
311 }
312
313 static HRESULT WINAPI HTMLAnchorElement_put_onblur(IHTMLAnchorElement *iface, VARIANT v)
314 {
315 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
316
317 TRACE("(%p)->()\n", This);
318
319 return IHTMLElement2_put_onblur(HTMLELEM2(&This->element), v);
320 }
321
322 static HRESULT WINAPI HTMLAnchorElement_get_onblur(IHTMLAnchorElement *iface, VARIANT *p)
323 {
324 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
325
326 TRACE("(%p)->(%p)\n", This, p);
327
328 return IHTMLElement2_get_onblur(HTMLELEM2(&This->element), p);
329 }
330
331 static HRESULT WINAPI HTMLAnchorElement_put_onfocus(IHTMLAnchorElement *iface, VARIANT v)
332 {
333 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
334
335 TRACE("(%p)->()\n", This);
336
337 return IHTMLElement2_put_onfocus(HTMLELEM2(&This->element), v);
338 }
339
340 static HRESULT WINAPI HTMLAnchorElement_get_onfocus(IHTMLAnchorElement *iface, VARIANT *p)
341 {
342 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
343
344 TRACE("(%p)->(%p)\n", This, p);
345
346 return IHTMLElement2_get_onfocus(HTMLELEM2(&This->element), p);
347 }
348
349 static HRESULT WINAPI HTMLAnchorElement_put_accessKey(IHTMLAnchorElement *iface, BSTR v)
350 {
351 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
352
353 TRACE("(%p)->(%s)\n", This, debugstr_w(v));
354
355 return IHTMLElement2_put_accessKey(HTMLELEM2(&This->element), v);
356 }
357
358 static HRESULT WINAPI HTMLAnchorElement_get_accessKey(IHTMLAnchorElement *iface, BSTR *p)
359 {
360 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
361
362 TRACE("(%p)->(%p)\n", This, p);
363
364 return IHTMLElement2_get_accessKey(HTMLELEM2(&This->element), p);
365 }
366
367 static HRESULT WINAPI HTMLAnchorElement_get_protocolLong(IHTMLAnchorElement *iface, BSTR *p)
368 {
369 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
370 FIXME("(%p)->(%p)\n", This, p);
371 return E_NOTIMPL;
372 }
373
374 static HRESULT WINAPI HTMLAnchorElement_get_mimeType(IHTMLAnchorElement *iface, BSTR *p)
375 {
376 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
377 FIXME("(%p)->(%p)\n", This, p);
378 return E_NOTIMPL;
379 }
380
381 static HRESULT WINAPI HTMLAnchorElement_get_nameProp(IHTMLAnchorElement *iface, BSTR *p)
382 {
383 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
384 FIXME("(%p)->(%p)\n", This, p);
385 return E_NOTIMPL;
386 }
387
388 static HRESULT WINAPI HTMLAnchorElement_put_tabIndex(IHTMLAnchorElement *iface, short v)
389 {
390 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
391
392 TRACE("(%p)->()\n", This);
393
394 return IHTMLElement2_put_tabIndex(HTMLELEM2(&This->element), v);
395 }
396
397 static HRESULT WINAPI HTMLAnchorElement_get_tabIndex(IHTMLAnchorElement *iface, short *p)
398 {
399 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
400
401 TRACE("(%p)->(%p)\n", This, p);
402
403 return IHTMLElement2_get_tabIndex(HTMLELEM2(&This->element), p);
404 }
405
406 static HRESULT WINAPI HTMLAnchorElement_focus(IHTMLAnchorElement *iface)
407 {
408 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
409
410 TRACE("(%p)\n", This);
411
412 return IHTMLElement2_focus(HTMLELEM2(&This->element));
413 }
414
415 static HRESULT WINAPI HTMLAnchorElement_blur(IHTMLAnchorElement *iface)
416 {
417 HTMLAnchorElement *This = HTMLANCHOR_THIS(iface);
418
419 TRACE("(%p)\n", This);
420
421 return IHTMLElement2_blur(HTMLELEM2(&This->element));
422 }
423
424 #undef HTMLANCHOR_THIS
425
426 static const IHTMLAnchorElementVtbl HTMLAnchorElementVtbl = {
427 HTMLAnchorElement_QueryInterface,
428 HTMLAnchorElement_AddRef,
429 HTMLAnchorElement_Release,
430 HTMLAnchorElement_GetTypeInfoCount,
431 HTMLAnchorElement_GetTypeInfo,
432 HTMLAnchorElement_GetIDsOfNames,
433 HTMLAnchorElement_Invoke,
434 HTMLAnchorElement_put_href,
435 HTMLAnchorElement_get_href,
436 HTMLAnchorElement_put_target,
437 HTMLAnchorElement_get_target,
438 HTMLAnchorElement_put_rel,
439 HTMLAnchorElement_get_rel,
440 HTMLAnchorElement_put_rev,
441 HTMLAnchorElement_get_rev,
442 HTMLAnchorElement_put_urn,
443 HTMLAnchorElement_get_urn,
444 HTMLAnchorElement_put_Methods,
445 HTMLAnchorElement_get_Methods,
446 HTMLAnchorElement_put_name,
447 HTMLAnchorElement_get_name,
448 HTMLAnchorElement_put_host,
449 HTMLAnchorElement_get_host,
450 HTMLAnchorElement_put_hostname,
451 HTMLAnchorElement_get_hostname,
452 HTMLAnchorElement_put_pathname,
453 HTMLAnchorElement_get_pathname,
454 HTMLAnchorElement_put_port,
455 HTMLAnchorElement_get_port,
456 HTMLAnchorElement_put_protocol,
457 HTMLAnchorElement_get_protocol,
458 HTMLAnchorElement_put_search,
459 HTMLAnchorElement_get_search,
460 HTMLAnchorElement_put_hash,
461 HTMLAnchorElement_get_hash,
462 HTMLAnchorElement_put_onblur,
463 HTMLAnchorElement_get_onblur,
464 HTMLAnchorElement_put_onfocus,
465 HTMLAnchorElement_get_onfocus,
466 HTMLAnchorElement_put_accessKey,
467 HTMLAnchorElement_get_accessKey,
468 HTMLAnchorElement_get_protocolLong,
469 HTMLAnchorElement_get_mimeType,
470 HTMLAnchorElement_get_nameProp,
471 HTMLAnchorElement_put_tabIndex,
472 HTMLAnchorElement_get_tabIndex,
473 HTMLAnchorElement_focus,
474 HTMLAnchorElement_blur
475 };
476
477 #define HTMLANCHOR_NODE_THIS(iface) DEFINE_THIS2(HTMLAnchorElement, element.node, iface)
478
479 static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
480 {
481 HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
482
483 *ppv = NULL;
484
485 if(IsEqualGUID(&IID_IUnknown, riid)) {
486 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
487 *ppv = HTMLANCHOR(This);
488 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
489 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
490 *ppv = HTMLANCHOR(This);
491 }else if(IsEqualGUID(&IID_IHTMLAnchorElement, riid)) {
492 TRACE("(%p)->(IID_IHTMLAnchorElement %p)\n", This, ppv);
493 *ppv = HTMLANCHOR(This);
494 }
495
496 if(*ppv) {
497 IUnknown_AddRef((IUnknown*)*ppv);
498 return S_OK;
499 }
500
501 return HTMLElement_QI(&This->element.node, riid, ppv);
502 }
503
504 static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
505 {
506 HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface);
507
508 if(This->nsanchor)
509 nsIDOMHTMLAnchorElement_Release(This->nsanchor);
510
511 HTMLElement_destructor(&This->element.node);
512 }
513
514 #undef HTMLANCHOR_NODE_THIS
515
516 static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
517 HTMLAnchorElement_QI,
518 HTMLAnchorElement_destructor
519 };
520
521 static const tid_t HTMLAnchorElement_iface_tids[] = {
522 IHTMLAnchorElement_tid,
523 IHTMLDOMNode_tid,
524 IHTMLDOMNode2_tid,
525 IHTMLElement_tid,
526 IHTMLElement2_tid,
527 IHTMLElement3_tid,
528 IHTMLElement4_tid,
529 IHTMLTextContainer_tid,
530 IHTMLUniqueName_tid,
531 0
532 };
533
534 static dispex_static_data_t HTMLAnchorElement_dispex = {
535 NULL,
536 DispHTMLAnchorElement_tid,
537 NULL,
538 HTMLAnchorElement_iface_tids
539 };
540
541 HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
542 {
543 HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
544 nsresult nsres;
545
546 ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
547 ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
548
549 HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
550
551 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
552 if(NS_FAILED(nsres))
553 ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
554
555 return &ret->element;
556 }