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

Bugfix: Check the delegateTarget's disabled property and prevent the event from firing in all versions of IE #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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