getElementsByTagName returns 0-length list when called from didFinishLoad delegate
Posted
by Emerick Rogul
on Stack Overflow
See other posts from Stack Overflow
or by Emerick Rogul
Published on 2010-05-24T19:29:07Z
Indexed on
2010/06/06
12:22 UTC
Read the original article
Hit count: 248
I'm using the Chromium port of WebKit on Windows and I'm trying to retrieve a list of all of the images in my document. I figured the best way to do this was to implement WebKit::WebFrameClient::didFinishLoading
like so:
WebNodeList list = document->getElementsByTagName(L"img");
for (size_t i = 0; i < list.length(); ++i) {
// Manipulate images here...
}
However, when this delegate fires, list.length()
returns 0. The only times I've seen it return a list of non-zero length is when I substitute "body" or "head" for "img". Strangely enough, if I call getElementsByTagName(L"img")
outside of the delegate, it works correctly.
I'm guessing that the DOM isn't fully loaded when didFinishLoading
is called, but that would seem to contradict the delegate's name. Does anyone know what I may be missing here?
© Stack Overflow or respective owner