From 887c96b7a6952439eca37aa317af7e74ebdbed3b Mon Sep 17 00:00:00 2001 From: Deuteu Date: Sun, 2 Oct 2016 17:08:04 +0200 Subject: [PATCH 1/2] Deal with no argument passed. --- jquery.confirm.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.confirm.js b/jquery.confirm.js index 9272b56..8ad432d 100644 --- a/jquery.confirm.js +++ b/jquery.confirm.js @@ -42,7 +42,7 @@ */ $.confirm = function (options, e) { // Do nothing when active confirm modal. - if ($('.confirmation-modal').length > 0) + if ( typeof options == "undefined" || $('.confirmation-modal').length > 0) return; // Parse options defined with "data-" attributes From acfc74b53f298ae8853a542e1aa899b213c3852f Mon Sep 17 00:00:00 2001 From: Deuteu Date: Mon, 3 Oct 2016 23:02:06 +0200 Subject: [PATCH 2/2] Add error log before exit when no options. --- jquery.confirm.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jquery.confirm.js b/jquery.confirm.js index 67ae908..68cfe29 100644 --- a/jquery.confirm.js +++ b/jquery.confirm.js @@ -41,8 +41,14 @@ * @param [e] {Event} */ $.confirm = function (options, e) { + // Log error and exit when no options. + if (typeof options == "undefined") { + console.error("No options given."); + return; + } + // Do nothing when active confirm modal. - if ( typeof options == "undefined" || $('.confirmation-modal').length > 0) + if ($('.confirmation-modal').length > 0) return; // Parse options defined with "data-" attributes