Skip to content

Commit

Permalink
Remove jQuery from common bundle (Fixes #9946)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Jul 9, 2021
1 parent fe47424 commit ebca8ee
Show file tree
Hide file tree
Showing 21 changed files with 9 additions and 149 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.js
@@ -1,17 +1,11 @@
module.exports = {
env: {
'jquery': true,
'jasmine': true
},
extends: [
'@mozilla-protocol/eslint-config',
'plugin:no-jquery/recommended',
'plugin:no-jquery/all',
'plugin:json/recommended'
],
plugins: [
'no-jquery'
],
/**
* Provide a set of overrides for `gulpfile.js` in the root directory.
* Ideally we want to extend @mozilla-protocol/eslint-config/index-node,
Expand Down
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/firefox/accounts.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/firefox/index.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/firefox/mobile.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/firefox/new/download.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/home/home-de.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/home/home-en.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
4 changes: 0 additions & 4 deletions bedrock/exp/templates/exp/home/home-fr.html
Expand Up @@ -20,7 +20,3 @@
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
2 changes: 0 additions & 2 deletions bedrock/exp/templates/exp/includes/convert.html
Expand Up @@ -6,6 +6,4 @@
{# Pre-fetch the DNS lookup prior to loading the convert script #}
<link rel="dns-prefetch" href="https://cdn-3.convertexperiments.com/">
{{ js_bundle('convert') }}
{% else %}
{{ js_bundle('jquery') }}
{% endif %}
11 changes: 0 additions & 11 deletions bedrock/exp/templates/exp/includes/js.html

This file was deleted.

5 changes: 0 additions & 5 deletions bedrock/exp/templates/exp/opt-out.html
Expand Up @@ -11,7 +11,6 @@
{% block page_desc %}{{ _('Your privacy is very important to Mozilla. This page will enable you to opt-out of Convert experiments on www.mozilla.org') }}{% endblock %}

{% block experiments %}
{{ js_bundle('jquery') }}
<script type="text/javascript" src="https://cdn-3.convertexperiments.com/js/{{ settings.CONVERT_PROJECT_ID }}.js" async></script>
{% endblock %}

Expand Down Expand Up @@ -67,7 +66,3 @@ <h1 class="mzp-c-article-title">{{ _('Opt-out of Convert experiments') }}</h1>
{% block stub_attribution %}
{% include 'exp/includes/stub.html' %}
{% endblock %}

{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
16 changes: 0 additions & 16 deletions bedrock/firefox/templates/firefox/campaign/unfck/index.html
Expand Up @@ -273,22 +273,6 @@ <h2 class="c-section-title">And here are more ways to get the web back on track<
{% endwith %}
{% endblock %}

{% block site_js %}
{% if switch('unfck-convert') %}
<!--[if !IE]><!-->
{{ js_bundle('common-no-jquery') }}
<!--<![endif]-->
{% else %}
<!--[if !IE]><!-->
{{ js_bundle('common') }}
<!--<![endif]-->
{% endif %}

<!--[if IE]>
{{ js_bundle('common-ie') }}
<![endif]-->
{% endblock %}

{% block stub_attribution %}
{% if settings.STUB_ATTRIBUTION_RATE %}
{% if switch('unfck-convert') %}
Expand Down
8 changes: 4 additions & 4 deletions contribute.json
Expand Up @@ -36,11 +36,11 @@
"demo5": "https://www-demo5.allizom.org"
},
"keywords": [
"python",
"sass-css",
"django",
"html",
"jinja2",
"html5",
"jquery"
"protocol",
"python",
"sass-css"
]
}
4 changes: 0 additions & 4 deletions docs/abtest.rst
Expand Up @@ -49,10 +49,6 @@ Templates within the ``/exp/`` app should have the following characteristics:
{% include 'exp/includes/stub.html' %}
{% endblock %}
{% block site_js %}
{% include 'exp/includes/js.html' %}
{% endblock %}
3. If a page is indexed by search engines, then the experimental equivalent should have a canonical URL that points back to the original page. If the page is considered to be an in-product page, then the experimental page should retain the same noindex meta tag.

.. code-block:: jinja
Expand Down
12 changes: 2 additions & 10 deletions media/js/ie/base-page-init-ie.js
Expand Up @@ -2,15 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global $ */

/**
* General DOM ready handler applied to all pages in base template.
*/

/* eslint-disable no-jquery/no-class */
/* eslint-disable no-jquery/no-jquery-constructor */
/* eslint-disable no-jquery/no-other-methods */
/* eslint-disable no-jquery/no-ready-shorthand */

$(document).ready(function() {
'use strict';

Expand All @@ -24,8 +21,3 @@ $(document).ready(function() {
$('html').addClass('loaded');
});
});

/* eslint-enable no-jquery/no-class */
/* eslint-enable no-jquery/no-jquery-constructor */
/* eslint-enable no-jquery/no-other-methods */
/* eslint-enable no-jquery/no-ready-shorthand */
20 changes: 2 additions & 18 deletions media/js/ie/mozilla-utils-ie.js
Expand Up @@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global $ */

// Create namespace
if (typeof window.Mozilla === 'undefined') {
window.Mozilla = {};
Expand All @@ -10,15 +12,6 @@ if (typeof window.Mozilla === 'undefined') {
(function() {
'use strict';

/* eslint-disable no-jquery/no-attr */
/* eslint-disable no-jquery/no-data */
/* eslint-disable no-jquery/no-each-collection */
/* eslint-disable no-jquery/no-event-shorthand */
/* eslint-disable no-jquery/no-find-collection */
/* eslint-disable no-jquery/no-jquery-constructor */
/* eslint-disable no-jquery/no-other-methods */
/* eslint-disable no-jquery/no-visibility */

var UtilsIE = {};

/**
Expand Down Expand Up @@ -67,13 +60,4 @@ if (typeof window.Mozilla === 'undefined') {

window.Mozilla.UtilsIE = UtilsIE;

/* eslint-enable no-jquery/no-attr */
/* eslint-enable no-jquery/no-data */
/* eslint-enable no-jquery/no-each-collection */
/* eslint-enable no-jquery/no-event-shorthand */
/* eslint-enable no-jquery/no-find-collection */
/* eslint-enable no-jquery/no-jquery-constructor */
/* eslint-enable no-jquery/no-other-methods */
/* eslint-enable no-jquery/no-visibility */

})();
2 changes: 0 additions & 2 deletions media/js/libs/jquery-3.5.1.min.js

This file was deleted.

36 changes: 0 additions & 36 deletions media/static-bundles.json
Expand Up @@ -1339,7 +1339,6 @@
},
{
"files": [
"js/libs/jquery-3.5.1.min.js",
"js/base/class-list-polyfill.js",
"js/base/search-params.js",
"js/base/mozilla-utils.js",
Expand All @@ -1366,34 +1365,6 @@
],
"name": "common"
},
{
"files": [
"js/base/mozilla-utils.js",
"js/base/mozilla-client.js",
"js/base/class-list-polyfill.js",
"js/base/mozilla-run.js",
"protocol/js/protocol-supports.js",
"protocol/js/protocol-utils.js",
"js/base/protocol/protocol-menu.js",
"js/base/protocol/protocol-navigation.js",
"js/base/protocol/init-navigation.js",
"protocol/js/protocol-lang-switcher.js",
"js/base/protocol/init-lang-switcher.js",
"protocol/js/protocol-details.js",
"js/base/protocol/protocol-footer.js",
"js/base/protocol/protocol-sub-navigation.js",
"js/base/base-page-init.js",
"js/base/core-datalayer.js",
"js/base/core-datalayer-init.js",
"js/base/search-params.js",
"js/base/uitour-lib.js",
"js/base/mozilla-fxa-link.js",
"js/base/mozilla-fxa-link-init.js",
"js/base/fxa-utm-referral.js",
"js/base/fxa-utm-referral-init.js"
],
"name": "common-no-jquery"
},
{
"files": [
"js/base/mozilla-article.js",
Expand All @@ -1413,17 +1384,10 @@
},
{
"files": [
"js/libs/jquery-3.5.1.min.js",
"js/exp/convert.js"
],
"name": "convert"
},
{
"files": [
"js/libs/jquery-3.5.1.min.js"
],
"name": "jquery"
},
{
"files": [
"js/libs/modernizr.custom.inputtypes.js",
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -36,7 +36,6 @@
"browser-sync": "^2.26.13",
"concurrently": "^6.0.1",
"eslint-plugin-json": "^2.1.1",
"eslint-plugin-no-jquery": "^2.5.0",
"jasmine-core": "3.4.0",
"karma": "^6.3.2",
"karma-chrome-launcher": "3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/karma.conf.js
Expand Up @@ -12,7 +12,7 @@ module.exports = function(config) {
// list of files / patterns to load in the browser
files: [
// begin common dependencies.
'media/js/libs/jquery-3.5.1.min.js',
'media/js/libs/jquery-1.12.4.min.js', // only used by legacy IE bundle
'media/js/base/site.js',
'media/js/base/mozilla-utils.js',
'media/js/base/mozilla-client.js',
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Expand Up @@ -2050,11 +2050,6 @@ eslint-plugin-json@^2.1.1:
lodash "^4.17.15"
vscode-json-languageservice "^3.5.1"

eslint-plugin-no-jquery@^2.5.0:
version "2.5.0"
resolved "https://registry.npmjs.org/eslint-plugin-no-jquery/-/eslint-plugin-no-jquery-2.5.0.tgz"
integrity sha512-RrQ380mUJJKdjgpQ/tZAJ3B3W1n3LbVmULooS2Pv5pUDcc5uVHVSJMTdUlsbvQyfo6hWP2LJ4FbOoDzENWcF7A==

eslint-scope@^5.1.0:
version "5.1.0"
resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz"
Expand Down

0 comments on commit ebca8ee

Please sign in to comment.