mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
Fix undefined local variables in sticky JS
Running the sticky JS in Jest raised errors due to these variables not being assigned properly. It's JavaScript so any variable not defined by the `var` prefix will automatically become a property of the global object. That is not what is intended by the code so requires changing.
This commit is contained in:
@@ -11,12 +11,11 @@
|
||||
var $scrollArea = $el.closest('.sticky-scroll-area');
|
||||
|
||||
$scrollArea = $scrollArea.length ? $scrollArea : $el.parent();
|
||||
scrollArea = $scrollArea.get(0);
|
||||
|
||||
this._els = [el];
|
||||
this.edge = edge;
|
||||
this.selector = selector;
|
||||
this.node = scrollArea;
|
||||
this.node = $scrollArea.get(0);
|
||||
this.setEvents();
|
||||
};
|
||||
ScrollArea.prototype.addEl = function (el) {
|
||||
@@ -38,7 +37,7 @@
|
||||
};
|
||||
ScrollArea.prototype.getFocusedDetails = {
|
||||
forElement: function ($focusedElement) {
|
||||
focused = {
|
||||
var focused = {
|
||||
'top': $focusedElement.offset().top,
|
||||
'height': $focusedElement.outerHeight(),
|
||||
'type': 'element'
|
||||
|
||||
Reference in New Issue
Block a user