IfnotFr / PopConfirm

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover
MIT License
99 stars 35 forks source link

onclick event undefined #37

Closed boussou closed 6 years ago

boussou commented 7 years ago

When you confirm using popconfirm, there is two events generated that call the onclick function. during the second call I had a null event. this is the exact error


jquery.popconfirm.js:135 Uncaught TypeError: Cannot read property 'preventDefault' of undefined
    at init.<anonymous> (jquery.popconfirm.js:135)
    at HTMLButtonElement.<anonymous> (jquery.popconfirm.js:143)
    at HTMLButtonElement.e (jquery.min.js:3)
    at HTMLButtonElement.dispatch (jquery.min.js:3)
    at HTMLButtonElement.i (jquery.min.js:3)

``
I had to add line 136/137 the "if(e)" : 

            if(e)e.preventDefault();
            if(e)e.stopPropagation();

besides, it seems that the the lib make no use of the object e.
appeared on chromium Version 57.0.2987.133 (64-bit) and IE last version.
IfnotFr commented 7 years ago

Thanks for the bug report.

What to you mean by "there is two events generated that call the onclick function" ?

boussou commented 7 years ago

Don't remember, I think I meant that the callback is called 2 times. I can do further analysis if you ask (by doing a rollback)

IfnotFr commented 7 years ago

Thats weird, i never had this behaviour before.

An analysis will be much appreciated :)

IfnotFr commented 6 years ago

The undefined event is fixed with 344cf45