Don't use jQuerry anymore #67

Closed
opened 2021-10-28 00:20:23 +02:00 by Some-Twilight-Sparkle · 7 comments

I'd like to point out this message of nextcloud:

jQuery is deprecated: The global jQuery is deprecated. It will be updated to v3.x in Nextcloud 21. In later versions of Nextcloud it might be removed completely. Please ship your own.

I recommend moving away from jQuery entirely. It's way too overblown for a menu and there are better methodes these days.

And a menu should be as lightwight as possible.

If you need help with moving certain functionality away from jQuery, feel free to tell, and I'll see whether I can help.

Best regards,

some random Dev who hated jQuery from the first day and hence hasn't used it in any project ;)
No seriously, I never liked it, one reason I moved from web to backend stuff.

I'd like to point out this message of nextcloud: > jQuery is deprecated: The global jQuery is deprecated. It will be updated to v3.x in Nextcloud 21. In later versions of Nextcloud it might be removed completely. Please ship your own. I recommend moving away from jQuery entirely. It's way too overblown for a menu and there are better methodes these days. And a menu should be as lightwight as possible. If you need help with moving certain functionality away from jQuery, feel free to tell, and I'll see whether I can help. Best regards, some random Dev who hated jQuery from the first day and hence hasn't used it in any project ;) No seriously, I never liked it, one reason I moved from web to backend stuff.
deblan added the
enhancement
label 2021-10-28 08:47:50 +02:00
Owner

jQuery in used by/included in Nextcloud, that's why I use it too. I will replace jQuery code by vanilla JS but I need time :)

jQuery in used by/included in Nextcloud, that's why I use it too. I will replace jQuery code by vanilla JS but I need time :)
deblan added the
WIP
label 2021-10-28 13:22:14 +02:00
Owner

Work in progress on feature/removing-jquery

Work in progress on [feature/removing-jquery](https://gitnet.fr/deblan/side_menu/src/branch/feature/removing-jquery)
Owner

99% of jquery has been removed (excepted admin.js).

Do you know how to replace https://gitnet.fr/deblan/side_menu/src/branch/feature/removing-jquery/templates/js/_topMenuApps.js#L139-L140 with vanilla js?

99% of jquery has been removed (excepted admin.js). Do you know how to replace https://gitnet.fr/deblan/side_menu/src/branch/feature/removing-jquery/templates/js/_topMenuApps.js#L139-L140 with vanilla js?
deblan added a new dependency 2021-10-29 11:28:35 +02:00
Owner
`admin.js` is now refactored. Still 3 calls to jquery: * https://gitnet.fr/deblan/side_menu/src/commit/c53221d1129a3e6774c3c3094968cb3d251b6c42/templates/js/_topMenuApps.js#L139 * https://gitnet.fr/deblan/side_menu/src/commit/c53221d1129a3e6774c3c3094968cb3d251b6c42/templates/js/_topMenuApps.js#L140 * https://gitnet.fr/deblan/side_menu/src/commit/c53221d1129a3e6774c3c3094968cb3d251b6c42/src/admin.js#L179

Regarding _topMenuApp.js L139 and L140:
Would it be okay to remove all eventListeners (or all 'click' eventListeners) of the element? – Then I'd have a solution. Otherwise, I'd be unsure, how to recieve the EventListener reference. But I can try some stuff over the weekend.

Regarding c53221d112/src/admin.js (L179):
We might have to use a library like html5sortable or SortableJS
Both weight about 2kB gzipped, hence much smaller than jquery. A tradeoff we can do, I suppose.

Regarding _topMenuApp.js L139 and L140: Would it be okay to remove all eventListeners (or all 'click' eventListeners) of the element? – Then I'd have a solution. Otherwise, I'd be unsure, how to recieve the EventListener reference. But I can try some stuff over the weekend. Regarding c53221d112/src/admin.js (L179): We might have to use a library like [html5sortable](https://github.com/lukasoppermann/html5sortable) or [SortableJS](https://github.com/SortableJS/Sortable) Both weight about 2kB gzipped, hence much smaller than jquery. A tradeoff we can do, I suppose.
Owner

html5sortable included!

Would it be okay to remove all eventListeners

All 'click' event listeners must be removed to override the click behaviour that show the loaders.

`html5sortable` included! > Would it be okay to remove all eventListeners All 'click' event listeners must be removed to override the click behaviour that show the loaders.
Owner

Released in v2.0.0 excepted delegate/undelegate!

Released in v2.0.0 excepted delegate/undelegate!
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: deblan/side_menu#67
No description provided.