JS: Respect container in Icinga.Ui.focusElement()

Though IDs should be unique across the whole page, focusElement() must
not fail if there is the same anchor in the left and right column.
focusElement() now also respects the container when searching the
element to focus by ID.
This commit is contained in:
Eric Lippmann 2020-01-16 10:35:39 +01:00 committed by Johannes Meyer
parent 05135e716e
commit 0355b20da0
1 changed files with 5 additions and 1 deletions

View File

@ -153,7 +153,11 @@
var $element = element;
if (typeof element === 'string') {
$element = $('#' + element);
if ($container && $container.length) {
$element = $container.find('#' + element);
} else {
$element = $('#' + element);
}
if (! $element.length) {
// The name attribute is actually deprecated, on anchor tags,