Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Golieb <j@golieb.net>2019-02-05 11:31:18 +0300
committerXhmikosR <xhmikosr@gmail.com>2019-02-05 11:31:18 +0300
commite44d0475e07113dfb21b555658de6eac53083f98 (patch)
treec35b6620da0cb0b3c9948d6a0a56800e9ca8e22a /js/src/dropdown.js
parent1139f62ca26be2057ff15550061adf6ac201b2a8 (diff)
Move dropdown offset function logic into private function. (#28138)
Diffstat (limited to 'js/src/dropdown.js')
-rw-r--r--js/src/dropdown.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js
index 9aaf5a339e..31deaa725e 100644
--- a/js/src/dropdown.js
+++ b/js/src/dropdown.js
@@ -319,24 +319,30 @@ class Dropdown {
return $(this._element).closest('.navbar').length > 0
}
- _getPopperConfig() {
- const offsetConf = {}
+ _getOffset() {
+ const offset = {}
+
if (typeof this._config.offset === 'function') {
- offsetConf.fn = (data) => {
+ offset.fn = (data) => {
data.offsets = {
...data.offsets,
- ...this._config.offset(data.offsets) || {}
+ ...this._config.offset(data.offsets, this._element) || {}
}
+
return data
}
} else {
- offsetConf.offset = this._config.offset
+ offset.offset = this._config.offset
}
+ return offset
+ }
+
+ _getPopperConfig() {
const popperConfig = {
placement: this._getPlacement(),
modifiers: {
- offset: offsetConf,
+ offset: this._getOffset(),
flip: {
enabled: this._config.flip
},
@@ -352,6 +358,7 @@ class Dropdown {
enabled: false
}
}
+
return popperConfig
}