The scenario is as follows.
#1) The page, displays a list of expandable items. If an item is
expanded, its body is dynamically inserted into the page (just another
piece of HTML).
#2) The search should include current HTML on the page and also all
bodies that don't have to exist on the page (typically all items are
collapsed).
#3) If the search algorithm, finds out that the specified text is
within a body that is *not* currently displayed, the body (HTML) is
dynamically inserted (visually, the item is automatically expanded).
#4) The new created DOM is immediately used to create a DOM range and
passed to range-finder (nsIFind). But it always returns null even if
the text is there (I can see it on the page)...
If I execute the step #4 asynchronously, it works and the finder
returns proper range (nsIDOMRange).
Is it possible that the page must be somehow relayouted before it's
ready for the search? If this theory is correct, can I force the page
to be relayouted synchronously?
Thanks for any tips!
(I am currently quite struggling with this)
Honza
Does doing |document.body.offsetWidth;| on the document in question
between inserting the new DOM nodes and making the nsIFind call make
things work?
-Boris
Yes.
This means that nsIFind just needs to call FlushPendingNotifications in
the appropriate methods.
Rob
Exactly. Jan, can you please file a bug on this?
-Boris
Honza