Skip to content

Commit 8ab4381

Browse files
alekseybobkovdaftspunk
authored andcommitted
Minor
1 parent 91c7b77 commit 8ab4381

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

assets/ui/js/popover.js

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
this.options = options || {};
5454
this.arrowSize = 15
55+
this.docClickHandler = null
5556
this.show()
5657
}
5758

@@ -94,6 +95,8 @@
9495

9596
$(document).unbind('mousedown', this.docClickHandler);
9697
$(document).off('.oc.popover')
98+
99+
this.docClickHandler = null
97100
}
98101

99102
Popover.prototype.show = function(options) {
@@ -165,29 +168,29 @@
165168
/*
166169
* Bind events
167170
*/
168-
this.$container.on('close.oc.popover', function(e){
169-
self.hide()
170-
})
171-
172-
this.$container.on('click', '[data-dismiss=popover]', function(e){
173-
self.hide()
174-
return false
175-
})
176-
177-
this.docClickHandler = $.proxy(this.onDocumentClick, this)
178-
$(document).bind('mousedown', this.docClickHandler);
179-
180-
if (this.options.closeOnEsc) {
181-
$(document).on('keyup.oc.popover', function(e){
182-
if ($(e.target).hasClass('select2-offscreen'))
183-
return false
184-
185-
if (e.keyCode == 27) {
186-
self.hide()
187-
return false
188-
}
189-
})
190-
}
171+
this.$container.on('close.oc.popover', function(e){
172+
self.hide()
173+
})
174+
175+
this.$container.on('click', '[data-dismiss=popover]', function(e){
176+
self.hide()
177+
return false
178+
})
179+
180+
this.docClickHandler = $.proxy(this.onDocumentClick, this)
181+
$(document).bind('mousedown', this.docClickHandler);
182+
183+
if (this.options.closeOnEsc) {
184+
$(document).on('keyup.oc.popover', function(e){
185+
if ($(e.target).hasClass('select2-offscreen'))
186+
return false
187+
188+
if (e.keyCode == 27) {
189+
self.hide()
190+
return false
191+
}
192+
})
193+
}
191194
}
192195

193196
Popover.prototype.getContent = function () {

0 commit comments

Comments
 (0)