[BUGFIX] Avoid race condition in DocumentService.ready()
Improve document-service responsiveness by relying on `DOMContentLoaded` and `document.readyState` >= `interactive`. 1) Handle non-loading state as "ready" to avoid waiting for `complete`. `document.readyState` has three states: * `loading` The document is still loading. * `interactive` The document has finished loading and the document has been parsed but sub-resources such as scripts, images, stylesheets and frames are still loading. The state indicates that the DOMContentLoaded event is about to fire. * `complete` The document and all sub-resources have finished loading. The state indicates that the load event is about to fire. If DocumentService.ready was called in "interactive" state we have been skipping this state as we only considered `complete` to be the "ready" state in this case. This is wrong as we actually wait for the DOMContentLoaded if we are launche...
Showing
- Build/Sources/TypeScript/core/Resources/Public/TypeScript/DocumentService.ts 9 additions, 33 deletions...cript/core/Resources/Public/TypeScript/DocumentService.ts
- typo3/sysext/core/Resources/Public/JavaScript/DocumentService.js 1 addition, 1 deletion...ysext/core/Resources/Public/JavaScript/DocumentService.js
Please register or sign in to comment