Skip to content
GitLab
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
55fa1acb
Commit
55fa1acb
authored
11 years ago
by
Mu-An Chiou
Browse files
Options
Download
Email Patches
Plain Diff
Tooltip: apply position class before positioning
parent
09cdee2f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/assets/js/bootstrap.js
+1
-1
docs/assets/js/bootstrap.js
docs/assets/js/bootstrap.min.js
+1
-1
docs/assets/js/bootstrap.min.js
js/tests/unit/tooltip.js
+14
-0
js/tests/unit/tooltip.js
js/tooltip.js
+1
-1
js/tooltip.js
with
17 additions
and
3 deletions
+17
-3
docs/assets/js/bootstrap.js
+
1
-
1
View file @
55fa1acb
...
@@ -1159,6 +1159,7 @@
...
@@ -1159,6 +1159,7 @@
$tip
$tip
.
detach
()
.
detach
()
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
addClass
(
placement
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
...
@@ -1195,7 +1196,6 @@
...
@@ -1195,7 +1196,6 @@
$tip
$tip
.
offset
(
offset
)
.
offset
(
offset
)
.
addClass
(
placement
)
.
addClass
(
'
in
'
)
.
addClass
(
'
in
'
)
var
actualWidth
=
$tip
[
0
].
offsetWidth
var
actualWidth
=
$tip
[
0
].
offsetWidth
...
...
This diff is collapsed.
Click to expand it.
docs/assets/js/bootstrap.min.js
+
1
-
1
View file @
55fa1acb
This diff is collapsed.
Click to expand it.
js/tests/unit/tooltip.js
+
14
-
0
View file @
55fa1acb
...
@@ -291,4 +291,18 @@ $(function () {
...
@@ -291,4 +291,18 @@ $(function () {
container
.
remove
()
container
.
remove
()
},
100
)
},
100
)
})
})
test
(
"
should add position class before positioning so that position-specific styles are taken into account
"
,
function
(){
$
(
"
head
"
).
append
(
'
<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>
'
)
var
container
=
$
(
"
<div />
"
).
appendTo
(
"
body
"
)
,
target
=
$
(
'
<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line">To my right</a>
'
)
.
appendTo
(
container
)
.
tooltip
({
placement
:
'
right
'
})
.
tooltip
(
'
show
'
)
,
tooltip
=
container
.
find
(
"
.tooltip
"
)
ok
(
Math
.
round
(
target
.
offset
().
top
+
target
[
0
].
offsetHeight
/
2
-
tooltip
[
0
].
offsetHeight
/
2
)
===
tooltip
.
offset
().
top
)
target
.
tooltip
(
'
hide
'
)
})
})
})
This diff is collapsed.
Click to expand it.
js/tooltip.js
+
1
-
1
View file @
55fa1acb
...
@@ -147,6 +147,7 @@
...
@@ -147,6 +147,7 @@
$tip
$tip
.
detach
()
.
detach
()
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
css
({
top
:
0
,
left
:
0
,
display
:
'
block
'
})
.
addClass
(
placement
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
this
.
options
.
container
?
$tip
.
appendTo
(
this
.
options
.
container
)
:
$tip
.
insertAfter
(
this
.
$element
)
...
@@ -183,7 +184,6 @@
...
@@ -183,7 +184,6 @@
$tip
$tip
.
offset
(
offset
)
.
offset
(
offset
)
.
addClass
(
placement
)
.
addClass
(
'
in
'
)
.
addClass
(
'
in
'
)
var
actualWidth
=
$tip
[
0
].
offsetWidth
var
actualWidth
=
$tip
[
0
].
offsetWidth
...
...
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