Changes for page XWiki JavaScript API

Last modified by Simon Urli on 2022/09/14

<
From version < 15.1 >
edited by Denis Gervalle
on 2011/07/01
To version < 16.1 >
edited by Sergiu Dumitriu
on 2012/10/25
>
Change comment: Document xwiki:dom:updated

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.dgervalle
1 +XWiki.Sergiu
Content
... ... @@ -33,6 +33,8 @@
33 33  **It is recommended to bind startup scripts to this event** instead of ##window.load## or ##document.dom:loaded##.
34 34  * **##xwiki:dom:loading##**
35 35  ##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.
36 +* **##xwiki:dom:updated##**
37 +This event is sent whenever an important change in the DOM occurs, such as loading new content in a dialog box or tab, or refreshing the document content. Scripts that add behavior to certain elements, or which enhance the DOM, should listen to this event as well and re-apply their initialization process on the updated content, the same way that the whole DOM is enhanced on ##xwiki:dom:loaded##. The list of new or updated elements is sent in the ##event.memo.elements## property.
36 36  
37 37  {{warning}}
38 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:(((
... ... @@ -56,7 +56,7 @@
56 56  * **##xwiki:actions:cancel##**
57 57  This event is sent after the user clicks the "Cancel" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually cancelling the edit.
58 58  * **##xwiki:actions:preview##**
59 -This event is sent after ther use clicks the "Preview" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually leaving the edit mode.
61 +This event is sent after the user clicks the "Preview" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually leaving the edit mode.
60 60  * **##xwiki:actions:save##**
61 61  This event is sent after the user clicks the "Save" or "Save & Continue" button of an editor (Wiki, WYSIWYG, object, rights, etc.), but before actually submitting the form. A memo is available if you need to know if the intend is to continue after the save, in ##event.memo['continue']##. You can use it as follows:(((
62 62  {{code language="javascript"}}

Get Connected