Re: Identifying HTML DOM elements

skaushik_at_hotmail.com
Date: 12/15/04


Date: 14 Dec 2004 17:05:40 -0800


> > Given an HTML DOM of a Web page, is the value of an
> > IHTMLDOMNode pointer for an element guaranteed to remain
> > the same, regardless of how the pointer is obtained?
> > In other words, can I compare two IHTMLDOMNode pointer
> > values and conclude that they refer to the same element?
>
> You should be able to, but you must use COM identity comparison. That
> is, explicitly QI both pointers for IUnknown, and compare resulting
> IUnknown pointers.

Well, I did not explicity QI for IUnknown, but the two pointers
being compared were of the same type (IHTMLDOMNode).

Incidentally, I just found out about this interface called
IHTMLUniqueName. Callinh IHTMLUniqueName::get_uniqueID() returns a
unique string for each element and I can use that for comparison,
but I'd much rather aviod a method call if I can get by with a
pointer comparison.

While we are on the topic, is there a way to tell whether a given
HTML DOM node p appears before or after another node q?
("Before" and "after" here are of course with respect to a
top-down, left-right traversal of the DOM tree.)

Thanks,

-K



Relevant Pages

  • Re: Identifying HTML DOM elements
    ... >> IHTMLDOMNode pointer for an element guaranteed to remain ... > is, explicitly QI both pointers for IUnknown, and compare resulting ... HTML DOM node p appears before or after another node q? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Identifying HTML DOM elements
    ... >> IHTMLDOMNode pointer for an element guaranteed to remain ... > is, explicitly QI both pointers for IUnknown, and compare resulting ... HTML DOM node p appears before or after another node q? ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: ATL and object aggregation (more)
    ... I don't think you should call Releaseon an interface's pointer. ... an helper method that is called by the 'true' COM interface method ... > It's wrong because the IUnknown interface will be lost during the Query ... then the IInObj3Ptr InObj3Ptr constructor is ...
    (microsoft.public.vc.atl)
  • Re: In-process cross-thread (cross-apartment) marshaling
    ... interface IJingleNotify: IUnknown ... // Marshal interface pointer into worker thread ...
    (microsoft.public.win32.programmer.ole)
  • Re: Relative to absolute URL in an IE-Embedded ActiveX Control?
    ... 'this' pointer, usually. ... >> If you implement IOleObject, ... >> ActiveX control has to implement IOleObject. ... > Is this issue related to the way to find the IUnknown pointer of my ...
    (microsoft.public.vc.atl)