Edgewall Software

Changes between Version 3 and Version 4 of TracDev/JavaScript


Ignore:
Timestamp:
Dec 8, 2008, 4:33:03 PM (15 years ago)
Author:
techtonik <techtonik@…>
Comment:

add comments from discussion http://groups.google.com/group/trac-dev/browse_thread/thread/bd2ad5f23b6a988

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/JavaScript

    v3 v4  
    2121There is a good description of closures and `(function(){})()` construct at http://ajaxian.com/archives/secrets-of-the-javascript-ninja-a-sneak-peak-for-ajaxians
    2222
     23==== $(document).ready() ====
     24
     25To execute and modify DOM tree JavaScript function should usually wait until a page fully loads. With jQuery it looks like:
    2326{{{
    24 #!comment
    25 add comments from the http://groups.google.com/group/trac-dev/browse_thread/thread/bd2ad5f23b6a988?hl=en
     27$(document).ready(function_name);
    2628}}}
     29In non-conflicting mode, code that executed in Trac on page startup is enveloped in closure and looks like:
     30{{{
     31jQuery(document).ready(function($) { ... });
     32}}}