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
3f577ab8
Commit
3f577ab8
authored
11 years ago
by
Mark Otto
Browse files
Options
Download
Plain Diff
Merge pull request #11881 from ZDroid/patch-1
Require comma on left side
parents
ee709db6
ba3639b2
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
js/.jscs.json
+1
-0
js/.jscs.json
js/carousel.js
+3
-3
js/carousel.js
js/dropdown.js
+2
-2
js/dropdown.js
js/modal.js
+3
-3
js/modal.js
js/popover.js
+5
-5
js/popover.js
js/tab.js
+2
-2
js/tab.js
js/tests/unit/alert.js
+4
-4
js/tests/unit/alert.js
js/tests/unit/button.js
+5
-5
js/tests/unit/button.js
js/tests/unit/dropdown.js
+28
-28
js/tests/unit/dropdown.js
js/tests/unit/popover.js
+5
-5
js/tests/unit/popover.js
js/tests/unit/scrollspy.js
+4
-4
js/tests/unit/scrollspy.js
js/tests/unit/tooltip.js
+20
-20
js/tests/unit/tooltip.js
js/tooltip.js
+13
-13
js/tooltip.js
js/transition.js
+4
-4
js/transition.js
with
99 additions
and
98 deletions
+99
-98
js/.jscs.json
+
1
-
0
View file @
3f577ab8
{
"requireSpaceAfterKeywords"
:
[
"if"
,
"else"
,
"for"
,
"while"
,
"do"
,
"switch"
,
"return"
,
"try"
,
"catch"
],
"requireSpacesInFunctionExpression"
:
{
"beforeOpeningCurlyBrace"
:
true
},
"requireLeftStickedOperators"
:
[
","
],
"disallowLeftStickedOperators"
:
[
"?"
,
"+"
,
"-"
,
"/"
,
"*"
,
"="
,
"=="
,
"==="
,
"!="
,
"!=="
,
">"
,
">="
,
"<"
,
"<="
],
"requireRightStickedOperators"
:
[
"!"
],
"disallowRightStickedOperators"
:
[
"?"
,
"/"
,
"*"
,
":"
,
"="
,
"=="
,
"==="
,
"!="
,
"!=="
,
">"
,
">="
,
"<"
,
"<="
],
...
...
This diff is collapsed.
Click to expand it.
js/carousel.js
+
3
-
3
View file @
3f577ab8
...
...
@@ -39,9 +39,9 @@
}
Carousel
.
DEFAULTS
=
{
interval
:
5000
,
pause
:
'
hover
'
,
wrap
:
true
interval
:
5000
,
pause
:
'
hover
'
,
wrap
:
true
}
Carousel
.
prototype
.
cycle
=
function
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
js/dropdown.js
+
2
-
2
View file @
3f577ab8
...
...
@@ -148,7 +148,7 @@
$
(
document
)
.
on
(
'
click.bs.dropdown.data-api
'
,
clearMenus
)
.
on
(
'
click.bs.dropdown.data-api
'
,
'
.dropdown form
'
,
function
(
e
)
{
e
.
stopPropagation
()
})
.
on
(
'
click.bs.dropdown.data-api
'
,
toggle
,
Dropdown
.
prototype
.
toggle
)
.
on
(
'
keydown.bs.dropdown.data-api
'
,
toggle
+
'
, [role=menu]
'
,
Dropdown
.
prototype
.
keydown
)
.
on
(
'
click.bs.dropdown.data-api
'
,
toggle
,
Dropdown
.
prototype
.
toggle
)
.
on
(
'
keydown.bs.dropdown.data-api
'
,
toggle
+
'
, [role=menu]
'
,
Dropdown
.
prototype
.
keydown
)
}(
jQuery
);
This diff is collapsed.
Click to expand it.
js/modal.js
+
3
-
3
View file @
3f577ab8
...
...
@@ -33,9 +33,9 @@
}
Modal
.
DEFAULTS
=
{
backdrop
:
true
,
keyboard
:
true
,
show
:
true
backdrop
:
true
,
keyboard
:
true
,
show
:
true
}
Modal
.
prototype
.
toggle
=
function
(
_relatedTarget
)
{
...
...
This diff is collapsed.
Click to expand it.
js/popover.js
+
5
-
5
View file @
3f577ab8
...
...
@@ -29,11 +29,11 @@
if
(
!
$
.
fn
.
tooltip
)
throw
new
Error
(
'
Popover requires tooltip.js
'
)
Popover
.
DEFAULTS
=
$
.
extend
({}
,
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
,
{
placement
:
'
right
'
,
trigger
:
'
click
'
,
content
:
''
,
template
:
'
<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>
'
Popover
.
DEFAULTS
=
$
.
extend
({},
$
.
fn
.
tooltip
.
Constructor
.
DEFAULTS
,
{
placement
:
'
right
'
,
trigger
:
'
click
'
,
content
:
''
,
template
:
'
<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>
'
})
...
...
This diff is collapsed.
Click to expand it.
js/tab.js
+
2
-
2
View file @
3f577ab8
...
...
@@ -53,8 +53,8 @@
this
.
activate
(
$this
.
parent
(
'
li
'
),
$ul
)
this
.
activate
(
$target
,
$target
.
parent
(),
function
()
{
$this
.
trigger
({
type
:
'
shown.bs.tab
'
,
relatedTarget
:
previous
type
:
'
shown.bs.tab
'
,
relatedTarget
:
previous
})
})
}
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/alert.js
+
4
-
4
View file @
3f577ab8
...
...
@@ -20,8 +20,8 @@ $(function () {
var
alertHTML
=
'
<div class="alert-message warning fade in">
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
,
alert
=
$
(
alertHTML
).
alert
()
+
'
</div>
'
,
alert
=
$
(
alertHTML
).
alert
()
alert
.
find
(
'
.close
'
).
click
()
...
...
@@ -34,8 +34,8 @@ $(function () {
var
alertHTML
=
'
<div class="alert-message warning fade in">
'
+
'
<a class="close" href="#" data-dismiss="alert">×</a>
'
+
'
<p><strong>Holy guacamole!</strong> Best check yo self, you
\'
re not looking too good.</p>
'
+
'
</div>
'
,
alert
=
$
(
alertHTML
).
appendTo
(
'
#qunit-fixture
'
).
alert
()
+
'
</div>
'
,
alert
=
$
(
alertHTML
).
appendTo
(
'
#qunit-fixture
'
).
alert
()
ok
(
$
(
'
#qunit-fixture
'
).
find
(
'
.alert-message
'
).
length
,
'
element added to dom
'
)
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/button.js
+
5
-
5
View file @
3f577ab8
...
...
@@ -59,8 +59,8 @@ $(function () {
})
test
(
'
should toggle active when btn children are clicked
'
,
function
()
{
var
btn
=
$
(
'
<button class="btn" data-toggle="button">mdo</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
var
btn
=
$
(
'
<button class="btn" data-toggle="button">mdo</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
btn
.
append
(
inner
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
...
...
@@ -70,9 +70,9 @@ $(function () {
})
test
(
'
should toggle active when btn children are clicked within btn-group
'
,
function
()
{
var
btngroup
=
$
(
'
<div class="btn-group" data-toggle="buttons"></div>
'
)
,
btn
=
$
(
'
<button class="btn">fat</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
var
btngroup
=
$
(
'
<div class="btn-group" data-toggle="buttons"></div>
'
)
,
btn
=
$
(
'
<button class="btn">fat</button>
'
)
,
inner
=
$
(
'
<i></i>
'
)
btngroup
.
append
(
btn
.
append
(
inner
))
.
appendTo
(
$
(
'
#qunit-fixture
'
))
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/dropdown.js
+
28
-
28
View file @
3f577ab8
...
...
@@ -28,8 +28,8 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
...
...
@@ -45,8 +45,8 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
ok
(
!
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
...
...
@@ -62,8 +62,8 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
...
...
@@ -79,8 +79,8 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
).
find
(
'
[data-toggle="dropdown"]
'
).
dropdown
().
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
})
...
...
@@ -97,12 +97,12 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
.
click
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
.
click
()
ok
(
dropdown
.
parent
(
'
.dropdown
'
).
hasClass
(
'
open
'
),
'
open class added on click
'
)
$
(
'
body
'
).
click
()
...
...
@@ -127,10 +127,10 @@ $(function () {
+
'
<ul class="dropdown-menu">
'
+
'
<li><a href="#">Action 1</a></li>
'
+
'
</ul>
'
+
'
</div>
'
,
dropdowns
=
$
(
dropdownHTML
).
appendTo
(
'
#qunit-fixture
'
).
find
(
'
[data-toggle="dropdown"]
'
)
,
first
=
dropdowns
.
first
()
,
last
=
dropdowns
.
last
()
+
'
</div>
'
,
dropdowns
=
$
(
dropdownHTML
).
appendTo
(
'
#qunit-fixture
'
).
find
(
'
[data-toggle="dropdown"]
'
)
,
first
=
dropdowns
.
first
()
,
last
=
dropdowns
.
last
()
ok
(
dropdowns
.
length
==
2
,
'
Should be two dropdowns
'
)
...
...
@@ -160,11 +160,11 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
stop
()
...
...
@@ -194,11 +194,11 @@ $(function () {
+
'
<li><a href="#">Another link</a></li>
'
+
'
</ul>
'
+
'
</li>
'
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
+
'
</ul>
'
,
dropdown
=
$
(
dropdownHTML
)
.
appendTo
(
'
#qunit-fixture
'
)
.
find
(
'
[data-toggle="dropdown"]
'
)
.
dropdown
()
stop
()
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/popover.js
+
5
-
5
View file @
3f577ab8
...
...
@@ -44,8 +44,8 @@ $(function () {
.
popover
({
title
:
function
()
{
return
'
@fat
'
}
,
content
:
function
()
{
}
,
content
:
function
()
{
return
'
loves writing tests (╯°□°)╯︵ ┻━┻
'
}
})
...
...
@@ -102,9 +102,9 @@ $(function () {
var
popover
=
$
(
'
<a href="#">@fat</a>
'
)
.
appendTo
(
'
#qunit-fixture
'
)
.
popover
({
title
:
'
Test
'
,
content
:
'
Test
'
,
template
:
'
<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>
'
title
:
'
Test
'
,
content
:
'
Test
'
,
template
:
'
<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>
'
})
popover
.
popover
(
'
show
'
)
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/scrollspy.js
+
4
-
4
View file @
3f577ab8
...
...
@@ -18,8 +18,8 @@ $(function () {
test
(
'
should switch active class on scroll
'
,
function
()
{
var
sectionHTML
=
'
<div id="masthead"></div>
'
,
$section
=
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
)
,
topbarHTML
=
'
<div class="topbar">
'
$section
=
$
(
sectionHTML
).
append
(
'
#qunit-fixture
'
)
,
topbarHTML
=
'
<div class="topbar">
'
+
'
<div class="topbar-inner">
'
+
'
<div class="container">
'
+
'
<h3><a href="#">Bootstrap</a></h3>
'
...
...
@@ -28,8 +28,8 @@ $(function () {
+
'
</ul>
'
+
'
</div>
'
+
'
</div>
'
+
'
</div>
'
,
$topbar
=
$
(
topbarHTML
).
scrollspy
()
+
'
</div>
'
,
$topbar
=
$
(
topbarHTML
).
scrollspy
()
ok
(
$topbar
.
find
(
'
.active
'
,
true
))
})
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/tooltip.js
+
20
-
20
View file @
3f577ab8
...
...
@@ -299,8 +299,8 @@ $(function () {
test
(
'
should place tooltip inside window
'
,
function
()
{
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
)
.
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>
'
)
.
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>
'
)
.
css
({
position
:
'
absolute
'
,
top
:
0
,
left
:
0
})
.
appendTo
(
container
)
.
tooltip
({
placement
:
'
top
'
,
animate
:
false
})
...
...
@@ -318,13 +318,13 @@ $(function () {
test
(
'
should place tooltip on top of element
'
,
function
()
{
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
)
.
css
({
position
:
'
absolute
'
,
bottom
:
0
,
left
:
0
,
textAlign
:
'
right
'
,
width
:
300
,
height
:
300
})
,
p
=
$
(
'
<p style="margin-top:200px" />
'
).
appendTo
(
container
)
,
tooltiped
=
$
(
'
<a href="#" title="very very very very very very very long tooltip">Hover me</a>
'
)
.
css
({
marginTop
:
200
})
.
appendTo
(
p
)
.
tooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
tooltip
(
'
show
'
)
.
css
({
position
:
'
absolute
'
,
bottom
:
0
,
left
:
0
,
textAlign
:
'
right
'
,
width
:
300
,
height
:
300
})
,
p
=
$
(
'
<p style="margin-top:200px" />
'
).
appendTo
(
container
)
,
tooltiped
=
$
(
'
<a href="#" title="very very very very very very very long tooltip">Hover me</a>
'
)
.
css
({
marginTop
:
200
})
.
appendTo
(
p
)
.
tooltip
({
placement
:
'
top
'
,
animate
:
false
})
.
tooltip
(
'
show
'
)
stop
()
...
...
@@ -340,12 +340,12 @@ $(function () {
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"></a>
'
)
var
container
=
$
(
'
<div />
'
).
appendTo
(
'
body
'
)
,
target
=
$
(
'
<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"></a>
'
)
.
appendTo
(
container
)
.
tooltip
({
placement
:
'
right
'
})
.
tooltip
(
'
show
'
)
,
tooltip
=
container
.
find
(
'
.tooltip
'
)
.
tooltip
(
'
show
'
)
,
tooltip
=
container
.
find
(
'
.tooltip
'
)
ok
(
Math
.
round
(
target
.
offset
().
top
+
(
target
[
0
].
offsetHeight
/
2
)
-
(
tooltip
[
0
].
offsetHeight
/
2
))
===
Math
.
round
(
tooltip
.
offset
().
top
)
)
target
.
tooltip
(
'
hide
'
)
...
...
@@ -389,13 +389,13 @@ $(function () {
test
(
'
tooltips should be placed dynamically, with the dynamic placement option
'
,
function
()
{
$
.
support
.
transition
=
false
var
ttContainer
=
$
(
'
<div id="dynamic-tt-test"/>
'
).
css
({
'
height
'
:
400
,
'
overflow
'
:
'
hidden
'
,
'
position
'
:
'
absolute
'
,
'
top
'
:
0
,
'
left
'
:
0
,
'
width
'
:
600
})
.
appendTo
(
'
body
'
)
'
height
'
:
400
,
'
overflow
'
:
'
hidden
'
,
'
position
'
:
'
absolute
'
,
'
top
'
:
0
,
'
left
'
:
0
,
'
width
'
:
600
})
.
appendTo
(
'
body
'
)
var
topTooltip
=
$
(
'
<div style="display: inline-block; position: absolute; left: 0; top: 0;" rel="tooltip" title="Top tooltip">Top Dynamic Tooltip</div>
'
)
.
appendTo
(
'
#dynamic-tt-test
'
)
...
...
This diff is collapsed.
Click to expand it.
js/tooltip.js
+
13
-
13
View file @
3f577ab8
...
...
@@ -36,15 +36,15 @@
}
Tooltip
.
DEFAULTS
=
{
animation
:
true
,
placement
:
'
top
'
,
selector
:
false
,
template
:
'
<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>
'
,
trigger
:
'
hover focus
'
,
title
:
''
,
delay
:
0
,
html
:
false
,
container
:
false
animation
:
true
,
placement
:
'
top
'
,
selector
:
false
,
template
:
'
<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>
'
,
trigger
:
'
hover focus
'
,
title
:
''
,
delay
:
0
,
html
:
false
,
container
:
false
}
Tooltip
.
prototype
.
init
=
function
(
type
,
element
,
options
)
{
...
...
@@ -83,8 +83,8 @@
if
(
options
.
delay
&&
typeof
options
.
delay
==
'
number
'
)
{
options
.
delay
=
{
show
:
options
.
delay
,
hide
:
options
.
delay
show
:
options
.
delay
,
hide
:
options
.
delay
}
}
...
...
@@ -295,8 +295,8 @@
Tooltip
.
prototype
.
getPosition
=
function
()
{
var
el
=
this
.
$element
[
0
]
return
$
.
extend
({},
(
typeof
el
.
getBoundingClientRect
==
'
function
'
)
?
el
.
getBoundingClientRect
()
:
{
width
:
el
.
offsetWidth
,
height
:
el
.
offsetHeight
width
:
el
.
offsetWidth
,
height
:
el
.
offsetHeight
},
this
.
$element
.
offset
())
}
...
...
This diff is collapsed.
Click to expand it.
js/transition.js
+
4
-
4
View file @
3f577ab8
...
...
@@ -27,10 +27,10 @@
var
el
=
document
.
createElement
(
'
bootstrap
'
)
var
transEndEventNames
=
{
'
WebkitTransition
'
:
'
webkitTransitionEnd
'
,
'
MozTransition
'
:
'
transitionend
'
,
'
OTransition
'
:
'
oTransitionEnd otransitionend
'
,
'
transition
'
:
'
transitionend
'
'
WebkitTransition
'
:
'
webkitTransitionEnd
'
,
'
MozTransition
'
:
'
transitionend
'
,
'
OTransition
'
:
'
oTransitionEnd otransitionend
'
,
'
transition
'
:
'
transitionend
'
}
for
(
var
name
in
transEndEventNames
)
{
...
...
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