Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The first argument to 'leave' event should be optional #13

Open
uzairfarooq opened this issue Sep 21, 2014 · 4 comments
Open

The first argument to 'leave' event should be optional #13

uzairfarooq opened this issue Sep 21, 2014 · 4 comments

Comments

@uzairfarooq
Copy link
Owner

So, to listen for removal of .test-elem, one can simply write:

$(".test-elem").leave(function() {
    var removedElem = this;
});

instead of:

$(".container-1").leave(".test-elem", function() {
    var removedElem = this;
});
@uzairfarooq uzairfarooq changed the title The first argument to leave event should be optional The first argument to 'leave' event should be optional Sep 21, 2014
@uzairfarooq uzairfarooq self-assigned this Oct 10, 2014
@uzairfarooq uzairfarooq added this to the Shipping Next milestone Oct 10, 2014
@uzairfarooq uzairfarooq removed their assignment Nov 2, 2014
@uzairfarooq
Copy link
Owner Author

A test case fails for the issue when some parent element of the target element gets removed from DOM. That's because we attach mutation event to parent element and when parent element directly gets removed the mutation event does not fire.

Any suggestion is welcome.

@uzairfarooq uzairfarooq removed this from the Shipping Next milestone Feb 22, 2015
@matt-curtis
Copy link

@uzairfarooq Is there a reason why the event handler is not attached to the document element? Performance reasons?

@uzairfarooq
Copy link
Owner Author

@matt-curtis wanted to avoid that for performance reasons but I guess it's okay to attach it to document element as I don't see any other solution.

@DATEx2
Copy link

DATEx2 commented Feb 14, 2025

2025, 11 years later and this is still not implemented :(

In fact I have implemented it in a way that if you pass the actual element as the first parameter, would simply work
Please integrate it

matchesSelector: function (e, n) {
    return e instanceof HTMLElement && (n instanceof HTMLElement ? n == e : t.call(e, n));
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants