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
ee2df11e
Commit
ee2df11e
authored
Apr 09, 2014
by
XhmikosR
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13091 from twbs/unused-js
Remove unused javascript
parents
de86b36b
2f0f8ec6
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
37 additions
and
38 deletions
+37
-38
dist/js/bootstrap.js
dist/js/bootstrap.js
+2
-2
dist/js/bootstrap.min.js
dist/js/bootstrap.min.js
+1
-1
docs/assets/js/_src/application.js
docs/assets/js/_src/application.js
+1
-4
docs/assets/js/_src/customizer.js
docs/assets/js/_src/customizer.js
+3
-2
docs/assets/js/customize.min.js
docs/assets/js/customize.min.js
+1
-1
docs/assets/js/docs.min.js
docs/assets/js/docs.min.js
+1
-1
docs/dist/js/bootstrap.min.js
docs/dist/js/bootstrap.min.js
+1
-1
grunt/.jshintrc
grunt/.jshintrc
+2
-1
js/.jshintrc
js/.jshintrc
+1
-0
js/scrollspy.js
js/scrollspy.js
+2
-1
js/tests/unit/affix.js
js/tests/unit/affix.js
+3
-3
js/tests/unit/button.js
js/tests/unit/button.js
+0
-1
js/tests/unit/collapse.js
js/tests/unit/collapse.js
+8
-8
js/tests/unit/scrollspy.js
js/tests/unit/scrollspy.js
+1
-1
js/tests/unit/tooltip.js
js/tests/unit/tooltip.js
+10
-10
js/tooltip.js
js/tooltip.js
+0
-1
No files found.
dist/js/bootstrap.js
View file @
ee2df11e
...
@@ -1243,7 +1243,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
...
@@ -1243,7 +1243,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
}
Tooltip
.
prototype
.
applyPlacement
=
function
(
offset
,
placement
)
{
Tooltip
.
prototype
.
applyPlacement
=
function
(
offset
,
placement
)
{
var
replace
var
$tip
=
this
.
tip
()
var
$tip
=
this
.
tip
()
var
width
=
$tip
[
0
].
offsetWidth
var
width
=
$tip
[
0
].
offsetWidth
var
height
=
$tip
[
0
].
offsetHeight
var
height
=
$tip
[
0
].
offsetHeight
...
@@ -1626,7 +1625,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
...
@@ -1626,7 +1625,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this
.
targets
=
$
([])
this
.
targets
=
$
([])
var
self
=
this
var
self
=
this
var
$targets
=
this
.
$body
this
.
$body
.
find
(
this
.
selector
)
.
find
(
this
.
selector
)
.
map
(
function
()
{
.
map
(
function
()
{
var
$el
=
$
(
this
)
var
$el
=
$
(
this
)
...
...
dist/js/bootstrap.min.js
View file @
ee2df11e
This diff is collapsed.
Click to expand it.
docs/assets/js/_src/application.js
View file @
ee2df11e
...
@@ -31,11 +31,8 @@
...
@@ -31,11 +31,8 @@
var
$window
=
$
(
window
)
var
$window
=
$
(
window
)
var
$body
=
$
(
document
.
body
)
var
$body
=
$
(
document
.
body
)
var
navHeight
=
$
(
'
.navbar
'
).
outerHeight
(
true
)
+
10
$body
.
scrollspy
({
$body
.
scrollspy
({
target
:
'
.bs-docs-sidebar
'
,
target
:
'
.bs-docs-sidebar
'
// offset: navHeight
})
})
$window
.
on
(
'
load
'
,
function
()
{
$window
.
on
(
'
load
'
,
function
()
{
...
...
docs/assets/js/_src/customizer.js
View file @
ee2df11e
...
@@ -231,7 +231,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -231,7 +231,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
paths
:
[
'
variables.less
'
,
'
mixins.less
'
],
paths
:
[
'
variables.less
'
,
'
mixins.less
'
],
optimization
:
0
,
optimization
:
0
,
filename
:
baseFilename
+
'
.css
'
filename
:
baseFilename
+
'
.css
'
}).
parse
(
lessSource
,
function
(
err
,
tree
)
{
})
parser
.
parse
(
lessSource
,
function
(
err
,
tree
)
{
if
(
err
)
{
if
(
err
)
{
return
showError
(
'
<strong>Ruh roh!</strong> Could not parse less files.
'
,
err
)
return
showError
(
'
<strong>Ruh roh!</strong> Could not parse less files.
'
,
err
)
}
}
...
@@ -331,7 +333,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
...
@@ -331,7 +333,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
})
var
$compileBtn
=
$
(
'
#btn-compile
'
)
var
$compileBtn
=
$
(
'
#btn-compile
'
)
var
$downloadBtn
=
$
(
'
#btn-download
'
)
$compileBtn
.
on
(
'
click
'
,
function
(
e
)
{
$compileBtn
.
on
(
'
click
'
,
function
(
e
)
{
var
configData
=
getCustomizerData
()
var
configData
=
getCustomizerData
()
...
...
docs/assets/js/customize.min.js
View file @
ee2df11e
This diff is collapsed.
Click to expand it.
docs/assets/js/docs.min.js
View file @
ee2df11e
...
@@ -13,4 +13,4 @@ var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseI
...
@@ -13,4 +13,4 @@ var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseI
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
*/
!
function
(
a
){
a
(
function
(){
if
(
navigator
.
userAgent
.
match
(
/IEMobile
\/
10
\.
0/
)){
var
b
=
document
.
createElement
(
"
style
"
);
b
.
appendChild
(
document
.
createTextNode
(
"
@-ms-viewport{width:auto!important}
"
)),
document
.
querySelector
(
"
head
"
).
appendChild
(
b
)}{
var
c
=
a
(
window
),
d
=
a
(
document
.
body
);
a
(
"
.navbar
"
).
outerHeight
(
!
0
)
+
10
}
d
.
scrollspy
({
target
:
"
.bs-docs-sidebar
"
}),
c
.
on
(
"
load
"
,
function
(){
d
.
scrollspy
(
"
refresh
"
)}),
a
(
"
.bs-docs-container [href=#]
"
).
click
(
function
(
a
){
a
.
preventDefault
()}),
setTimeout
(
function
(){
var
b
=
a
(
"
.bs-docs-sidebar
"
);
b
.
affix
({
offset
:{
top
:
function
(){
var
c
=
b
.
offset
().
top
,
d
=
parseInt
(
b
.
children
(
0
).
css
(
"
margin-top
"
),
10
),
e
=
a
(
"
.bs-docs-nav
"
).
height
();
return
this
.
top
=
c
-
e
-
d
},
bottom
:
function
(){
return
this
.
bottom
=
a
(
"
.bs-docs-footer
"
).
outerHeight
(
!
0
)}}})},
100
),
setTimeout
(
function
(){
a
(
"
.bs-top
"
).
affix
()},
100
),
a
(
"
.tooltip-demo
"
).
tooltip
({
selector
:
"
[data-toggle=tooltip]
"
,
container
:
"
body
"
}),
a
(
"
.tooltip-test
"
).
tooltip
(),
a
(
"
.popover-test
"
).
popover
(),
a
(
"
.bs-docs-navbar
"
).
tooltip
({
selector
:
"
a[data-toggle=tooltip]
"
,
container
:
"
.bs-docs-navbar .nav
"
}),
a
(
"
.bs-docs-popover
"
).
popover
(),
a
(
"
.bs-docs-popover-dismiss
"
).
popover
({
trigger
:
"
focus
"
}),
a
(
"
#loading-example-btn
"
).
click
(
function
(){
var
b
=
a
(
this
);
b
.
button
(
"
loading
"
),
setTimeout
(
function
(){
b
.
button
(
"
reset
"
)},
3
e3
)})})}(
jQuery
);
!
function
(
a
){
a
(
function
(){
if
(
navigator
.
userAgent
.
match
(
/IEMobile
\/
10
\.
0/
)){
var
b
=
document
.
createElement
(
"
style
"
);
b
.
appendChild
(
document
.
createTextNode
(
"
@-ms-viewport{width:auto!important}
"
)),
document
.
querySelector
(
"
head
"
).
appendChild
(
b
)}
var
c
=
a
(
window
),
d
=
a
(
document
.
body
);
d
.
scrollspy
({
target
:
"
.bs-docs-sidebar
"
}),
c
.
on
(
"
load
"
,
function
(){
d
.
scrollspy
(
"
refresh
"
)}),
a
(
"
.bs-docs-container [href=#]
"
).
click
(
function
(
a
){
a
.
preventDefault
()}),
setTimeout
(
function
(){
var
b
=
a
(
"
.bs-docs-sidebar
"
);
b
.
affix
({
offset
:{
top
:
function
(){
var
c
=
b
.
offset
().
top
,
d
=
parseInt
(
b
.
children
(
0
).
css
(
"
margin-top
"
),
10
),
e
=
a
(
"
.bs-docs-nav
"
).
height
();
return
this
.
top
=
c
-
e
-
d
},
bottom
:
function
(){
return
this
.
bottom
=
a
(
"
.bs-docs-footer
"
).
outerHeight
(
!
0
)}}})},
100
),
setTimeout
(
function
(){
a
(
"
.bs-top
"
).
affix
()},
100
),
a
(
"
.tooltip-demo
"
).
tooltip
({
selector
:
"
[data-toggle=tooltip]
"
,
container
:
"
body
"
}),
a
(
"
.tooltip-test
"
).
tooltip
(),
a
(
"
.popover-test
"
).
popover
(),
a
(
"
.bs-docs-navbar
"
).
tooltip
({
selector
:
"
a[data-toggle=tooltip]
"
,
container
:
"
.bs-docs-navbar .nav
"
}),
a
(
"
.bs-docs-popover
"
).
popover
(),
a
(
"
.bs-docs-popover-dismiss
"
).
popover
({
trigger
:
"
focus
"
}),
a
(
"
#loading-example-btn
"
).
click
(
function
(){
var
b
=
a
(
this
);
b
.
button
(
"
loading
"
),
setTimeout
(
function
(){
b
.
button
(
"
reset
"
)},
3
e3
)})})}(
jQuery
);
\ No newline at end of file
\ No newline at end of file
docs/dist/js/bootstrap.min.js
View file @
ee2df11e
This diff is collapsed.
Click to expand it.
grunt/.jshintrc
View file @
ee2df11e
...
@@ -6,5 +6,6 @@
...
@@ -6,5 +6,6 @@
"node" : true,
"node" : true,
"nonbsp": true,
"nonbsp": true,
"strict": true,
"strict": true,
"undef" : true
"undef" : true,
"unused": true
}
}
js/.jshintrc
View file @
ee2df11e
...
@@ -8,5 +8,6 @@
...
@@ -8,5 +8,6 @@
"eqnull" : true,
"eqnull" : true,
"expr" : true,
"expr" : true,
"laxbreak" : true,
"laxbreak" : true,
"unused" : true,
"validthis": true
"validthis": true
}
}
js/scrollspy.js
View file @
ee2df11e
...
@@ -43,7 +43,8 @@
...
@@ -43,7 +43,8 @@
this
.
targets
=
$
([])
this
.
targets
=
$
([])
var
self
=
this
var
self
=
this
var
$targets
=
this
.
$body
this
.
$body
.
find
(
this
.
selector
)
.
find
(
this
.
selector
)
.
map
(
function
()
{
.
map
(
function
()
{
var
$el
=
$
(
this
)
var
$el
=
$
(
this
)
...
...
js/tests/unit/affix.js
View file @
ee2df11e
...
@@ -28,14 +28,14 @@ $(function () {
...
@@ -28,14 +28,14 @@ $(function () {
var
template
=
$
(
'
<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>
'
)
var
template
=
$
(
'
<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>
'
)
template
.
appendTo
(
'
body
'
)
template
.
appendTo
(
'
body
'
)
var
affixer
=
$
(
'
#affixTarget
'
).
affix
({
$
(
'
#affixTarget
'
).
affix
({
offset
:
$
(
'
#affixTarget ul
'
).
position
()
offset
:
$
(
'
#affixTarget ul
'
).
position
()
})
})
$
(
'
#affixTarget
'
)
$
(
'
#affixTarget
'
)
.
on
(
'
affix.bs.affix
'
,
function
(
e
)
{
.
on
(
'
affix.bs.affix
'
,
function
()
{
ok
(
true
,
'
affix event triggered
'
)
ok
(
true
,
'
affix event triggered
'
)
}).
on
(
'
affixed.bs.affix
'
,
function
(
e
)
{
}).
on
(
'
affixed.bs.affix
'
,
function
()
{
ok
(
true
,
'
affixed event triggered
'
)
ok
(
true
,
'
affixed event triggered
'
)
$
(
'
#affixTarget
'
).
remove
()
$
(
'
#affixTarget
'
).
remove
()
$
(
'
#affixAfter
'
).
remove
()
$
(
'
#affixAfter
'
).
remove
()
...
...
js/tests/unit/button.js
View file @
ee2df11e
...
@@ -98,7 +98,6 @@ $(function () {
...
@@ -98,7 +98,6 @@ $(function () {
var
btn1
=
$
(
group
.
children
()[
0
])
var
btn1
=
$
(
group
.
children
()[
0
])
var
btn2
=
$
(
group
.
children
()[
1
])
var
btn2
=
$
(
group
.
children
()[
1
])
var
btn3
=
$
(
group
.
children
()[
2
])
group
.
appendTo
(
$
(
'
#qunit-fixture
'
))
group
.
appendTo
(
$
(
'
#qunit-fixture
'
))
...
...
js/tests/unit/collapse.js
View file @
ee2df11e
...
@@ -64,7 +64,7 @@ $(function () {
...
@@ -64,7 +64,7 @@ $(function () {
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
var
collapsible
=
$
(
'
<div id="test1"></div>
'
)
$
(
'
<div id="test1"></div>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
on
(
'
show.bs.collapse
'
,
function
()
{
.
on
(
'
show.bs.collapse
'
,
function
()
{
ok
(
!
target
.
hasClass
(
'
collapsed
'
))
ok
(
!
target
.
hasClass
(
'
collapsed
'
))
...
@@ -81,7 +81,7 @@ $(function () {
...
@@ -81,7 +81,7 @@ $(function () {
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
var
collapsible
=
$
(
'
<div id="test1" class="in"></div>
'
)
$
(
'
<div id="test1" class="in"></div>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
on
(
'
hide.bs.collapse
'
,
function
()
{
.
on
(
'
hide.bs.collapse
'
,
function
()
{
ok
(
target
.
hasClass
(
'
collapsed
'
))
ok
(
target
.
hasClass
(
'
collapsed
'
))
...
@@ -101,19 +101,19 @@ $(function () {
...
@@ -101,19 +101,19 @@ $(function () {
var
target1
=
$
(
'
<a data-toggle="collapse" href="#body1" data-parent="#accordion"></a>
'
)
var
target1
=
$
(
'
<a data-toggle="collapse" href="#body1" data-parent="#accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
var
collapsible1
=
$
(
'
<div id="body1" class="in"></div>
'
)
$
(
'
<div id="body1" class="in"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
var
target2
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body2" data-parent="#accordion"></a>
'
)
var
target2
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body2" data-parent="#accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
var
collapsible2
=
$
(
'
<div id="body2"></div>
'
)
$
(
'
<div id="body2"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
var
target3
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body3" data-parent="#accordion"></a>
'
)
var
target3
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body3" data-parent="#accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
var
collapsible3
=
$
(
'
<div id="body3"></div>
'
)
$
(
'
<div id="body3"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
on
(
'
show.bs.collapse
'
,
function
()
{
.
on
(
'
show.bs.collapse
'
,
function
()
{
ok
(
target1
.
hasClass
(
'
collapsed
'
))
ok
(
target1
.
hasClass
(
'
collapsed
'
))
...
@@ -136,19 +136,19 @@ $(function () {
...
@@ -136,19 +136,19 @@ $(function () {
var
target1
=
$
(
'
<a data-toggle="collapse" href="#body1" data-parent=".accordion"></a>
'
)
var
target1
=
$
(
'
<a data-toggle="collapse" href="#body1" data-parent=".accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
var
collapsible1
=
$
(
'
<div id="body1" class="in"></div>
'
)
$
(
'
<div id="body1" class="in"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
0
))
var
target2
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body2" data-parent=".accordion"></a>
'
)
var
target2
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body2" data-parent=".accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
var
collapsible2
=
$
(
'
<div id="body2"></div>
'
)
$
(
'
<div id="body2"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
1
))
var
target3
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body3" data-parent=".accordion"></a>
'
)
var
target3
=
$
(
'
<a class="collapsed" data-toggle="collapse" href="#body3" data-parent=".accordion"></a>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
var
collapsible3
=
$
(
'
<div id="body3"></div>
'
)
$
(
'
<div id="body3"></div>
'
)
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
appendTo
(
accordion
.
find
(
'
.accordion-group
'
).
eq
(
2
))
.
on
(
'
show.bs.collapse
'
,
function
()
{
.
on
(
'
show.bs.collapse
'
,
function
()
{
ok
(
target1
.
hasClass
(
'
collapsed
'
))
ok
(
target1
.
hasClass
(
'
collapsed
'
))
...
...
js/tests/unit/scrollspy.js
View file @
ee2df11e
...
@@ -18,7 +18,6 @@ $(function () {
...
@@ -18,7 +18,6 @@ $(function () {
test
(
'
should switch active class on scroll
'
,
function
()
{
test
(
'
should switch active class on scroll
'
,
function
()
{
var
sectionHTML
=
'
<div id="masthead"></div>
'
,
var
sectionHTML
=
'
<div id="masthead"></div>
'
,
$section
=
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
),
topbarHTML
=
'
<div class="topbar">
'
+
topbarHTML
=
'
<div class="topbar">
'
+
'
<div class="topbar-inner">
'
+
'
<div class="topbar-inner">
'
+
'
<div class="container">
'
+
'
<div class="container">
'
+
...
@@ -30,6 +29,7 @@ $(function () {
...
@@ -30,6 +29,7 @@ $(function () {
'
</div>
'
,
'
</div>
'
,
$topbar
=
$
(
topbarHTML
).
scrollspy
()
$topbar
=
$
(
topbarHTML
).
scrollspy
()
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
)
ok
(
$topbar
.
find
(
'
.active
'
,
true
))
ok
(
$topbar
.
find
(
'
.active
'
,
true
))
})
})
...
...
js/tests/unit/tooltip.js
View file @
ee2df11e
...
@@ -68,7 +68,7 @@ $(function () {
...
@@ -68,7 +68,7 @@ $(function () {
test
(
'
should fire show event
'
,
function
()
{
test
(
'
should fire show event
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
show.bs.tooltip
'
,
function
()
{
.
on
(
'
show.bs.tooltip
'
,
function
()
{
ok
(
true
,
'
show was called
'
)
ok
(
true
,
'
show was called
'
)
start
()
start
()
...
@@ -78,7 +78,7 @@ $(function () {
...
@@ -78,7 +78,7 @@ $(function () {
test
(
'
should fire shown event
'
,
function
()
{
test
(
'
should fire shown event
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
ok
(
true
,
'
shown was called
'
)
ok
(
true
,
'
shown was called
'
)
start
()
start
()
...
@@ -88,7 +88,7 @@ $(function () {
...
@@ -88,7 +88,7 @@ $(function () {
test
(
'
should not fire shown event when default prevented
'
,
function
()
{
test
(
'
should not fire shown event when default prevented
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
show.bs.tooltip
'
,
function
(
e
)
{
.
on
(
'
show.bs.tooltip
'
,
function
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
ok
(
true
,
'
show was called
'
)
ok
(
true
,
'
show was called
'
)
...
@@ -102,7 +102,7 @@ $(function () {
...
@@ -102,7 +102,7 @@ $(function () {
test
(
'
should fire hide event
'
,
function
()
{
test
(
'
should fire hide event
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
$
(
this
).
tooltip
(
'
hide
'
)
})
})
...
@@ -115,7 +115,7 @@ $(function () {
...
@@ -115,7 +115,7 @@ $(function () {
test
(
'
should fire hidden event
'
,
function
()
{
test
(
'
should fire hidden event
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
$
(
this
).
tooltip
(
'
hide
'
)
})
})
...
@@ -128,7 +128,7 @@ $(function () {
...
@@ -128,7 +128,7 @@ $(function () {
test
(
'
should not fire hidden event when default prevented
'
,
function
()
{
test
(
'
should not fire hidden event when default prevented
'
,
function
()
{
stop
()
stop
()
var
tooltip
=
$
(
'
<div title="tooltip title"></div>
'
)
$
(
'
<div title="tooltip title"></div>
'
)
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
.
on
(
'
shown.bs.tooltip
'
,
function
()
{
$
(
this
).
tooltip
(
'
hide
'
)
$
(
this
).
tooltip
(
'
hide
'
)
})
})
...
@@ -272,14 +272,14 @@ $(function () {
...
@@ -272,14 +272,14 @@ $(function () {
test
(
'
should show tooltip with delegate selector on click
'
,
function
()
{
test
(
'
should show tooltip with delegate selector on click
'
,
function
()
{
var
div
=
$
(
'
<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>
'
)
var
div
=
$
(
'
<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>
'
)
var
tooltip
=
div
.
appendTo
(
'
#qunit-fixture
'
)
div
.
appendTo
(
'
#qunit-fixture
'
)
.
tooltip
({
selector
:
'
a[rel=tooltip]
'
,
trigger
:
'
click
'
})
.
tooltip
({
selector
:
'
a[rel=tooltip]
'
,
trigger
:
'
click
'
})
div
.
find
(
'
a
'
).
trigger
(
'
click
'
)
div
.
find
(
'
a
'
).
trigger
(
'
click
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip is faded in
'
)
ok
(
$
(
'
.tooltip
'
).
is
(
'
.fade.in
'
),
'
tooltip is faded in
'
)
})
})
test
(
'
should show tooltip when toggle is called
'
,
function
()
{
test
(
'
should show tooltip when toggle is called
'
,
function
()
{
var
tooltip
=
$
(
'
<a href="#" rel="tooltip" title="tooltip on toggle"></a>
'
)
$
(
'
<a href="#" rel="tooltip" title="tooltip on toggle"></a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
tooltip
({
trigger
:
'
manual
'
})
.
tooltip
({
trigger
:
'
manual
'
})
.
tooltip
(
'
toggle
'
)
.
tooltip
(
'
toggle
'
)
...
@@ -298,8 +298,8 @@ $(function () {
...
@@ -298,8 +298,8 @@ $(function () {
test
(
'
should place tooltip inside window
'
,
function
()
{
test
(
'
should place tooltip inside window
'
,
function
()
{
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
)
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
)
.
css
({
position
:
'
absolute
'
,
width
:
200
,
height
:
200
,
bottom
:
0
,
left
:
0
})
,
.
css
({
position
:
'
absolute
'
,
width
:
200
,
height
:
200
,
bottom
:
0
,
left
:
0
})
tooltip
=
$
(
'
<a href="#" title="Very very very very very very very very long tooltip">Hover me</a>
'
)
$
(
'
<a href="#" title="Very very very very very very very very long tooltip">Hover me</a>
'
)
.
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
})
...
...
js/tooltip.js
View file @
ee2df11e
...
@@ -195,7 +195,6 @@
...
@@ -195,7 +195,6 @@
}
}
Tooltip
.
prototype
.
applyPlacement
=
function
(
offset
,
placement
)
{
Tooltip
.
prototype
.
applyPlacement
=
function
(
offset
,
placement
)
{
var
replace
var
$tip
=
this
.
tip
()
var
$tip
=
this
.
tip
()
var
width
=
$tip
[
0
].
offsetWidth
var
width
=
$tip
[
0
].
offsetWidth
var
height
=
$tip
[
0
].
offsetHeight
var
height
=
$tip
[
0
].
offsetHeight
...
...
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