Opened 4 years ago
Closed 6 months ago
#54172 closed enhancement (duplicate)
Twenty Fifteen: Replace frontend jQuery usage with Interactivity API
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | javascript, performance | Cc: |
Description
Using jQuery for a few simple JS interactions in WordPress themes is a common performance problem, which is in most cases relatively straightforward to address: Vanilla JavaScript has for the better part of a decade included enough APIs that work across all popular browsers so that the remaining benefits of jQuery are around a few utility functions, that could be re-implemented in a few lines of code. Using jQuery for such simple use-cases results in around 80% more JS code being loaded in the frontend.
This ticket focuses on removing jQuery as a frontend dependency for Twenty Fifteen - specifically the frontend, as for example in the Customizer jQuery is loaded anyway (and performance is a bit less of a concern there).
Also see #54171, which does the same for Twenty Twelve.
Change History (10)
This ticket was mentioned in PR #1682 on WordPress/wordpress-develop by adamsilverstein.
4 years ago
#1
- Keywords has-patch added; needs-patch removed
#2
@
4 years ago
- Summary changed from Replace frontend jQuery usage with vanilla JS in Twenty Fifteen to Twenty Fifteen: Replace frontend jQuery usage with vanilla JS
3 years ago
#3
Adding a note that after these changes, the JS will no longer work correctly in IE 11. I'm not sure whether this is a concern, given that on the one hand we've deprecated it, but on the other hand we may want to preserve this theme working correctly in older versions of WordPress and their supported browsers.
felixarntz commented on PR #1682:
3 years ago
#4
@sgomes Thanks for the review! I addressed your feedback via code updates and comments above.
#5
@
3 years ago
Note that the implementation for this depends on whether we will drop IE support in the theme or not. The discussion around this should be centralized in https://core.trac.wordpress.org/ticket/55126#comment:2, which does the same for Twenty Sixteen.
#7
@
8 months ago
@flixos90 this like another ticket seems to be sat with you, happy to leave those with you but would love to see some progress as we focus on clearing this component.
#8
@
8 months ago
@karmatosed Similar to my reply in https://core.trac.wordpress.org/ticket/54171#comment:9, I would like for this to remain open as we are thinking about the next steps.
cc @adamsilverstein
#9
@
6 months ago
- Keywords needs-refresh added
- Milestone changed from Awaiting Review to Future Release
- Summary changed from Twenty Fifteen: Replace frontend jQuery usage with vanilla JS to Twenty Fifteen: Replace frontend jQuery usage with Interactivity API
Per https://core.trac.wordpress.org/ticket/61027#comment:10, I'm going to update the purpose of this ticket slightly: With the Interactivity API available, we should focus these efforts on using the Interactivity API instead of vanilla JS as a replacement for jQuery.
As such, this will need a refresh. Please read the linked comment on the overarching ticket for additional context.
Trac ticket: https://core.trac.wordpress.org/ticket/54172