Re: How to print the src attribute of an ImageElement
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <6ee5315b-7c7c-479c-85b0-ab1a7c6590e1@v46g2000hsv.googlegroups.com> |
On Jan 11, 8:00 pm, Boris Zbarsky <[email protected]> wrote: > [email protected] wrote: > > printf("%s", srcAttr.get()); > > srcAttr.get() is not a char*. You want NS_ConvertUTF16toUTF8(srcAttr).get() > > -Boris Thank you. I am trying to get the url of the image in each nsImageFrame. So I try the following: nsIContent* frameContent = GetContent(); nsCOMPtr<nsIDOMHTMLImageElement> img(do_QueryInterface(frameContent)); if (img) { nsAutoString srcAttr; img->GetAttribute(NS_LITERAL_STRING("src"), srcAttr); //.... do my own stuf... } } But it turns out that no all nsImageFrame is an ImageElement. I can think of 1 example. a LI element which uses an image an the bullet. Can you please tell me how can I find the src url of the image for nsImageFrame for that case? Thank you.