Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bootstrap
Commits
c22b2705
Commit
c22b2705
authored
Sep 07, 2014
by
Jacob
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14273 from sgonyea/master
Fix hover-popover/tooltip flickering when mouse re-enters
parents
9f5660c3
aac0e164
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
js/tests/unit/tooltip.js
js/tests/unit/tooltip.js
+61
-0
js/tooltip.js
js/tooltip.js
+5
-0
No files found.
js/tests/unit/tooltip.js
View file @
c22b2705
...
@@ -775,4 +775,65 @@ $(function () {
...
@@ -775,4 +775,65 @@ $(function () {
$circle
.
bootstrapTooltip
(
'
show
'
)
$circle
.
bootstrapTooltip
(
'
show
'
)
})
})
test
(
'
should not reload the tooltip on subsequent mouseenter events
'
,
function
()
{
var
titleHtml
=
function
()
{
var
uid
=
$
.
fn
.
bootstrapTooltip
.
Constructor
.
prototype
.
getUID
(
'
tooltip
'
)
return
'
<p id="tt-content">
'
+
uid
+
'
</p><p>
'
+
uid
+
'
</p><p>
'
+
uid
+
'
</p>
'
}
var
$tooltip
=
$
(
'
<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
$tooltip
.
bootstrapTooltip
({
html
:
true
,
animation
:
false
,
trigger
:
'
hover
'
,
delay
:
{
show
:
0
,
hide
:
500
},
container
:
$tooltip
,
title
:
titleHtml
})
$
(
'
#tt-outer
'
).
trigger
(
'
mouseenter
'
)
var
currentUid
=
$
(
'
#tt-content
'
).
text
()
$
(
'
#tt-content
'
).
trigger
(
'
mouseenter
'
)
equal
(
currentUid
,
$
(
'
#tt-content
'
).
text
())
})
test
(
'
should not reload the tooltip if the mouse leaves and re-enters before hiding
'
,
function
()
{
var
titleHtml
=
function
()
{
var
uid
=
$
.
fn
.
bootstrapTooltip
.
Constructor
.
prototype
.
getUID
(
'
tooltip
'
)
return
'
<p id="tt-content">
'
+
uid
+
'
</p><p>
'
+
uid
+
'
</p><p>
'
+
uid
+
'
</p>
'
}
var
$tooltip
=
$
(
'
<span id="tt-outer" rel="tooltip" data-trigger="hover" data-placement="top">some text</span>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
$tooltip
.
bootstrapTooltip
({
html
:
true
,
animation
:
false
,
trigger
:
'
hover
'
,
delay
:
{
show
:
0
,
hide
:
500
},
container
:
$tooltip
,
title
:
titleHtml
})
var
obj
=
$tooltip
.
data
(
'
bs.tooltip
'
)
$
(
'
#tt-outer
'
).
trigger
(
'
mouseenter
'
)
var
currentUid
=
$
(
'
#tt-content
'
).
text
()
$
(
'
#tt-outer
'
).
trigger
(
'
mouseleave
'
)
equal
(
currentUid
,
$
(
'
#tt-content
'
).
text
())
ok
(
obj
.
hoverState
==
'
out
'
,
'
the tooltip hoverState should be set to "out"
'
)
$
(
'
#tt-content
'
).
trigger
(
'
mouseenter
'
)
ok
(
obj
.
hoverState
==
'
in
'
,
'
the tooltip hoverState should be set to "in"
'
)
equal
(
currentUid
,
$
(
'
#tt-content
'
).
text
())
})
})
})
js/tooltip.js
View file @
c22b2705
...
@@ -105,6 +105,11 @@
...
@@ -105,6 +105,11 @@
var
self
=
obj
instanceof
this
.
constructor
?
var
self
=
obj
instanceof
this
.
constructor
?
obj
:
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
)
obj
:
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
)
if
(
self
&&
self
.
$tip
&&
self
.
$tip
.
is
(
'
:visible
'
))
{
self
.
hoverState
=
'
in
'
return
}
if
(
!
self
)
{
if
(
!
self
)
{
self
=
new
this
.
constructor
(
obj
.
currentTarget
,
this
.
getDelegateOptions
())
self
=
new
this
.
constructor
(
obj
.
currentTarget
,
this
.
getDelegateOptions
())
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
,
self
)
$
(
obj
.
currentTarget
).
data
(
'
bs.
'
+
this
.
type
,
self
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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