mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 07:14:35 +02:00
JS: Use _this when saving a reference to this in Navigation::onRendered()
There a tons of places where we use self instead of _this. self is a global variable in modern browsers. refs #5543
This commit is contained in:
parent
802cba3fb8
commit
bb432fcc68
@ -47,10 +47,11 @@
|
|||||||
* @param evt {Object} The event context
|
* @param evt {Object} The event context
|
||||||
*/
|
*/
|
||||||
Navigation.prototype.onRendered = function(evt) {
|
Navigation.prototype.onRendered = function(evt) {
|
||||||
var self = evt.data.self;
|
var _this = evt.data.self;
|
||||||
|
|
||||||
this.element = evt.target;
|
this.element = evt.target;
|
||||||
|
|
||||||
if (! self.active) {
|
if (! _this.active) {
|
||||||
// There is no stored menu item, therefore it is assumed that this is the first rendering
|
// There is no stored menu item, therefore it is assumed that this is the first rendering
|
||||||
// of the navigation after the page has been opened.
|
// of the navigation after the page has been opened.
|
||||||
|
|
||||||
@ -58,14 +59,15 @@
|
|||||||
var $menus = $('#menu li.active', evt.target);
|
var $menus = $('#menu li.active', evt.target);
|
||||||
if ($menus.size()) {
|
if ($menus.size()) {
|
||||||
$menus.each(function () {
|
$menus.each(function () {
|
||||||
self.setActive($(this));
|
_this.setActive($(this));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// if no item is marked as active, try to select the menu from the current URL
|
// if no item is marked as active, try to select the menu from the current URL
|
||||||
self.setActiveByUrl($('#col1').data('icingaUrl'));
|
_this.setActiveByUrl($('#col1').data('icingaUrl'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.refresh();
|
|
||||||
|
_this.refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user