Review main Abandoned

64315[TASK] Reduce inline JavaScript for refreshing backend components

Oliver Hader CR 0 V 0 Normal +38 −26 updated 07/13/20, 11:18

Commit message

Left-hand module menu and top toolbar are refreshed using inline
JavaScript when e.g. an extension is de-/activated in extension
manager or users switch their backend language in setup module.

To avoid inline JavaScript data-attributes handled by JavaScript
module `ActionDispatcher` are used. Custom Element `<typo3-data>`
is introduced with does not have a specific meaning, but has the
general `HTMLElement` interface.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 4

Review log 1115

  1. Oliver Hader uploaded patch set 1 04/25/20, 08:39

  2. Oliver Hader wrote 04/25/20, 08:39

    Topic set to inline-javascript
  3. TYPO3com voted on patch set 1 V -1 04/25/20, 08:51 Completed build in 11m 36s on Sat, 25 Apr, 08:51 AM Test Summary: 10 of 74141 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3024

  4. TYPO3com voted on patch set 1 V +1 04/25/20, 09:21 Completed build in 53m 07s on Sat, 25 Apr, 09:21 AM Test Summary: 73657 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3024

  5. Jonas Eberle voted on patch set 1 V +1 04/26/20, 10:44

  6. Oliver Hader rebased onto patch set 2 05/19/20, 17:44

  7. TYPO3com voted on patch set 2 V +1 05/19/20, 18:01 Completed build in 16m 04s on Tue, 19 May, 06:01 PM Test Summary: 73799 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3464

  8. Andreas Kienast commented on patch set 2 V +1 05/21/20, 12:11

    TriggerViewHelper.php:75

    May we switch to the <output> tag stay standard compliant?
  9. Benni Mack updated the commit message in patch set 3 05/25/20, 18:52

  10. Oliver Hader commented on patch set 3 05/27/20, 08:43

    TriggerViewHelper.php:75 Reply Unresolved

    I don't think the tag "typo3-data" violates any standards. Since no other custom element is defined, it inherits from HTMLElement. I'll test how other browser vendors are actually interpreting this. Otherwise we also could just use `<div>` or `<span>´...
  11. Oliver Hader rebased onto patch set 4 05/27/20, 23:24

  12. TYPO3com voted on patch set 4 V +1 05/28/20, 00:00 Completed build in 35m 45s on Thu, 28 May, 12:00 AM Test Summary: 73709 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3598

  13. Benjamin Franzke commented on patch set 4 06/03/20, 19:48

    SetupModuleController.php:380 Unresolved

    I'm fine with a custom element, but I'd like to avoid too generic ones. How about actually implementing the delegate/dispatch logic within a custom HTML element, if we start to use them, eg: <typo3-dispatch-immediately action="%s"/></typo3-dispatch-immediately> We could then simplify the rather complex multi-usecase-scenario of data-dispatch-action (with and without immediate dispatch) attribute that has been added in https://review.typo3.org/c/Packages/TYPO3.CMS/+/64130 That patch added data-dispatch-immediately attribute, but it wasn't used until now. The following code: new RegularEvent('click', this.handleClickEvent.bind(this)) .delegateTo(document, '[data-dispatch-action]:not([data-dispatch-immediately])'); document.querySelectorAll('[data-dispatch-action][data-dispatch-immediately]') .forEach(this.delegateTo.bind(this)); Could therefore safely be simplified to: new RegularEvent('click', this.handleClickEvent.bind(this)) .delegateTo(document, '[data-dispatch-action]'); Please see this patch for the described alternative approach using custom HTML elements: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64675
  14. Oliver Hader commented on patch set 4 06/03/20, 20:01

    +1 in general on going the custom-elements way, see my comments in the change you just referenced Using custom-elements feels for sane and clean - thanks for creating the PoC!
  15. Oliver Hader abandoned the change 07/13/20, 11:18