karlhorky/gray

onclick issue in IE10

StanislausLem opened this issue · 4 comments

Hi
It seems that latest build of jquery.gray.js is blocking "onclick" in IE11.

<link rel="stylesheet" href="css/gray.min.css"> 
<img id="badge1" src="badge1.png" class="grayscale" onclick="console.log('ping')">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
<script src="js/jquery.gray.min.js"></script> 

No problem on Chrome or FF

Can you please provide a demo where this fails in IE 11? This is because the target element is replaced with an <svg> element, and the event listeners are not re-registered on the new elements.

I've documented this in 99f6736

Four lines of minimal demo already provided on my first post. ;p
Onclick won't be fired at all.

I mean a live demo which can be tested and debugged.

I've added one here for you:
https://jsfiddle.net/karlhorky/08ugd4vz/

Currently I'm going to mark this as wontfix because we would need to register all other event listeners as well.

I guess the correct way to do this would be for the plugin to fire events when the element is replaced so that user JavaScript could re-register event listeners. I don't have time to do this feature right now myself, but I would accept a pull request for this.