Support wrapped instances of String
Hello.
Passing primitive strings of html to alertify works fine, but I have a use case where I'd like to send wrapped String objects around (since you can set custom attributes on them).
My code works fine, but your library calls typeof to determine whether or not to pass said string on to element.innerHTML even though innerHTML supports wrapped String objects just fine. This means my code unexpectedly renders blank alertifies.
I would like to avoid calling .toString() before passing my strings into your library (this is the current workaround).
jsfiddle demonstrating the problem
I've identified the code that I believe needs updating:
https://github.com/MohammadYounes/AlertifyJS/blob/957e34865e161449d7cc019c2d85cedfe467ad18/src/js/dialog/dialog.js#L194
and
https://github.com/MohammadYounes/AlertifyJS/blob/957e34865e161449d7cc019c2d85cedfe467ad18/src/js/dialog/dialog.js#L210
(maybe more code should be updated?)
a function like this is all that is needed:
// checks for both string and String instances
function isString(thing) {
return Object.prototype.toString.call(thing) === '[object String]';
}
I'm willing to send a PR.
Thanks for the details. I'll fix soon and you are welcome to submit a PR.