Fixing SVG click event issues on IE11

This commit is contained in:
Bruno Alves de Faria 2017-04-18 14:04:32 -03:00
parent ae6044e3a1
commit 9b41bc932f
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import { $ } from 'meteor/jquery';
/* jshint -W060 */
// Check if browser is IE and add the polyfill scripts
if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
@ -8,4 +10,9 @@ if (navigator && /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
writeScript('svgxuse.min.js');
writeScript('typedarray.js');
window.addEventListener('click', event => {
if (!window.SVGElementInstance || !(event.target instanceof SVGElementInstance)) return;
$(event.target.correspondingUseElement).trigger('click');
}, true);
}

View File

@ -9,6 +9,7 @@ Package.onUse(function(api) {
// Meteor packages
api.use('ecmascript');
api.use('jquery');
// Assets to be imported dynamically
api.addAssets('public/js/svgxuse.min.js', 'client');