Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
夏彬
jquery
Commits
69585ba3
Commit
69585ba3
authored
Sep 07, 2011
by
Dave Methvin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #489 from dmethvin/fix-10208-button-type
Fix #10208. Check for `button` as well as `input`
parents
8e8fa6dc
81c778b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
event.js
src/event.js
+3
-2
event.js
test/unit/event.js
+5
-1
No files found.
src/event.js
View file @
69585ba3
...
@@ -702,8 +702,9 @@ if ( !jQuery.support.submitBubbles ) {
...
@@ -702,8 +702,9 @@ if ( !jQuery.support.submitBubbles ) {
setup
:
function
(
data
,
namespaces
)
{
setup
:
function
(
data
,
namespaces
)
{
if
(
!
jQuery
.
nodeName
(
this
,
"form"
)
)
{
if
(
!
jQuery
.
nodeName
(
this
,
"form"
)
)
{
jQuery
.
event
.
add
(
this
,
"click.specialSubmit"
,
function
(
e
)
{
jQuery
.
event
.
add
(
this
,
"click.specialSubmit"
,
function
(
e
)
{
// Avoid triggering error on non-existent type attribute in IE VML (#7071)
var
elem
=
e
.
target
,
var
elem
=
e
.
target
,
type
=
jQuery
.
nodeName
(
elem
,
"input"
)
?
elem
.
type
:
""
;
type
=
jQuery
.
nodeName
(
elem
,
"input"
)
||
jQuery
.
nodeName
(
elem
,
"button"
)
?
elem
.
type
:
""
;
if
(
(
type
===
"submit"
||
type
===
"image"
)
&&
jQuery
(
elem
).
closest
(
"form"
).
length
)
{
if
(
(
type
===
"submit"
||
type
===
"image"
)
&&
jQuery
(
elem
).
closest
(
"form"
).
length
)
{
trigger
(
"submit"
,
this
,
arguments
);
trigger
(
"submit"
,
this
,
arguments
);
...
@@ -712,7 +713,7 @@ if ( !jQuery.support.submitBubbles ) {
...
@@ -712,7 +713,7 @@ if ( !jQuery.support.submitBubbles ) {
jQuery
.
event
.
add
(
this
,
"keypress.specialSubmit"
,
function
(
e
)
{
jQuery
.
event
.
add
(
this
,
"keypress.specialSubmit"
,
function
(
e
)
{
var
elem
=
e
.
target
,
var
elem
=
e
.
target
,
type
=
jQuery
.
nodeName
(
elem
,
"input"
)
?
elem
.
type
:
""
;
type
=
jQuery
.
nodeName
(
elem
,
"input"
)
||
jQuery
.
nodeName
(
elem
,
"button"
)
?
elem
.
type
:
""
;
if
(
(
type
===
"text"
||
type
===
"password"
)
&&
jQuery
(
elem
).
closest
(
"form"
).
length
&&
e
.
keyCode
===
13
)
{
if
(
(
type
===
"text"
||
type
===
"password"
)
&&
jQuery
(
elem
).
closest
(
"form"
).
length
&&
e
.
keyCode
===
13
)
{
trigger
(
"submit"
,
this
,
arguments
);
trigger
(
"submit"
,
this
,
arguments
);
...
...
test/unit/event.js
View file @
69585ba3
...
@@ -1633,7 +1633,7 @@ test("live with change", function(){
...
@@ -1633,7 +1633,7 @@ test("live with change", function(){
});
});
test
(
"live with submit"
,
function
()
{
test
(
"live with submit"
,
function
()
{
expect
(
5
);
expect
(
7
);
var
count1
=
0
,
count2
=
0
;
var
count1
=
0
,
count2
=
0
;
...
@@ -1659,6 +1659,10 @@ test("live with submit", function() {
...
@@ -1659,6 +1659,10 @@ test("live with submit", function() {
equals
(
count1
,
2
,
"Verify form submit."
);
equals
(
count1
,
2
,
"Verify form submit."
);
equals
(
count2
,
2
,
"Verify body submit."
);
equals
(
count2
,
2
,
"Verify body submit."
);
jQuery
(
"#testForm button[name=sub4]"
)[
0
].
click
();
equals
(
count1
,
3
,
"Verify form submit."
);
equals
(
count2
,
3
,
"Verify body submit."
);
jQuery
(
"#testForm"
).
die
(
"submit"
);
jQuery
(
"#testForm"
).
die
(
"submit"
);
jQuery
(
"#testForm input[name=sub1]"
).
die
(
"click"
);
jQuery
(
"#testForm input[name=sub1]"
).
die
(
"click"
);
jQuery
(
"body"
).
die
(
"submit"
);
jQuery
(
"body"
).
die
(
"submit"
);
...
...
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