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
2b6ec389
Commit
2b6ec389
authored
11 years ago
by
fat
Browse files
Options
Download
Email Patches
Plain Diff
fixes
#8880
parent
f22a077f
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dist/js/bootstrap.js
+28
-12
dist/js/bootstrap.js
dist/js/bootstrap.min.js
+1
-1
dist/js/bootstrap.min.js
js/popover.js
+4
-0
js/popover.js
js/tooltip.js
+24
-12
js/tooltip.js
with
57 additions
and
25 deletions
+57
-25
dist/js/bootstrap.js
+
28
-
12
View file @
2b6ec389
...
...
@@ -1245,12 +1245,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
.
addClass
(
placement
)
}
var
tp
=
placement
==
'
bottom
'
?
{
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
top
'
?
{
top
:
pos
.
top
-
actualHeight
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
left
'
?
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
-
actualWidth
}
:
/* placement == 'right' */
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
+
pos
.
width
}
var
calculatedOffset
=
this
.
getCalcuatedOffset
(
placement
,
pos
,
actualWidth
,
actualHeight
)
this
.
applyPlacement
(
t
p
,
placement
)
this
.
applyPlacement
(
calculatedOffse
t
,
placement
)
this
.
$element
.
trigger
(
'
shown.bs.
'
+
this
.
type
)
}
}
...
...
@@ -1262,25 +1259,33 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
var
height
=
$tip
[
0
].
offsetHeight
// manually read margins because getBoundingClientRect includes difference
offset
.
top
=
offset
.
top
+
parseInt
(
$tip
.
css
(
'
margin-top
'
),
10
)
offset
.
left
=
offset
.
left
+
parseInt
(
$tip
.
css
(
'
margin-left
'
),
10
)
var
marginTop
=
parseInt
(
$tip
.
css
(
'
margin-top
'
),
10
)
var
marginLeft
=
parseInt
(
$tip
.
css
(
'
margin-left
'
),
10
)
// we must check for NaN for ie 8/9
if
(
isNaN
(
marginTop
))
marginTop
=
0
if
(
isNaN
(
marginLeft
))
marginLeft
=
0
offset
.
top
=
offset
.
top
+
marginTop
offset
.
left
=
offset
.
left
+
marginLeft
$tip
.
offset
(
offset
)
.
addClass
(
'
in
'
)
// check to see if placing tip in new offset caused the tip to resize itself
var
actualWidth
=
$tip
[
0
].
offsetWidth
var
actualHeight
=
$tip
[
0
].
offsetHeight
if
(
placement
==
'
top
'
&&
actualHeight
!=
height
)
{
replace
=
true
offset
.
top
=
offset
.
top
+
height
-
actualHeight
offset
.
top
=
offset
.
top
+
height
-
actualHeight
}
if
(
placement
==
'
bottom
'
||
placement
==
'
top
'
)
{
if
(
/bottom|top/
.
test
(
placement
)
)
{
var
delta
=
0
if
(
offset
.
left
<
0
){
if
(
offset
.
left
<
0
)
{
delta
=
offset
.
left
*
-
2
offset
.
left
=
0
...
...
@@ -1353,6 +1358,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
},
this
.
$element
.
offset
())
}
Tooltip
.
prototype
.
getCalcuatedOffset
=
function
(
placement
,
pos
,
actualWidth
,
actualHeight
)
{
return
placement
==
'
bottom
'
?
{
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
top
'
?
{
top
:
pos
.
top
-
actualHeight
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
left
'
?
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
-
actualWidth
}
:
/* placement == 'right' */
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
+
pos
.
width
}
}
Tooltip
.
prototype
.
getTitle
=
function
()
{
var
title
var
$e
=
this
.
$element
...
...
@@ -1368,8 +1380,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
return
this
.
$tip
=
this
.
$tip
||
$
(
this
.
options
.
template
)
}
Tooltip
.
prototype
.
arrow
=
function
(){
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
"
.tooltip-arrow
"
)
Tooltip
.
prototype
.
arrow
=
function
()
{
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
'
.tooltip-arrow
'
)
}
Tooltip
.
prototype
.
validate
=
function
()
{
...
...
@@ -1508,6 +1520,10 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
o
.
content
)
}
Popover
.
prototype
.
arrow
=
function
()
{
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
'
.arrow
'
)
}
Popover
.
prototype
.
tip
=
function
()
{
if
(
!
this
.
$tip
)
this
.
$tip
=
$
(
this
.
options
.
template
)
return
this
.
$tip
...
...
This diff is collapsed.
Click to expand it.
dist/js/bootstrap.min.js
+
1
-
1
View file @
2b6ec389
This diff is collapsed.
Click to expand it.
js/popover.js
+
4
-
0
View file @
2b6ec389
...
...
@@ -75,6 +75,10 @@
o
.
content
)
}
Popover
.
prototype
.
arrow
=
function
()
{
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
'
.arrow
'
)
}
Popover
.
prototype
.
tip
=
function
()
{
if
(
!
this
.
$tip
)
this
.
$tip
=
$
(
this
.
options
.
template
)
return
this
.
$tip
...
...
This diff is collapsed.
Click to expand it.
js/tooltip.js
+
24
-
12
View file @
2b6ec389
...
...
@@ -179,12 +179,9 @@
.
addClass
(
placement
)
}
var
tp
=
placement
==
'
bottom
'
?
{
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
top
'
?
{
top
:
pos
.
top
-
actualHeight
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
left
'
?
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
-
actualWidth
}
:
/* placement == 'right' */
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
+
pos
.
width
}
var
calculatedOffset
=
this
.
getCalcuatedOffset
(
placement
,
pos
,
actualWidth
,
actualHeight
)
this
.
applyPlacement
(
t
p
,
placement
)
this
.
applyPlacement
(
calculatedOffse
t
,
placement
)
this
.
$element
.
trigger
(
'
shown.bs.
'
+
this
.
type
)
}
}
...
...
@@ -196,25 +193,33 @@
var
height
=
$tip
[
0
].
offsetHeight
// manually read margins because getBoundingClientRect includes difference
offset
.
top
=
offset
.
top
+
parseInt
(
$tip
.
css
(
'
margin-top
'
),
10
)
offset
.
left
=
offset
.
left
+
parseInt
(
$tip
.
css
(
'
margin-left
'
),
10
)
var
marginTop
=
parseInt
(
$tip
.
css
(
'
margin-top
'
),
10
)
var
marginLeft
=
parseInt
(
$tip
.
css
(
'
margin-left
'
),
10
)
// we must check for NaN for ie 8/9
if
(
isNaN
(
marginTop
))
marginTop
=
0
if
(
isNaN
(
marginLeft
))
marginLeft
=
0
offset
.
top
=
offset
.
top
+
marginTop
offset
.
left
=
offset
.
left
+
marginLeft
$tip
.
offset
(
offset
)
.
addClass
(
'
in
'
)
// check to see if placing tip in new offset caused the tip to resize itself
var
actualWidth
=
$tip
[
0
].
offsetWidth
var
actualHeight
=
$tip
[
0
].
offsetHeight
if
(
placement
==
'
top
'
&&
actualHeight
!=
height
)
{
replace
=
true
offset
.
top
=
offset
.
top
+
height
-
actualHeight
offset
.
top
=
offset
.
top
+
height
-
actualHeight
}
if
(
placement
==
'
bottom
'
||
placement
==
'
top
'
)
{
if
(
/bottom|top/
.
test
(
placement
)
)
{
var
delta
=
0
if
(
offset
.
left
<
0
){
if
(
offset
.
left
<
0
)
{
delta
=
offset
.
left
*
-
2
offset
.
left
=
0
...
...
@@ -287,6 +292,13 @@
},
this
.
$element
.
offset
())
}
Tooltip
.
prototype
.
getCalcuatedOffset
=
function
(
placement
,
pos
,
actualWidth
,
actualHeight
)
{
return
placement
==
'
bottom
'
?
{
top
:
pos
.
top
+
pos
.
height
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
top
'
?
{
top
:
pos
.
top
-
actualHeight
,
left
:
pos
.
left
+
pos
.
width
/
2
-
actualWidth
/
2
}
:
placement
==
'
left
'
?
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
-
actualWidth
}
:
/* placement == 'right' */
{
top
:
pos
.
top
+
pos
.
height
/
2
-
actualHeight
/
2
,
left
:
pos
.
left
+
pos
.
width
}
}
Tooltip
.
prototype
.
getTitle
=
function
()
{
var
title
var
$e
=
this
.
$element
...
...
@@ -302,8 +314,8 @@
return
this
.
$tip
=
this
.
$tip
||
$
(
this
.
options
.
template
)
}
Tooltip
.
prototype
.
arrow
=
function
(){
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
"
.tooltip-arrow
"
)
Tooltip
.
prototype
.
arrow
=
function
()
{
return
this
.
$arrow
=
this
.
$arrow
||
this
.
tip
().
find
(
'
.tooltip-arrow
'
)
}
Tooltip
.
prototype
.
validate
=
function
()
{
...
...
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