Task #78975

Refactor DOM ready check with AMD loader plugin domReady

Added by Gleb Levitin almost 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2016-12-13
Due date:
% Done:

0%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

In #70601 a lot of RequireJS AMDs were provided with a DOM ready check function to prevend their potential run into race condition.
The DOM ready check was taken with JQuery. It works, but in RequireJS there is an AMD loader plugin domReady for this purpose. It should be used instead.

Here is the appropriate API documentation and an understandable example:

http://requirejs.org/docs/api.html#pageload


Related issues

Related to TYPO3 Core - Bug #70601: Add missing to DOM ready checks to all AMD modules Closed 2015-10-12
Related to TYPO3 Core - Bug #78976: Add missing DOM ready check for JavaScripts in filelist module Closed 2016-12-13

History

#1 Updated by Frank Naegler almost 2 years ago

  • Status changed from New to Needs Feedback

We currently working on a migration to TypeScript, but this alone will not fix this issue, but now it is a good time to talk about other solutions like this one.
Can you explain what is the benefit of this plugin agains jQuery?

#2 Updated by Frank Naegler over 1 year ago

  • Status changed from Needs Feedback to Closed

no feedback within the last three months, so I will close this issue for now.

#3 Updated by Oliver Hader over 1 year ago

I don't think we should use the requireJS domReady plugin since

  • we basically have to deal with applications that are executed in a browser and jQuery's onReady handling in the root component handles that already
  • the mentioned plugin has not been maintained during the last 2 years and has around 130 forks
  • looking into the code reveals some "hacks", e.g. https://github.com/requirejs/domReady/blob/master/domReady.js#L86

Basically, maintaining an internal ready stack is similar in both jQuery and the requireJS plugin.

My conclusion: Let's stay with jQuery ready handling...

Also available in: Atom PDF