Bug Tracker

Changes between Initial Version and Version 1 of Ticket #6768, comment 2


Ignore:
Timestamp:
Oct 14, 2010, 1:13:25 AM (12 years ago)
Author:
johncrenshaw
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6768, comment 2

    initial v1  
    88
    99The changes and reasons are explained in comments in the code, but I'll cover them here too:
    10 1. I added an _onReady function as a stub for ready(). This way addEventListener can bind to _onReady, and anyone overriding ready() doesn't also need to repair the listener binding. (At best, repairing the binding requires a complex and nasty kludge.)
    11 2. Previously, the code used {{{readyList = null}}} to reset the list of ready functions. This is technically an error, and prevents the list from being reused if needed (such as when writing a robust include handler.) I changed this to reset using {{{readyList = []}}} instead, which keeps the variable contents consistent, and opens doors to future possibilities.
    12 3. and 4. I changed the addEventListener events to bind to _onReady (instead of binding directly to ready, which is what they did before.) See 1 for an explanation of this.
     10
     111) I added an _onReady function as a stub for ready(). This way addEventListener can bind to _onReady, and anyone overriding ready() doesn't also need to repair the listener binding. (At best, repairing the binding requires a complex and nasty kludge.)
     12
     132) Previously, the code used {{{readyList = null}}} to reset the list of ready functions. This is technically an error, and prevents the list from being reused if needed (such as when writing a robust include handler.) I changed this to reset using {{{readyList = []}}} instead, which keeps the variable contents consistent, and opens doors to future possibilities.
     14
     153) and 4) I changed the addEventListener events to bind to _onReady (instead of binding directly to ready, which is what they did before.) See 1 for an explanation of this.
    1316
    1417These changes don't improve performance, they correct seemingly minor style issues that became a huge limitation later when writing a plugin. The edits are trivial and don't affect the normal operation of jQuery.