Skip to content

Commit

Permalink
Fixes #63
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoshdean committed Oct 1, 2014
1 parent 3d551ed commit c95aee2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ steal('./synthetic.js', function (Syn) {
}

//submit a form
if (!(Syn.support.clickSubmits) && (nodeName === "input" &&
type === "submit") ||
nodeName === 'button') {
if (!(Syn.support.clickSubmits) && ((nodeName == "input" ||
nodeName == 'button') && type == "submit" ) ) {

var form = Syn.closest(element, "form");
if (form) {
Expand Down
6 changes: 4 additions & 2 deletions test/qunit/mouse_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ steal("src/synthetic.js", function (Syn) {
"<input type='radio' name='radio' value='radio2' id='radio2'/>" +
"<a href='javascript:doSomething()' id='jsHref'>click me</a>" +
"<a href='#aHash' id='jsHrefHash'>click me</a>" +
"<button type='submit' id='submitButton'></button>" +
"<input type='submit' id='submit'/></div></form>";
},

Expand Down Expand Up @@ -57,10 +58,11 @@ steal("src/synthetic.js", function (Syn) {
return false;
};
st.bind(st.g("outer"), "submit", submitf);
Syn.trigger("click", {}, st.g("submitButton"));
Syn.trigger("click", {}, st.g("submit"));
Syn("submit", {}, "outer");

equal(submit, 2, "Click on submit");
equal(submit, 3, "Click on submit");

//make sure clicking the div does not submit the form
var click = 0,
Expand All @@ -75,7 +77,7 @@ steal("src/synthetic.js", function (Syn) {

Syn.trigger("click", {}, st.g("submit"));

equal(submit, 2, "Submit prevented");
equal(submit, 3, "Submit prevented");
equal(click, 1, "Clicked");

st.unbinder("outer", "submit", submitf);
Expand Down

0 comments on commit c95aee2

Please sign in to comment.