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
ef5ac02b
Commit
ef5ac02b
authored
13 years ago
by
Jacob Thornton
Browse files
Options
Download
Email Patches
Plain Diff
allow prevent default for show and hide event in modal
parent
f9f03d89
2 merge requests
!2929
Responsive video - from zurp's foundation
,
!2875
2.0.3 wip
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
docs/assets/bootstrap.zip
+0
-0
docs/assets/bootstrap.zip
docs/assets/js/bootstrap-modal.js
+12
-7
docs/assets/js/bootstrap-modal.js
js/bootstrap-modal.js
+12
-7
js/bootstrap-modal.js
js/tests/unit/bootstrap-modal.js
+29
-0
js/tests/unit/bootstrap-modal.js
with
53 additions
and
14 deletions
+53
-14
docs/assets/bootstrap.zip
+
0
-
0
View file @
ef5ac02b
No preview for this file type
This diff is collapsed.
Click to expand it.
docs/assets/js/bootstrap-modal.js
+
12
-
7
View file @
ef5ac02b
...
...
@@ -41,13 +41,15 @@
,
show
:
function
()
{
var
that
=
this
,
e
=
$
.
Event
(
'
show
'
)
if
(
this
.
isShown
)
return
this
.
$element
.
trigger
(
e
)
if
(
this
.
isShown
||
e
.
isDefaultPrevented
())
return
$
(
'
body
'
).
addClass
(
'
modal-open
'
)
this
.
isShown
=
true
this
.
$element
.
trigger
(
'
show
'
)
escape
.
call
(
this
)
backdrop
.
call
(
this
,
function
()
{
...
...
@@ -74,18 +76,21 @@
,
hide
:
function
(
e
)
{
e
&&
e
.
preventDefault
()
if
(
!
this
.
isShown
)
return
var
that
=
this
e
=
$
.
Event
(
'
hide
'
)
this
.
$element
.
trigger
(
e
)
if
(
!
this
.
isShown
||
e
.
isDefaultPrevented
())
return
this
.
isShown
=
false
$
(
'
body
'
).
removeClass
(
'
modal-open
'
)
escape
.
call
(
this
)
this
.
$element
.
trigger
(
'
hide
'
)
.
removeClass
(
'
in
'
)
this
.
$element
.
removeClass
(
'
in
'
)
$
.
support
.
transition
&&
this
.
$element
.
hasClass
(
'
fade
'
)
?
hideWithTransition
.
call
(
this
)
:
...
...
This diff is collapsed.
Click to expand it.
js/bootstrap-modal.js
+
12
-
7
View file @
ef5ac02b
...
...
@@ -41,13 +41,15 @@
,
show
:
function
()
{
var
that
=
this
,
e
=
$
.
Event
(
'
show
'
)
if
(
this
.
isShown
)
return
this
.
$element
.
trigger
(
e
)
if
(
this
.
isShown
||
e
.
isDefaultPrevented
())
return
$
(
'
body
'
).
addClass
(
'
modal-open
'
)
this
.
isShown
=
true
this
.
$element
.
trigger
(
'
show
'
)
escape
.
call
(
this
)
backdrop
.
call
(
this
,
function
()
{
...
...
@@ -74,18 +76,21 @@
,
hide
:
function
(
e
)
{
e
&&
e
.
preventDefault
()
if
(
!
this
.
isShown
)
return
var
that
=
this
e
=
$
.
Event
(
'
hide
'
)
this
.
$element
.
trigger
(
e
)
if
(
!
this
.
isShown
||
e
.
isDefaultPrevented
())
return
this
.
isShown
=
false
$
(
'
body
'
).
removeClass
(
'
modal-open
'
)
escape
.
call
(
this
)
this
.
$element
.
trigger
(
'
hide
'
)
.
removeClass
(
'
in
'
)
this
.
$element
.
removeClass
(
'
in
'
)
$
.
support
.
transition
&&
this
.
$element
.
hasClass
(
'
fade
'
)
?
hideWithTransition
.
call
(
this
)
:
...
...
This diff is collapsed.
Click to expand it.
js/tests/unit/bootstrap-modal.js
+
29
-
0
View file @
ef5ac02b
...
...
@@ -29,6 +29,35 @@ $(function () {
.
modal
(
"
show
"
)
})
test
(
"
should fire show event
"
,
function
()
{
stop
()
$
.
support
.
transition
=
false
$
(
"
<div id='modal-test'></div>
"
)
.
bind
(
"
show
"
,
function
()
{
ok
(
true
,
"
show was called
"
)
})
.
bind
(
"
shown
"
,
function
()
{
$
(
this
).
remove
()
start
()
})
.
modal
(
"
show
"
)
})
test
(
"
should not fire shown when default prevented
"
,
function
()
{
stop
()
$
.
support
.
transition
=
false
$
(
"
<div id='modal-test'></div>
"
)
.
bind
(
"
show
"
,
function
(
e
)
{
e
.
preventDefault
()
ok
(
true
,
"
show was called
"
)
start
()
})
.
bind
(
"
shown
"
,
function
()
{
ok
(
false
,
"
shown was called
"
)
})
.
modal
(
"
show
"
)
})
test
(
"
should hide modal when hide is called
"
,
function
()
{
stop
()
$
.
support
.
transition
=
false
...
...
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