This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-7b78735c-a357-4fc2-a980-cab333bd9e7a XWIKI-25704 Open

The async placeholder observer forces a page layout for every element added to the page

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-cf9bad6f-9b54-49e3-a2c2-6de4b027454d Manuel Leduc created this issue on 09/Nov/26 14:55
 
Summary: The async placeholder observer forces a page layout for every element added to the page
Issue Type: cid:jira-generated-image-avatar-7b78735c-a357-4fc2-a980-cab333bd9e7a Improvement
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Rendering - Async
Created: 09/Nov/26 14:55
Priority: cid:jira-generated-image-static-major-ffe25b81-50bd-4800-9c40-e1a7d675e017 Major
Reporter: Manuel Leduc
Description:

The asynchronous rendering script (uicomponents/async/async.js) observes the whole document with a MutationObserver (childList, subtree and attributes). For every added node it runs $(node).find('.xwiki-async:visible').addBack('.xwiki-async:visible'). jQuery evaluates :visible by reading offsetWidth, which forces a synchronous layout of the page, for elements that are not async placeholders at all.

Every script that adds elements to a page pays for it. Measured on a Live Data page change with 100 rows: about 37 ms of main-thread time, about 8% of the page change, spent in this observer.

The attributes option is useless (only addedNodes are read), but makes the browser queue a mutation record for every attribute change in the page.

Proposal

  • Select the .xwiki-async elements first, and only check the visibility of the matches.
  • Stop observing attributes.
 
 

1 update

 
cid:jira-generated-image-avatar-cf9bad6f-9b54-49e3-a2c2-6de4b027454d Changes by Manuel Leduc on 09/Nov/26 14:55
 
Fix Version: 18.10.0-rc-1