Skip to content

Commit

Permalink
Check if event is null before stopPropagation()
Browse files Browse the repository at this point in the history
Brought up in Issue #17:

Calling colpickShow() throws an error when calling stop propagation since the event it is using is null. I just added an if to check if ev is null; if it isn't, call stopPropagation(), else skip it.
  • Loading branch information
ansballard committed May 28, 2014
1 parent 7cba888 commit 4def436
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/colpick.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ For usage and examples: colpick.com/plugin
},
//Show/hide the color picker
show = function (ev) {
// Prevent the trigger of any direct parent
ev.stopPropagation();
if(ev) {
// Prevent the trigger of any direct parent
ev.stopPropagation();
}
var cal = $('#' + $(this).data('colpickId'));
cal.data('colpick').onBeforeShow.apply(this, [cal.get(0)]);
var pos = $(this).offset();
Expand Down

0 comments on commit 4def436

Please sign in to comment.