delegate icon indicating copy to clipboard operation
delegate copied to clipboard

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

Open jameslnewell opened this issue 10 years ago • 4 comments

Fixes issue #14

jameslnewell avatar Jan 16 '15 02:01 jameslnewell

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

jameslnewell avatar Mar 12 '15 04:03 jameslnewell

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

TooTallNate avatar Mar 12 '15 05:03 TooTallNate

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)

jameslnewell avatar Jul 03 '15 00:07 jameslnewell

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)

Maximilianos avatar Oct 09 '15 15:10 Maximilianos