Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. mflorea1 +XWiki.dgervalle - Content
-
... ... @@ -29,10 +29,21 @@ 29 29 // Initialization that can rely on the fact the DOM is XWiki-tranformed goes here. 30 30 }); 31 31 {{/code}}))) 32 + 32 32 **It is recommended to bind startup scripts to this event** instead of ##window.load## or ##document.dom:loaded##. 33 33 * **##xwiki:dom:loading##** 34 34 ##xwiki:dom:loading## is sent between ##dom:loaded## and ##xwiki:dom:loaded##, before XWiki changes the DOM. This is the event that should start all scripts making important DOM changes that other scripts should see. 35 35 37 +{{warning}} 38 +If your script is loaded **deferred**, all these events may be triggered **before your script is executed** and therefore **before it has the ablity to observe these events**. Since 3.1.1, to prevent your handler to never being called, never use ##dom:loaded## anymore, and check ##XWiki.isInitialized## before waiting for ##xwiki:dom:loading##, and ##XWiki.domIsLoaded## before waiting for ##xwiki:dom:loaded##. If the flag is true, you should proceed immediately with your handler. Here is a simple construct to properly handle this:((( 39 +{{code}} 40 +function init() { 41 + // This is your initialization handler, that you generally hook to xwiki:dom:loaded 42 +} 43 +(XWiki && XWiki.domIsLoaded && init()) || document.observe("xwiki:dom:loaded", init); 44 +{{/code}}))) 45 +{{/warning}} 46 + 36 36 === Document content events (actionButtons.js) === 37 37 38 38 * **##xwiki:document:saved##** ... ... @@ -110,5 +110,6 @@ 110 110 * **##xwiki:livetable:loadingComplete##** (since 2.4 M1) (##event.memo.status## contains the response status code) 111 111 * **##xwiki:livetable:displayComplete##** (since 2.4 M1) 112 112 * **##xwiki:livetable:ready##** (since 2.4.4) 124 +* **##xwiki:livetable:loading##** (since 3.1.1) (should be used in place of ##xwiki:dom:loading## to startup livetables) 113 113 114 114 The livetable sends both generic events, named as above, and events specific to each livetable, containing the table name on the third position, such as ##xwiki:livetable:alldocs:loadingEntries##. The generic event has the table name in the memo, as ##event.memo.tableId##.