Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent ENTER propagation on form #826

Merged
merged 2 commits into from
Jan 2, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/bootstrap-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,8 @@
this.fill();
if (this.picker.is(':visible')){
e.preventDefault();
e.stopPropagation && e.stopPropagation();
e.cancelBubble = true; // IE6,7,8 support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jQuery events' stopPropagation method does both of these (check for e.stopPropagation's existence and setting cancelBubble to true), so just a call to that would work.

https://github.com/jquery/jquery/blob/1.8-stable/speed/jquery-basis.js#L2122

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please replace the check of e.stopPropagation and the e.cancelBubble = true with a single e.stopPropagation() call

if (this.o.autoclose)
this.hide();
}
Expand Down