Menu

#1339 Image onload handler not called

Latest SVN
closed
RBRi
None
5
2012-10-27
2011-09-19
No

Hi Team.
I've found an interesting an somewhat annoying issue regarding the execution of HTML image onload handlers as well as the download of the images.
My example makes use of javascript that creates images dynamically and attaches it to the page. Furthermore, the created images have an onload handler that in turn creates additional images, attaches it to the page and assigns them an onload handler. This procedure forms a chain of image requests that are used to submit tracking information that have been splitted into several fragments. See the attached test case for details.

The example works fine in FF but not in HtmlUnit. None of the images is downloaded and none of the onload handlers becomes executed.
The reasons for this behaviour seem to be manifold. I've found out that the flag which is used to prevent the download of the images and the dispatching of the load event multiple times is set too early. Furthermore, it might happen that the execution of an onload handler inside of a postponed action results in a new postponed action which is not guaranteed to be executed. So, shouldn't the onload handler of an image be executed immediately when the image itself has been created by an onload handler? If I'm wrong here, feel free to correct me g.

Last but not least I would be glad if anyone could tell me more the concept of postponed actions and why there is no real event-driven approach used so far.

Discussion

  • Hartmut Arlt

    Hartmut Arlt - 2011-09-20

    Image onload handler test

     
  • Hartmut Arlt

    Hartmut Arlt - 2011-09-20

    Fixed some typos in attached testcase. Please use latest.

     
  • Hartmut Arlt

    Hartmut Arlt - 2011-10-25

    Potential Fix

     
  • Hartmut Arlt

    Hartmut Arlt - 2011-10-25

    Added patch to fix submitted issue.

     
  • RBRi

    RBRi - 2012-10-27
    • status: open --> closed
    • assigned_to: RBRi
     
  • RBRi

    RBRi - 2012-10-27

    Hartmut,

    thanks a lot for the detailed report and the patch.
    Because the code changed during the last months i have implemented only parts of your patch. Hope you like it and it works for you.

    RBRi

     

Log in to post a comment.