From 6c46def154a3c43cc9a9f7518761e7ed09dc71a3 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Thu, 22 Mar 2018 15:52:22 +0000 Subject: [PATCH] Remove usage of $.browser as it's unused and deprecated in jQuery. Fixes #14267 --- .../view/frontend/web/js/model/step-navigator.js | 2 +- .../Checkout/view/frontend/web/js/view/progress-bar.js | 5 ++--- .../view/adminhtml/templates/system/config/edit.phtml | 3 +-- app/code/Magento/Theme/view/base/requirejs-config.js | 2 -- app/code/Magento/User/view/adminhtml/web/app-config.js | 2 -- app/design/frontend/Magento/blank/etc/view.xml | 1 - app/design/frontend/Magento/luma/etc/view.xml | 1 - app/design/frontend/Magento/rush/etc/view.xml | 1 - .../testsuite/Magento/Deploy/_files/zoom1/etc/view.xml | 1 - lib/web/jquery/jquery.ba-hashchange.min.js | 9 --------- lib/web/mage/popup-window.js | 10 ++-------- 11 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 lib/web/jquery/jquery.ba-hashchange.min.js diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js b/app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js index 0210fa37bb9ad..3827a174b3396 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js @@ -144,7 +144,7 @@ define([ */ navigateTo: function (code, scrollToElementId) { var sortedItems = steps().sort(this.sortItems), - bodyElem = $.browser.safari || $.browser.chrome ? $('body') : $('html'); + bodyElem = $('body'); scrollToElementId = scrollToElementId || null; diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js index 0cbc16ef72bc3..72cf4e3d479c3 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js @@ -8,8 +8,7 @@ define([ 'underscore', 'ko', 'uiComponent', - 'Magento_Checkout/js/model/step-navigator', - 'jquery/jquery.hashchange' + 'Magento_Checkout/js/model/step-navigator' ], function ($, _, ko, Component, stepNavigator) { 'use strict'; @@ -25,7 +24,7 @@ define([ /** @inheritdoc */ initialize: function () { this._super(); - $(window).hashchange(_.bind(stepNavigator.handleHash, stepNavigator)); + window.addEventListener('hashchange', _.bind(stepNavigator.handleHash, stepNavigator)); stepNavigator.handleHash(); }, diff --git a/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml b/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml index 8264c7d7b396a..a1e26b7805d4b 100644 --- a/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml +++ b/app/code/Magento/Config/view/adminhtml/templates/system/config/edit.phtml @@ -32,7 +32,6 @@ require([ "jquery", "uiRegistry", - "jquery/jquery.hashchange", "mage/mage", "prototype", "mage/adminhtml/form", @@ -379,7 +378,7 @@ require([ return false; }; - jQuery(window).hashchange(handleHash); + window.addEventListener('hashchange', handleHash); handleHash(); registry.set('adminSystemConfig', adminSystemConfig); diff --git a/app/code/Magento/Theme/view/base/requirejs-config.js b/app/code/Magento/Theme/view/base/requirejs-config.js index bd72a3d74fad1..c5ebd40e896e1 100644 --- a/app/code/Magento/Theme/view/base/requirejs-config.js +++ b/app/code/Magento/Theme/view/base/requirejs-config.js @@ -15,7 +15,6 @@ var config = { }, 'shim': { 'jquery/jquery-migrate': ['jquery'], - 'jquery/jquery.hashchange': ['jquery', 'jquery/jquery-migrate'], 'jquery/jstree/jquery.hotkeys': ['jquery'], 'jquery/hover-intent': ['jquery'], 'mage/adminhtml/backup': ['prototype'], @@ -39,7 +38,6 @@ var config = { 'jquery/validate': 'jquery/jquery.validate', 'jquery/hover-intent': 'jquery/jquery.hoverIntent', 'jquery/file-uploader': 'jquery/fileUploader/jquery.fileupload-fp', - 'jquery/jquery.hashchange': 'jquery/jquery.ba-hashchange.min', 'prototype': 'legacy-build.min', 'jquery/jquery-storageapi': 'jquery/jquery.storageapi.min', 'text': 'mage/requirejs/text', diff --git a/app/code/Magento/User/view/adminhtml/web/app-config.js b/app/code/Magento/User/view/adminhtml/web/app-config.js index 0a58d181276ae..6387bec03ea90 100644 --- a/app/code/Magento/User/view/adminhtml/web/app-config.js +++ b/app/code/Magento/User/view/adminhtml/web/app-config.js @@ -9,7 +9,6 @@ require.config({ 'waitSeconds': 0, 'shim': { - 'jquery/jquery.hashchange': ['jquery'], 'jquery/jstree/jquery.hotkeys': ['jquery'], 'jquery/hover-intent': ['jquery'], 'mage/adminhtml/backup': ['prototype'], @@ -28,7 +27,6 @@ require.config({ 'jquery/validate': 'jquery/jquery.validate', 'jquery/hover-intent': 'jquery/jquery.hoverIntent', 'jquery/file-uploader': 'jquery/fileUploader/jquery.fileupload-fp', - 'jquery/jquery.hashchange': 'jquery/jquery.ba-hashchange.min', 'prototype': 'prototype/prototype-amd', 'text': 'requirejs/text', 'domReady': 'requirejs/domReady', diff --git a/app/design/frontend/Magento/blank/etc/view.xml b/app/design/frontend/Magento/blank/etc/view.xml index 8264e3111de88..78fb54c0b54e4 100644 --- a/app/design/frontend/Magento/blank/etc/view.xml +++ b/app/design/frontend/Magento/blank/etc/view.xml @@ -260,7 +260,6 @@ Lib::jquery/jquery.min.js Lib::jquery/jquery-ui-1.9.2.js - Lib::jquery/jquery.ba-hashchange.min.js Lib::jquery/jquery.details.js Lib::jquery/jquery.details.min.js Lib::jquery/jquery.hoverIntent.js diff --git a/app/design/frontend/Magento/luma/etc/view.xml b/app/design/frontend/Magento/luma/etc/view.xml index 349224a34022c..08e6883da995e 100644 --- a/app/design/frontend/Magento/luma/etc/view.xml +++ b/app/design/frontend/Magento/luma/etc/view.xml @@ -270,7 +270,6 @@ Lib::jquery/jquery.min.js Lib::jquery/jquery-ui-1.9.2.js - Lib::jquery/jquery.ba-hashchange.min.js Lib::jquery/jquery.details.js Lib::jquery/jquery.details.min.js Lib::jquery/jquery.hoverIntent.js diff --git a/app/design/frontend/Magento/rush/etc/view.xml b/app/design/frontend/Magento/rush/etc/view.xml index 1f8b416e1af79..cb963250c5e6e 100644 --- a/app/design/frontend/Magento/rush/etc/view.xml +++ b/app/design/frontend/Magento/rush/etc/view.xml @@ -261,7 +261,6 @@ Lib::jquery/jquery.min.js Lib::jquery/jquery-ui-1.9.2.js - Lib::jquery/jquery.ba-hashchange.min.js Lib::jquery/jquery.details.js Lib::jquery/jquery.details.min.js Lib::jquery/jquery.hoverIntent.js diff --git a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/etc/view.xml b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/etc/view.xml index 17026f9ce77ec..37a45fbbfe430 100644 --- a/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/etc/view.xml +++ b/dev/tests/integration/testsuite/Magento/Deploy/_files/zoom1/etc/view.xml @@ -12,7 +12,6 @@ Lib::jquery/jquery.min.js Lib::jquery/jquery-ui-1.9.2.js - Lib::jquery/jquery.ba-hashchange.min.js Lib::jquery/jquery.details.js Lib::jquery/jquery.details.min.js Lib::jquery/jquery.hoverIntent.js diff --git a/lib/web/jquery/jquery.ba-hashchange.min.js b/lib/web/jquery/jquery.ba-hashchange.min.js deleted file mode 100644 index 3c607bae3d6ec..0000000000000 --- a/lib/web/jquery/jquery.ba-hashchange.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * jQuery hashchange event - v1.3 - 7/21/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('