From 4c5504444076a25d70cb9aa9bdb97056c4882a93 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Thu, 6 May 2021 10:53:32 +0530 Subject: [PATCH] Remove duplicate code and avoid DOM search operation. refs #6355 --- web/pgadmin/browser/static/js/panel.js | 6 +----- web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/web/pgadmin/browser/static/js/panel.js b/web/pgadmin/browser/static/js/panel.js index c0371b2dc..c9e64132b 100644 --- a/web/pgadmin/browser/static/js/panel.js +++ b/web/pgadmin/browser/static/js/panel.js @@ -98,11 +98,7 @@ define( } // Prevent browser from opening the drag file. - $('.pg-panel-content').bind('dragover', function (event) { - event.stopPropagation(); - event.preventDefault(); - }); - $('.pg-panel-content').bind('drop', function (event) { + $container.bind('dragover drop', function (event) { event.stopPropagation(); event.preventDefault(); }); diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index e396fdf7d..7f93c5e83 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -493,11 +493,7 @@ define('tools.querytool', [ }); // Prevent browser from opening the drag file. - $('#datagrid').bind('dragover', function (event) { - event.stopPropagation(); - event.preventDefault(); - }); - $('#datagrid').bind('drop', function (event) { + $('#datagrid').bind('dragover drop', function (event) { event.stopPropagation(); event.preventDefault(); });