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
05d18779
Commit
05d18779
authored
Dec 19, 2014
by
Chris Rebert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update JS to use .{tooltip,popover}-{left,right,top,bottom}
parent
654d0dff
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
js/popover.js
js/popover.js
+1
-1
js/tests/unit/tooltip.js
js/tests/unit/tooltip.js
+12
-12
js/tooltip.js
js/tooltip.js
+5
-5
No files found.
js/popover.js
View file @
05d18779
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
this
.
options
.
html
?
(
typeof
content
==
'
string
'
?
'
html
'
:
'
append
'
)
:
'
text
'
this
.
options
.
html
?
(
typeof
content
==
'
string
'
?
'
html
'
:
'
append
'
)
:
'
text
'
](
content
)
](
content
)
$tip
.
removeClass
(
'
fade
top bottom left
right in
'
)
$tip
.
removeClass
(
'
fade
popover-top popover-bottom popover-left popover-
right in
'
)
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
// this manually by checking the contents.
...
...
js/tests/unit/tooltip.js
View file @
05d18779
...
@@ -85,7 +85,7 @@ $(function () {
...
@@ -85,7 +85,7 @@ $(function () {
.
bootstrapTooltip
({
placement
:
'
bottom
'
})
.
bootstrapTooltip
({
placement
:
'
bottom
'
})
$tooltip
.
bootstrapTooltip
(
'
show
'
)
$tooltip
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.bottom.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.
tooltip-
bottom.in
'
),
'
has correct classes applied
'
)
$tooltip
.
bootstrapTooltip
(
'
hide
'
)
$tooltip
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed
'
)
...
@@ -300,8 +300,8 @@ $(function () {
...
@@ -300,8 +300,8 @@ $(function () {
test
(
'
should add position class before positioning so that position-specific styles are taken into account
'
,
function
()
{
test
(
'
should add position class before positioning so that position-specific styles are taken into account
'
,
function
()
{
var
styles
=
'
<style>
'
var
styles
=
'
<style>
'
+
'
.tooltip.right { white-space: nowrap; }
'
+
'
.tooltip.
tooltip-
right { white-space: nowrap; }
'
+
'
.tooltip.right .tooltip-inner { max-width: none; }
'
+
'
.tooltip.
tooltip-
right .tooltip-inner { max-width: none; }
'
+
'
</style>
'
+
'
</style>
'
var
$styles
=
$
(
styles
).
appendTo
(
'
head
'
)
var
$styles
=
$
(
styles
).
appendTo
(
'
head
'
)
...
@@ -384,7 +384,7 @@ $(function () {
...
@@ -384,7 +384,7 @@ $(function () {
.
bootstrapTooltip
({
placement
:
'
auto
'
})
.
bootstrapTooltip
({
placement
:
'
auto
'
})
$topTooltip
.
bootstrapTooltip
(
'
show
'
)
$topTooltip
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.bottom
'
),
'
top positioned tooltip is dynamically positioned to bottom
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.
tooltip-
bottom
'
),
'
top positioned tooltip is dynamically positioned to bottom
'
)
$topTooltip
.
bootstrapTooltip
(
'
hide
'
)
$topTooltip
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
top positioned tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
top positioned tooltip removed from dom
'
)
...
@@ -394,7 +394,7 @@ $(function () {
...
@@ -394,7 +394,7 @@ $(function () {
.
bootstrapTooltip
({
placement
:
'
right auto
'
})
.
bootstrapTooltip
({
placement
:
'
right auto
'
})
$rightTooltip
.
bootstrapTooltip
(
'
show
'
)
$rightTooltip
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.left
'
),
'
right positioned tooltip is dynamically positioned left
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.
tooltip-
left
'
),
'
right positioned tooltip is dynamically positioned left
'
)
$rightTooltip
.
bootstrapTooltip
(
'
hide
'
)
$rightTooltip
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
right positioned tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
right positioned tooltip removed from dom
'
)
...
@@ -404,7 +404,7 @@ $(function () {
...
@@ -404,7 +404,7 @@ $(function () {
.
bootstrapTooltip
({
placement
:
'
auto left
'
})
.
bootstrapTooltip
({
placement
:
'
auto left
'
})
$leftTooltip
.
bootstrapTooltip
(
'
show
'
)
$leftTooltip
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.right
'
),
'
left positioned tooltip is dynamically positioned right
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.
tooltip-
right
'
),
'
left positioned tooltip is dynamically positioned right
'
)
$leftTooltip
.
bootstrapTooltip
(
'
hide
'
)
$leftTooltip
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
left positioned tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
left positioned tooltip removed from dom
'
)
...
@@ -430,7 +430,7 @@ $(function () {
...
@@ -430,7 +430,7 @@ $(function () {
})
})
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.top
'
),
'
top positioned tooltip is dynamically positioned to top
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.to
oltip-to
p
'
),
'
top positioned tooltip is dynamically positioned to top
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
@@ -455,7 +455,7 @@ $(function () {
...
@@ -455,7 +455,7 @@ $(function () {
})
})
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.bottom
'
),
'
top positioned tooltip is dynamically positioned to bottom
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.
tooltip-
bottom
'
),
'
top positioned tooltip is dynamically positioned to bottom
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
@@ -481,7 +481,7 @@ $(function () {
...
@@ -481,7 +481,7 @@ $(function () {
$
(
'
#scrollable-div
'
).
scrollTop
(
100
)
$
(
'
#scrollable-div
'
).
scrollTop
(
100
)
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.top.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.to
oltip-to
p.in
'
),
'
has correct classes applied
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
@@ -507,7 +507,7 @@ $(function () {
...
@@ -507,7 +507,7 @@ $(function () {
$
(
'
#scrollable-div
'
).
scrollTop
(
200
)
$
(
'
#scrollable-div
'
).
scrollTop
(
200
)
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.bottom.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.
tooltip-
bottom.in
'
),
'
has correct classes applied
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
@@ -537,7 +537,7 @@ $(function () {
...
@@ -537,7 +537,7 @@ $(function () {
$
(
'
#scrollable-div
'
).
scrollTop
(
200
)
$
(
'
#scrollable-div
'
).
scrollTop
(
200
)
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.bottom.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.
tooltip-
bottom.in
'
),
'
has correct classes applied
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
@@ -563,7 +563,7 @@ $(function () {
...
@@ -563,7 +563,7 @@ $(function () {
$
(
'
#scrollable-div
'
).
scrollTop
(
400
)
$
(
'
#scrollable-div
'
).
scrollTop
(
400
)
$target
.
bootstrapTooltip
(
'
show
'
)
$target
.
bootstrapTooltip
(
'
show
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.top.in
'
),
'
has correct classes applied
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.to
oltip-to
p.in
'
),
'
has correct classes applied
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
$target
.
bootstrapTooltip
(
'
hide
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
equal
(
$
(
'
.tooltip
'
).
length
,
0
,
'
tooltip removed from dom
'
)
...
...
js/tooltip.js
View file @
05d18779
...
@@ -177,7 +177,7 @@
...
@@ -177,7 +177,7 @@
$tip
$tip
.
detach
()
.
detach
()
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
addClass
(
placement
)
.
addClass
(
this
.
type
+
'
-
'
+
placement
)
.
data
(
'
bs.
'
+
this
.
type
,
this
)
.
data
(
'
bs.
'
+
this
.
type
,
this
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
...
@@ -187,7 +187,7 @@
...
@@ -187,7 +187,7 @@
var
actualHeight
=
$tip
[
0
].
offsetHeight
var
actualHeight
=
$tip
[
0
].
offsetHeight
if
(
autoPlace
)
{
if
(
autoPlace
)
{
var
orgPlacement
=
placement
var
or
i
gPlacement
=
placement
var
$container
=
this
.
options
.
container
?
$
(
this
.
options
.
container
)
:
this
.
$element
.
parent
()
var
$container
=
this
.
options
.
container
?
$
(
this
.
options
.
container
)
:
this
.
$element
.
parent
()
var
containerDim
=
this
.
getPosition
(
$container
)
var
containerDim
=
this
.
getPosition
(
$container
)
...
@@ -198,8 +198,8 @@
...
@@ -198,8 +198,8 @@
placement
placement
$tip
$tip
.
removeClass
(
or
gPlacement
)
.
removeClass
(
this
.
type
+
'
-
'
+
ori
gPlacement
)
.
addClass
(
placement
)
.
addClass
(
this
.
type
+
'
-
'
+
placement
)
}
}
var
calculatedOffset
=
this
.
getCalculatedOffset
(
placement
,
pos
,
actualWidth
,
actualHeight
)
var
calculatedOffset
=
this
.
getCalculatedOffset
(
placement
,
pos
,
actualWidth
,
actualHeight
)
...
@@ -283,7 +283,7 @@
...
@@ -283,7 +283,7 @@
var
title
=
this
.
getTitle
()
var
title
=
this
.
getTitle
()
$tip
.
find
(
'
.tooltip-inner
'
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
title
)
$tip
.
find
(
'
.tooltip-inner
'
)[
this
.
options
.
html
?
'
html
'
:
'
text
'
](
title
)
$tip
.
removeClass
(
'
fade in to
p bottom left
right
'
)
$tip
.
removeClass
(
'
fade in to
oltip-top tooltip-bottom tooltip-left tooltip-
right
'
)
}
}
Tooltip
.
prototype
.
hide
=
function
(
callback
)
{
Tooltip
.
prototype
.
hide
=
function
(
callback
)
{
...
...
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