Skip to content

TypeError: evt.target.closest is not a function #234

Description

@UweOhse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions