-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISBAT use CoBlocks without jQuery #1365
Comments
We can use the Fetch API to replace this. Reference: |
This would be a very welcome improvement. I was running performance tests on a scratch site and just activating the CoBlocks plugin was enough to trigger adding jQuery, jQuery Migrate ( and slick.js ) for page views. In mobile performance tests I ran, activating the CoBlocks plugin slowed down start render by more than 30%. There are great resources on replacing jQuery code with vanilla JS, like http://youmightnotneedjquery.com/ - which can be very helpful in an update like this, in combination with targeting IE and IE versions ( if that is a concern ). See also WordPress/gutenberg#15256 |
We'll likely need to break this down into phases, the first being removing what we can more easily remove/migrate from. The second being the bigger moves - such as the lightbox/slider functionalities. |
Is your feature request related to a problem? Please describe.
CoBlocks should consider removing jQuery as a required dependency for the plugin. Getting a look at the plugin I find that 20 files reference
jQuery
which could be refactored to use plain JavaScript. This change would help to make CoBlocks more performant.Required changes
Events & Post Carousel block
src/js/coblocks-events.js
initializes slick in the DOM. - Needs Block refactorsrc/js/coblocks-slick-initializer-front.js
- Will be removed following Events/Post-Carousel refactor ( In progress )src/js/coblocks-slick-initializer.js
- Will be removed following Events/Post-Carousel refactor ( In progress )Form block - jQuery UI Datepicker | Should be another open-source date picker.
edit.js
file ( Remove jQuery Phase 1 #1376 )src/js/coblocks-datepicker.js
Should be removed. ( Remove jQuery Datepicker from Form Block #2180 )includes/class-coblocks-form.php
Should not reference jquery-ui-datepicker. ( Remove jQuery Datepicker from Form Block #2180 )src/js/coblocks-google-recaptcha.js
Should not use jQuery. ( Remove jQuery from Recaptcha script #2131 )Gif block
edit.js
file ( Remove jQuery Phase 1 #1376 )Gallery Carousel
src/js/coblocks-accordion-carousel.js
- ( PR: #2147 )Gallery Masonry
src/js/coblocks-masonry.js
Google Maps Script
src/js/coblocks-google-maps.js
CoBlocks Lightbox
src/js/coblocks-lightbox.js
CoBlocks Crop Settings Extension & Component
Cleanup tasks
includes/class-coblocks-block-assets.php
and remove jQuery from dependency arrays.- This file will be able to remove all references to jQuery once the following blocks are refactored
- Events
- Post-Carousel
devDependencies
- As stated above, both the Events and Post-Carousel blocks must be refactored away from Slick before we can remove jQuery from the devDependencies file
Inspired by WordPress.org support request
https://wordpress.org/support/topic/did-you-start-using-jquery-in-a-recent-release/
The text was updated successfully, but these errors were encountered: