Skip to content
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

Remove jQuery in the frontend for Twenty Fifteen. #1682

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Sep 17, 2021

  • Replace jQuery usage in Twenty Fifteen frontend scripts with vanilla JS.
  • Don't require jQuery to be loaded in the frontend as a result of the above.

Trac ticket: https://core.trac.wordpress.org/ticket/54172


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

var $body, $window, $sidebar, resizeTimer,
secondary, button;
( function() {
function domReady( callback ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, replace this with our domReady package, which should be available at wp.domReady after enqueueing "wp-dom-ready".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a perfect world I'd agree, but it would mean we have to bump the minimum required WordPress version of Twenty Fifteen which is currently 4.1. Given how widely it's probably still used on old sites I'd argue this may not be enough of a benefit to justify a bump.

But for newer themes for sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

@felixarntz felixarntz marked this pull request as ready for review September 23, 2021 19:14
Copy link

@sgomes sgomes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work removing jQuery where it's not needed 👍

Here's the first round of review comments.

src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
src/wp-content/themes/twentyfifteen/js/functions.js Outdated Show resolved Hide resolved
@sgomes
Copy link

sgomes commented Feb 9, 2022

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
Copy link
Member

@sgomes Thanks for the review! I addressed your feedback via code updates and comments above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants