Skip to content

Conversation

jameslnewell
Copy link

Fixes issue #14

@jameslnewell
Copy link
Author

Hi @TooTallNate. Would you be able to merge this?

@jameslnewell jameslnewell changed the title Bugfix: Check the delegateTarget's disabled property and prevent the event from firing in all IE Bugfix: Check the delegateTarget's disabled property and prevent the event from firing in all versions of IE Mar 12, 2015
@TooTallNate
Copy link
Member

Hey @jameslnewell. Thanks for the PR. What makes this patch appropriate for delegate, as opposed to the more low-level event component?

@jameslnewell
Copy link
Author

Hmm yeah you could patch the event component to make the events.bind(button, 'click', fn) behavior compatible in IE.

However, I guess what I really want is to ignore delegated events that are bubbling through disabled inputs/buttons (on all browsers) similar to what jQuery have done.

Example

HTML:

<div>
  <button disabled>
    Click me! <i class="icon"></i>
  </button>
</div>

JS:

delegate.bind(el, 'button', 'click', function(e){
  console.log('clicked');
});
  • Clicking the button will not emit a click event as desired (except in IE - which patching the event component would fix).
  • Clicking the i will emit a click event and incorrectly trigger the button handler (in all browsers - which is only an issue and can only be fixed in the delegate component)

@Maximilianos
Copy link

makes sense, @jameslnewell, this should be merged in my opinion

Clicking the i will emit a click event and incorrectly trigger the button handler (in all browsers - which is only an issue and can only be fixed in the delegate component)

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

Successfully merging this pull request may close these issues.

3 participants