Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
6d00ed58
Commit
6d00ed58
authored
7 years ago
by
Johann-S
Browse files
Options
Download
Email Patches
Plain Diff
Do not create a Popper.js instance when we don't need it
parent
6b884dcd
6 merge requests
!28721
Hot test
,
!27561
Adds font-weight-medium to font weight classes
,
!25494
web pack
,
!25326
Adjust examples
,
!23207
#22402 : modal: new autofocus & keyboardBtnNav options
,
!17021
v4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/src/dropdown.js
+18
-21
js/src/dropdown.js
with
18 additions
and
21 deletions
+18
-21
js/src/dropdown.js
+
18
-
21
View file @
6d00ed58
...
@@ -143,22 +143,25 @@ const Dropdown = (($) => {
...
@@ -143,22 +143,25 @@ const Dropdown = (($) => {
return
return
}
}
/**
// Disable totally Popper.js for Dropdown in Navbar
* Check for Popper dependency
if
(
!
this
.
_inNavbar
)
{
* Popper - https://popper.js.org
/**
*/
* Check for Popper dependency
if
(
typeof
Popper
===
'
undefined
'
)
{
* Popper - https://popper.js.org
throw
new
Error
(
'
Bootstrap dropdown require Popper.js (https://popper.js.org)
'
)
*/
}
if
(
typeof
Popper
===
'
undefined
'
)
{
throw
new
Error
(
'
Bootstrap dropdown require Popper.js (https://popper.js.org)
'
)
let
element
=
this
.
_element
}
// for dropup with alignment we use the parent as popper container
let
element
=
this
.
_element
if
(
$
(
parent
).
hasClass
(
ClassName
.
DROPUP
))
{
// for dropup with alignment we use the parent as popper container
if
(
$
(
this
.
_menu
).
hasClass
(
ClassName
.
MENULEFT
)
||
$
(
this
.
_menu
).
hasClass
(
ClassName
.
MENURIGHT
))
{
if
(
$
(
parent
).
hasClass
(
ClassName
.
DROPUP
))
{
element
=
parent
if
(
$
(
this
.
_menu
).
hasClass
(
ClassName
.
MENULEFT
)
||
$
(
this
.
_menu
).
hasClass
(
ClassName
.
MENURIGHT
))
{
element
=
parent
}
}
}
this
.
_popper
=
new
Popper
(
element
,
this
.
_menu
,
this
.
_getPopperConfig
())
}
}
this
.
_popper
=
new
Popper
(
element
,
this
.
_menu
,
this
.
_getPopperConfig
())
// if this is a touch-enabled device we add extra
// if this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// empty mouseover listeners to the body's immediate children;
...
@@ -185,8 +188,8 @@ const Dropdown = (($) => {
...
@@ -185,8 +188,8 @@ const Dropdown = (($) => {
this
.
_menu
=
null
this
.
_menu
=
null
if
(
this
.
_popper
!==
null
)
{
if
(
this
.
_popper
!==
null
)
{
this
.
_popper
.
destroy
()
this
.
_popper
.
destroy
()
this
.
_popper
=
null
}
}
this
.
_popper
=
null
}
}
update
()
{
update
()
{
...
@@ -275,12 +278,6 @@ const Dropdown = (($) => {
...
@@ -275,12 +278,6 @@ const Dropdown = (($) => {
}
}
}
}
// Disable Popper.js for Dropdown in Navbar
if
(
this
.
_inNavbar
)
{
popperConfig
.
modifiers
.
applyStyle
=
{
enabled
:
!
this
.
_inNavbar
}
}
return
popperConfig
return
popperConfig
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets