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

Create "click" event using an event constructor #14

Merged
merged 2 commits into from
Oct 11, 2013
Merged
Changes from all commits
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
38 changes: 17 additions & 21 deletions vendor/assets/javascripts/twitter/bootstrap/rails/confirm.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,24 @@ $.rails.allowAction = (element) ->

if element.get(0).click
element.get(0).click()
else if $.isFunction(document.createEvent)
evt = document.createEvent "MouseEvents"
evt.initMouseEvent(
"click",
true, # e.bubbles,
true, #e.cancelable,
window, #e.view,
0, #e.detail,
0, #e.screenX,
0, #e.screenY,
0, #e.clientX,
0, #e.clientY,
false, #e.ctrlKey,
false, #e.altKey,
false, #e.shiftKey,
false, #e.metaKey,
0, #e.button,
document.body.parentNode #e.relatedTarget
)
element.get(0).dispatchEvent(evt)
else
element.trigger "click"
evt = new MouseEvents("click", {
bubbles : true,
cancelable : true,
view : window,
detail : 0,
screenX : 0,
screenY : 0,
clientX : 0,
clientY : 0,
ctrlKey : false,
altKey : false,
shiftKey : false,
metaKey : false,
button : 0,
relatedTarget : document.body.parentNode
})
element.get(0).dispatchEvent(evt)

$.rails.allowAction = allowAction

Expand Down