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
ee71fb49
Commit
ee71fb49
authored
Jan 27, 2013
by
Guillaume Gautreau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No semicolumns
parent
5b0f956a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
44 deletions
+44
-44
js/bootstrap-tooltip.js
js/bootstrap-tooltip.js
+23
-23
js/tests/unit/bootstrap-tooltip.js
js/tests/unit/bootstrap-tooltip.js
+21
-21
No files found.
js/bootstrap-tooltip.js
View file @
ee71fb49
...
@@ -152,7 +152,7 @@
...
@@ -152,7 +152,7 @@
break
break
}
}
this
.
applyPlacement
(
tp
,
placement
)
;
this
.
applyPlacement
(
tp
,
placement
)
this
.
$element
.
trigger
(
'
shown
'
)
this
.
$element
.
trigger
(
'
shown
'
)
}
}
...
@@ -165,52 +165,52 @@
...
@@ -165,52 +165,52 @@
,
actualWidth
,
actualWidth
,
actualHeight
,
actualHeight
,
delta
,
delta
,
replace
=
false
;
,
replace
=
false
$tip
=
this
.
tip
()
;
$tip
=
this
.
tip
()
width
=
$tip
[
0
].
offsetWidth
;
width
=
$tip
[
0
].
offsetWidth
height
=
$tip
[
0
].
offsetHeight
;
height
=
$tip
[
0
].
offsetHeight
$tip
$tip
.
offset
(
offset
)
.
offset
(
offset
)
.
addClass
(
placement
)
.
addClass
(
placement
)
.
addClass
(
'
in
'
)
;
.
addClass
(
'
in
'
)
actualWidth
=
$tip
[
0
].
offsetWidth
;
actualWidth
=
$tip
[
0
].
offsetWidth
actualHeight
=
$tip
[
0
].
offsetHeight
;
actualHeight
=
$tip
[
0
].
offsetHeight
if
(
placement
==
"
top
"
&&
actualHeight
!=
height
){
if
(
placement
==
"
top
"
&&
actualHeight
!=
height
){
offset
.
top
=
offset
.
top
+
height
-
actualHeight
;
offset
.
top
=
offset
.
top
+
height
-
actualHeight
replace
=
true
;
replace
=
true
}
}
if
(
placement
==
"
bottom
"
||
placement
==
"
top
"
){
if
(
placement
==
"
bottom
"
||
placement
==
"
top
"
){
delta
=
0
;
delta
=
0
if
(
offset
.
left
<
0
){
if
(
offset
.
left
<
0
){
delta
=
-
offset
.
left
*
2
;
delta
=
-
offset
.
left
*
2
offset
.
left
=
0
;
offset
.
left
=
0
$tip
.
offset
(
offset
)
;
$tip
.
offset
(
offset
)
actualWidth
=
$tip
[
0
].
offsetWidth
;
actualWidth
=
$tip
[
0
].
offsetWidth
actualHeight
=
$tip
[
0
].
offsetHeight
;
actualHeight
=
$tip
[
0
].
offsetHeight
}
}
this
.
replaceArrow
(
delta
-
width
+
actualWidth
,
actualWidth
,
"
left
"
)
;
this
.
replaceArrow
(
delta
-
width
+
actualWidth
,
actualWidth
,
"
left
"
)
}
else
{
}
else
{
this
.
replaceArrow
(
actualHeight
-
height
,
actualHeight
,
"
top
"
)
;
this
.
replaceArrow
(
actualHeight
-
height
,
actualHeight
,
"
top
"
)
}
}
if
(
replace
)
$tip
.
offset
(
offset
)
;
if
(
replace
)
$tip
.
offset
(
offset
)
}
}
,
replaceArrow
:
function
(
delta
,
dimension
,
position
){
,
replaceArrow
:
function
(
delta
,
dimension
,
position
){
var
$arrow
=
this
.
arrow
()
;
var
$arrow
=
this
.
arrow
()
if
(
delta
!==
0
){
if
(
delta
!==
0
){
$arrow
.
css
(
position
,
50
*
(
1
-
delta
/
dimension
)
+
"
%
"
)
;
$arrow
.
css
(
position
,
50
*
(
1
-
delta
/
dimension
)
+
"
%
"
)
}
else
{
}
else
{
$arrow
.
css
(
position
,
""
)
;
$arrow
.
css
(
position
,
""
)
}
}
}
}
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
}
}
,
arrow
:
function
(){
,
arrow
:
function
(){
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
"
.tooltip-arrow
"
)
;
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
"
.tooltip-arrow
"
)
}
}
,
validate
:
function
()
{
,
validate
:
function
()
{
...
...
js/tests/unit/bootstrap-tooltip.js
View file @
ee71fb49
...
@@ -259,17 +259,17 @@ $(function () {
...
@@ -259,17 +259,17 @@ $(function () {
.
css
({
position
:
"
absolute
"
,
top
:
0
,
left
:
0
})
.
css
({
position
:
"
absolute
"
,
top
:
0
,
left
:
0
})
.
appendTo
(
container
)
.
appendTo
(
container
)
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
(
"
show
"
)
;
.
tooltip
(
"
show
"
)
stop
()
;
stop
()
setTimeout
(
function
(){
setTimeout
(
function
(){
ok
(
$
(
"
.tooltip
"
).
offset
().
left
>=
0
)
;
ok
(
$
(
"
.tooltip
"
).
offset
().
left
>=
0
)
start
()
;
start
()
container
.
remove
()
;
container
.
remove
()
},
100
)
},
100
)
})
;
})
test
(
"
should place tooltip on top of element
"
,
function
(){
test
(
"
should place tooltip on top of element
"
,
function
(){
var
container
=
$
(
"
<div />
"
).
appendTo
(
"
body
"
)
var
container
=
$
(
"
<div />
"
).
appendTo
(
"
body
"
)
...
@@ -279,18 +279,18 @@ $(function () {
...
@@ -279,18 +279,18 @@ $(function () {
.
css
({
marginTop
:
200
})
.
css
({
marginTop
:
200
})
.
appendTo
(
p
)
.
appendTo
(
p
)
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
(
"
show
"
)
;
.
tooltip
(
"
show
"
)
stop
()
;
stop
()
setTimeout
(
function
(){
setTimeout
(
function
(){
var
tooltip
=
container
.
find
(
"
.tooltip
"
)
;
var
tooltip
=
container
.
find
(
"
.tooltip
"
)
start
()
;
start
()
ok
(
tooltip
.
offset
().
top
+
tooltip
.
outerHeight
()
<=
tooltiped
.
offset
().
top
)
;
ok
(
tooltip
.
offset
().
top
+
tooltip
.
outerHeight
()
<=
tooltiped
.
offset
().
top
)
container
.
remove
()
;
container
.
remove
()
},
100
)
},
100
)
})
;
})
test
(
"
arrow should point to element
"
,
function
(){
test
(
"
arrow should point to element
"
,
function
(){
var
container
=
$
(
"
<div />
"
).
appendTo
(
"
body
"
)
var
container
=
$
(
"
<div />
"
).
appendTo
(
"
body
"
)
...
@@ -300,16 +300,16 @@ $(function () {
...
@@ -300,16 +300,16 @@ $(function () {
.
css
({
marginTop
:
200
})
.
css
({
marginTop
:
200
})
.
appendTo
(
p
)
.
appendTo
(
p
)
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
({
placement
:
"
top
"
,
animate
:
false
})
.
tooltip
(
"
show
"
)
;
.
tooltip
(
"
show
"
)
stop
()
;
stop
()
setTimeout
(
function
(){
setTimeout
(
function
(){
var
arrow
=
container
.
find
(
"
.tooltip-arrow
"
)
;
var
arrow
=
container
.
find
(
"
.tooltip-arrow
"
)
start
()
;
start
()
ok
(
Math
.
abs
(
arrow
.
offset
().
left
-
tooltiped
.
offset
().
left
-
tooltiped
.
outerWidth
()
/
2
)
<=
1
)
;
ok
(
Math
.
abs
(
arrow
.
offset
().
left
-
tooltiped
.
offset
().
left
-
tooltiped
.
outerWidth
()
/
2
)
<=
1
)
container
.
remove
()
;
container
.
remove
()
},
100
)
;
},
100
)
})
;
})
})
})
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