Uploaded image for project: 'Click'
  1. Click
  2. CLK-245

addLoadEvent improvement

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.4
    • 1.5 M1
    • core
    • None

    Description

      The script control.js contains the function 'addLoadEvent'. This function enables one to add multiple onload events to a page.

      There are two problems with the current function.

      1) If the <body> tag contains a 'onload' event, and the javascript is placed in the <head> of a page, the addLoadEvent does not seem to fire its events.
      2) The events added to the above function, only fires after the entire web page (including all images) have been loaded.

      An alternative approach which is used by some of the AJAX libraries (JQuery, mootools), is based on Dead Edwards code found here: http://dean.edwards.name/weblog/2006/06/again/

      There are a few available reusable scripts on the net, which provides this technique.

      The downside is that it looks like pretty nasty javascript code (or perhaps it just points to my lack of javascript knowledge

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--domloaded.js
          2 kB
          Bob Schellink
        2. ASF.LICENSE.NOT.GRANTED--test-onload1.html
          2 kB
          Bob Schellink
        3. ASF.LICENSE.NOT.GRANTED--test-onload2.html
          2 kB
          Bob Schellink

        Activity

          People

            sabob Bob Schellink
            sabob Bob Schellink
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: