Skip to content

Commit

Permalink
Update easydlg.js
Browse files Browse the repository at this point in the history
Added code to clean up className string to avoid error, just in case, starting line: 1220
Resolves issue if className string contains double whitespaces or more, and removes trailing and leading whitespace should there be any.
  • Loading branch information
keejelo authored Aug 30, 2020
1 parent c92eb34 commit 11dcb36
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions js/easydlg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------------------------------------------------
// ** EasyDialogBox
// ** Version: 1.722
// ** Version: 1.723
// ** Year: 2020
// ** GitHub: https://github.com/keejelo/EasyDialogBox
//
Expand Down Expand Up @@ -1217,9 +1217,16 @@ var EasyDialogBox = (function()
// ** Get element from DOM
var dlg = document.getElementById(btns[i].getAttribute('rel'));

// ** Clean up className string to avoid error, just in case
// ** Replace double whitespace if found
var classType = dlg.getAttribute('class').replace(/\s\s+/g, ' ');
// ** Remove leading and trailing whitspace
classType = classType.replace(/^\s+|\s+$/g, '');

// ** Create object from DOM element
var obj = _create(dlg.getAttribute('id'), // id
dlg.getAttribute('class'), // type
//dlg.getAttribute('class'), // type
classType, // type
dlg.getAttribute('title'), // title
dlg.innerHTML, // message
dlg.getAttribute('data-callback'), // callback function
Expand Down

0 comments on commit 11dcb36

Please sign in to comment.