Re: Looking a helper function which searches an element with a specified attribute name and value

meryl <[email protected]> Tue, 27 Apr 2010 23:47:39 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <[email protected]>
On Apr 27, 4:09 am, Boris Zbarsky <[email protected]> wrote:
> On 4/27/10 1:48 AM, meryl wrote:
>
> > Hi,
>
> > Can you please tell me if there is any helper function which searches
> > within a nsDocument and return an element with a specified attribute
> > name an value.
>
> > It is kind GetElementById() but not looking for 'id' attribute only.
>
> XUL documents have getElementsByAttribute.
>
> -Boris
I have a pointer of nsIDOMDocument (that is the DOM of a rendered
page), when I try to get the nsIDOMXULDocument so that I can use that
getElementsByAttribute() method, it returns NULL. How can I use that
getElementsByAttribute() method if i have a pointer of nsIDOMDocument?

  nsCOMPtr<nsIDOMXULDocument> xulDoc = do_QueryInterface(domDoc);

Thank you.