From 0d9b07a6e468c6822fbfe619aa93e152ba46da40 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 29 Aug 2022 15:04:43 +0300 Subject: [PATCH] Fix Bug 57826 --- apps/common/main/lib/util/utils.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 03aac86ae..b1d58e132 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -997,23 +997,27 @@ jQuery.fn.extend({ var _el = document.getElementById(id.substring(1)); if ( !_el ) { parent = parent || this; - if ( parent instanceof jQuery ) { + if ( parent && parent.length > 0 ) { parent.each(function (i, node) { - _el = node.querySelectorAll(id); - if ( _el.length == 0 ) { - if ( ('#' + node.id) == id ) { - _el = node; + if (node.querySelectorAll) { + _el = node.querySelectorAll(id); + if ( _el.length == 0 ) { + if ( ('#' + node.id) == id ) { + _el = node; + return false; + } + } else + if ( _el.length ) { + _el = _el[0]; return false; } - } else - if ( _el.length ) { - _el = _el[0]; - return false; } }) } else { - _el = parent.querySelectorAll(id); - if ( _el && _el.length ) return _el[0]; + if (parent && parent.querySelectorAll) { + _el = parent.querySelectorAll(id); + if ( _el && _el.length ) return _el[0]; + } } }