There are 4 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-851d2899-43f7-4aab-9e5c-42e5fa979e84 XWIKI-25675 Closed

The xwiki:dom:updated event sent after an asynchronous rendering targets the removed placeholder instead of the rendered content

 
View issue   ยท   Add comment
 

4 updates

 
cid:jira-generated-image-avatar-96fc5e9c-5c97-4d22-827a-177926293bec Changes by Marius Dumitru Florea on 12/Nov/26 18:18
 
Documentation: N/A
Resolution: Fixed
Tests: Unit
Status: Open Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-96fc5e9c-5c97-4d22-827a-177926293bec Marius Dumitru Florea on 12/Nov/26 18:17
 

Fixed as proposed in the description:

  • async.js parses the asynchronous result with $.parseHTML(xhr.responseText, document, false), replaces the placeholder with the parsed nodes and sends the xwiki:dom:updated event with these nodes (only the elements, not the text nodes), so the listeners initialize the content that is actually displayed.
  • Behaviour change, to mention in the release notes: the inline scripts of an asynchronous result are not executed anymore. The JavaScript files declared through the X-XWIKI-HTML-SCRIPTS HTTP response header are still loaded by xwiki.js.
  • Instead of a functional test, I added JavaScript unit tests (xwiki-platform-web-war/src/test/node/resources/uicomponents/async/_tests_/async.test.ts, run with Vitest as part of the web-war build), which check that the placeholder is replaced by the result, that the event targets the inserted elements and that the inline scripts of the result are not executed. The last two fail without the fix.