Skip to content

Remove jQuery in the frontend for Twenty Fifteen.#1682

Open
adamsilverstein wants to merge 6 commits into
WordPress:trunkfrom
felixarntz:remove/jquery-2015
Open

Remove jQuery in the frontend for Twenty Fifteen.#1682
adamsilverstein wants to merge 6 commits into
WordPress:trunkfrom
felixarntz:remove/jquery-2015

Conversation

@adamsilverstein

@adamsilverstein adamsilverstein commented Sep 17, 2021

Copy link
Copy Markdown
Member
  • 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point!

Comment thread src/wp-content/themes/twentyfifteen/js/functions.js
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js
@felixarntz felixarntz marked this pull request as ready for review September 23, 2021 19:14

@sgomes sgomes left a comment

Copy link
Copy Markdown

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.

Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/functions.js Outdated
Comment thread src/wp-content/themes/twentyfifteen/js/keyboard-image-navigation.js Outdated
@sgomes

sgomes commented Feb 9, 2022

Copy link
Copy Markdown

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

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

@adamsilverstein

Copy link
Copy Markdown
Member Author

This branch lives on a fork that can no longer be updated, so the trunk conflicts here can't be resolved in place. A refreshed version of this PR, merged with current trunk and with the review feedback above incorporated, is now up at #12410.

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