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

Crash on artificially triggered click events #338

Closed
paulsmirnov opened this issue Sep 20, 2017 · 4 comments
Closed

Crash on artificially triggered click events #338

paulsmirnov opened this issue Sep 20, 2017 · 4 comments

Comments

@paulsmirnov
Copy link

Expected behavior

The library should not crash =)

Actual behavior

When you trigger a click event programmatically, there's a crash:

Uncaught TypeError: Cannot read property 'pageX' of undefined
    at HTMLDocument.i (file:///D:/Projects/jquery.terminal/js/jquery.terminal.min.js:36:79196)
    at HTMLDocument.dispatch (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:4351)
    at HTMLDocument.i (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:328)
    at Object.trigger (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:3038)
    at HTMLAnchorElement.<anonymous> (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:10497)
    at Function.each (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:2:11937)
    at init.each (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:2:8483)
    at init.trigger (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:10473)
    at init.f.fn.(anonymous function) [as click] (file:///D:/Projects/jquery.terminal/js/jquery-1.7.1.min.js:3:11270)
    at HTMLButtonElement.onclick (file:///D:/Projects/jquery.terminal/examples/tilda-demo.html:109:57)

Steps to reproduce

The following patch for one of examples serves as a MWE:

diff --git a/examples/tilda-demo.html b/examples/tilda-demo.html
index 81fd4ef..83fb711 100644
--- a/examples/tilda-demo.html
+++ b/examples/tilda-demo.html
@@ -105,5 +105,7 @@ jQuery(document).ready(function($) {
 <body>
     <div id="tilda"></div>
     <h1>This is demo of JQuery Terminal Emulator, type tilda to open terminal</h1>
+    <a href="#" id="helper">Helper link</a>
+    <button onclick="$('#helper').click()">Crash!</button>
 </body>
 </html>

Browser and OS

Tested on Chrome and IE11.

@paulsmirnov
Copy link
Author

This crash appeared in 1.7.1 or 1.7.2. Cannot reproduce in 1.7.0.

jcubic added a commit that referenced this issue Sep 20, 2017
@jcubic
Copy link
Owner

jcubic commented Sep 20, 2017

Added a fix in devel branch it will be in next version.

@jcubic
Copy link
Owner

jcubic commented Sep 20, 2017

You can test it here https://codepen.io/jcubic/pen/veGPqw

@paulsmirnov
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants