Review main Abandoned

58890[TASK] Drop jQuery dependency in FormControl modules

Andreas Kienast CR 0 V 0 Easy +10 −16 updated 11/19/18, 08:03

Commit message

Currently in all re-written FormControl modules jQuery is only used for
ready(). This is not necessary, the modules now drop the dependency and
use VanillaJS instead.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 10

Review log 1415

  1. Andreas Kienast uploaded patch set 1 11/13/18, 16:47

  2. TYPO3com voted on patch set 1 V +1 11/13/18, 16:56 Completed build in 08m 34s on Tue, 13 Nov, 05:56 PM Test Summary: 48464 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30133

  3. Andreas Kienast commented on patch set 1 11/13/18, 18:36

    This needs proper testing in all suppirted browsers.
  4. Markus Klein commented on patch set 1 11/13/18, 21:43

    You are aware of the "slight" difference of the ready function and the native way? Most browsers provide similar functionality in the form of a DOMContentLoaded event. However, jQuery's .ready() method differs in an important and useful way: If the DOM becomes ready and the browser fires DOMContentLoaded before the code calls .ready( handler ), the function handler will still be executed. In contrast, a DOMContentLoaded event listener added after the event fires is never executed. https://api.jquery.com/ready/
  5. Markus Klein commented on patch set 1 11/13/18, 21:44

    So we not only need testing in all browsers, but more importantly tests with a lot of different connection speeds to avoid timing issues
  6. Andreas Wolf commented on patch set 1 11/14/18, 01:48

    Good point Markus, I've been bitten by this in the past as well. However, there is a way to circumvent this. Have a look at https://github.com/ded/domready/blob/master/ready.js for example. I think we should either include and use that, or create a similar module in our code. For reference, the trick is to encapsulate the functionality in a custom method, that checks if the event has been fired (i.e. if the readyState of document is set accordingly), and if yes, immediately executes the passed callback. I guess this is also what jQuery does.
  7. Andreas Kienast commented on patch set 1 11/14/18, 01:57

    When we go with another library, we should go with domReady, which acts as a RequireJS plugin.
  8. Markus Klein commented on patch set 1 11/14/18, 10:00

    Fine with me, I would not implement that ourselves if I look at the code which domReady ships... It's just not nice ^^
  9. Andreas Wolf commented on patch set 1 11/14/18, 10:57

    Yes, but I think that with some proper comments, the code would be more readable… as it currently is, I'm not sure if minification actually makes it worse :-D
  10. Benni Mack commented on patch set 1 11/15/18, 09:07

    Hey Andy, can you update the patch using domReady from requireJS?
  11. Andreas Kienast commented on patch set 1 11/15/18, 09:56

    > Patch Set 1: > > Hey Andy, can you update the patch using domReady from requireJS? Hi, probably not today. I guess I'll make it at the weekend, we're rolling to our gate now :D
  12. Andreas Kienast commented on patch set 1 11/18/18, 14:04

    I found this ticket regarding domReady: https://forge.typo3.org/issues/78975 Now I question myself whether we should use that library after I've read Olly's remark on this. What do you think? Long term goal: I think we should reduce the usage of jQuery in future, especially since browsers have a common set of APIs, but AFAICS there are no separated jQuery "modules" that tackle our specific needs. I opt to keep the jQuery stuff here for now, until we have a proper solution.
  13. Markus Klein commented on patch set 1 11/18/18, 19:59

    Fine with me. I don't know if there is a "more" proper solution than jQuery already has to be honest.
  14. Benni Mack commented on patch set 1 11/19/18, 07:52

    yup. let's keep jQuery for now.
  15. Andreas Kienast abandoned the change 11/19/18, 08:03