special event - compare elements
I have a problem with my special event "externalclick". On line 11 I try to comapare if element on which is bind event "externalclick" is same as one from the set of parent elements. If elements are the same it returns false anyway.
- $.event.special.externalclick = {
- setup: function(data, namespaces) {
- var $elem = $(this);
- $(document).bind('click', $elem, $.event.special.externalclick.handler);
- },
- teardown: function(namespaces) {
- $(document).unbind('click', $.event.special.externalclick.handler);
- },
- handler: function(e) {
- var $el = $(e.data); // target element, clicked element is in this
- $(e.target).parents().each(function() {
- if ($(this) == $el) {
- e.type = 'externalclick';
- $.event.handle.apply(this, arguments);
- }
- });
- }
- };