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
5b401a8c
Commit
5b401a8c
authored
Jun 02, 2012
by
Jacob Thornton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add collapsed class to collapse invoker when it's target is collapsed #3525
parent
5e5965ca
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
4 deletions
+41
-4
docs/assets/js/bootstrap-collapse.js
docs/assets/js/bootstrap-collapse.js
+1
-0
docs/assets/js/bootstrap.js
docs/assets/js/bootstrap.js
+1
-0
docs/assets/js/bootstrap.min.js
docs/assets/js/bootstrap.min.js
+1
-1
js/bootstrap-collapse.js
js/bootstrap-collapse.js
+2
-1
js/tests/unit/bootstrap-collapse.js
js/tests/unit/bootstrap-collapse.js
+36
-2
No files found.
docs/assets/js/bootstrap-collapse.js
View file @
5b401a8c
...
...
@@ -150,6 +150,7 @@
||
e
.
preventDefault
()
||
(
href
=
$this
.
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
)
//strip for ie7
,
option
=
$
(
target
).
data
(
'
collapse
'
)
?
'
toggle
'
:
$this
.
data
()
$this
[
$
(
target
).
hasClass
(
'
in
'
)
?
'
removeClass
'
:
'
addClass
'
](
'
show
'
)
$
(
target
).
collapse
(
option
)
})
})
...
...
docs/assets/js/bootstrap.js
View file @
5b401a8c
...
...
@@ -562,6 +562,7 @@
||
e
.
preventDefault
()
||
(
href
=
$this
.
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
)
//strip for ie7
,
option
=
$
(
target
).
data
(
'
collapse
'
)
?
'
toggle
'
:
$this
.
data
()
$this
[
$
(
target
).
hasClass
(
'
in
'
)
?
'
removeClass
'
:
'
addClass
'
](
'
show
'
)
$
(
target
).
collapse
(
option
)
})
})
...
...
docs/assets/js/bootstrap.min.js
View file @
5b401a8c
This diff is collapsed.
Click to expand it.
js/bootstrap-collapse.js
View file @
5b401a8c
...
...
@@ -144,12 +144,13 @@
* ==================== */
$
(
function
()
{
$
(
'
body
'
).
on
(
'
click.collapse.data-api
'
,
'
[data-toggle=collapse]
'
,
function
(
e
)
{
$
(
'
body
'
).
on
(
'
click.collapse.data-api
'
,
'
[data-toggle=collapse]
'
,
function
(
e
)
{
var
$this
=
$
(
this
),
href
,
target
=
$this
.
attr
(
'
data-target
'
)
||
e
.
preventDefault
()
||
(
href
=
$this
.
attr
(
'
href
'
))
&&
href
.
replace
(
/.*
(?=
#
[^\s]
+$
)
/
,
''
)
//strip for ie7
,
option
=
$
(
target
).
data
(
'
collapse
'
)
?
'
toggle
'
:
$this
.
data
()
$this
[
$
(
target
).
hasClass
(
'
in
'
)
?
'
addClass
'
:
'
removeClass
'
](
'
collapsed
'
)
$
(
target
).
collapse
(
option
)
})
})
...
...
js/tests/unit/bootstrap-collapse.js
View file @
5b401a8c
...
...
@@ -24,7 +24,7 @@ $(function () {
test
(
"
should not fire shown when show is prevented
"
,
function
()
{
$
.
support
.
transition
=
false
stop
()
;
stop
()
$
(
'
<div class="collapse"/>
'
)
.
bind
(
'
show
'
,
function
(
e
)
{
e
.
preventDefault
();
...
...
@@ -39,7 +39,7 @@ $(function () {
test
(
"
should reset style to auto after finishing opening collapse
"
,
function
()
{
$
.
support
.
transition
=
false
stop
()
;
stop
()
$
(
'
<div class="collapse" style="height: 0px"/>
'
)
.
bind
(
'
show
'
,
function
()
{
ok
(
this
.
style
.
height
==
'
0px
'
)
...
...
@@ -51,4 +51,38 @@ $(function () {
.
collapse
(
'
show
'
)
})
test
(
"
should add active class to target when collapse shown
"
,
function
()
{
$
.
support
.
transition
=
false
stop
()
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
var
collapsible
=
$
(
'
<div id="test1"></div>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
on
(
'
show
'
,
function
()
{
ok
(
!
target
.
hasClass
(
'
collapsed
'
))
start
()
})
target
.
click
()
})
test
(
"
should remove active class to target when collapse hidden
"
,
function
()
{
$
.
support
.
transition
=
false
stop
()
var
target
=
$
(
'
<a data-toggle="collapse" href="#test1"></a>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
var
collapsible
=
$
(
'
<div id="test1" class="in"></div>
'
)
.
appendTo
(
$
(
'
#qunit-fixture
'
))
.
on
(
'
hide
'
,
function
()
{
ok
(
target
.
hasClass
(
'
collapsed
'
))
start
()
})
target
.
click
()
})
})
\ No newline at end of file
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