bliss
bliss copied to clipboard
TypeError: evt.target.closest is not a function
Bliss.delegate(document.body, "dragstart", "[draggable=true]", function(e) { /* nothing */ });
leads to the exception in the title if one drags a text, because a dragstart event runs, and is handled here:
delegate: overload(function (type, selector, callback) {
$.bind(this, type, function(evt) {
if (evt.target.closest(selector)) {
callback.call(this, evt);
}
});
}, 0, 2),
evt.target unfortunately is a text in this case, and has no closest() method.
A fix is simple:
if (evt.target.closest && evt.target.closest(selector)) {
(tested, works)
btw: bliss is great. thank you very much.
Thanks for reporting! I've added it to my radar.
Actually, a better fix would be to use evt.parentNode.closest() in this case which is essentially what you need.