Merge pull request #4050 from niklasf/dispatch-event-ie11
fix dispatchEvent on ie 11
This commit is contained in:
commit
ea2429026d
|
@ -150,7 +150,7 @@ lichess.startEmbeddedAnalyse = function(opts) {
|
|||
ground.style.width = groundSize + 'px';
|
||||
ground.style.maxWidth = groundSize + 'px';
|
||||
ground.style.height = boardSize + 'px';
|
||||
document.body.dispatchEvent(new Event('chessground.resize'));
|
||||
lichess.dispatchEvent(document.body, 'chessground.resize');
|
||||
};
|
||||
onResize();
|
||||
window.addEventListener('resize', onResize);
|
||||
|
|
|
@ -403,9 +403,9 @@ lichess.topMenuIntent = function() {
|
|||
}
|
||||
|
||||
// reflow charts
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
lichess.dispatchEvent(window, 'resize');
|
||||
|
||||
document.body.dispatchEvent(new Event('chessground.resize'));
|
||||
lichess.dispatchEvent(document.body, 'chessground.resize');
|
||||
};
|
||||
lichess.pubsub.on('reset_zoom', function() {
|
||||
if (currentZoom > 1 || $('body').data('zoom') > 100) setZoom(currentZoom);
|
||||
|
|
|
@ -4,6 +4,12 @@ lichess.engineName = 'Stockfish 9+';
|
|||
|
||||
lichess.raf = (window.requestAnimationFrame || window.setTimeout).bind(window);
|
||||
lichess.requestIdleCallback = (window.requestIdleCallback || window.setTimeout).bind(window);
|
||||
lichess.dispatchEvent = function(el, eventName) {
|
||||
// compability for ie 11 instead of el.dispatchEvent(new Event(eventName)))
|
||||
var ev = document.createEvent('Event');
|
||||
ev.initEvent(eventName, false, false);
|
||||
el.dispatchEvent(ev);
|
||||
};
|
||||
lichess.storage = (function() {
|
||||
try {
|
||||
// just accessing localStorage can throw an exception...
|
||||
|
|
Loading…
Reference in a new issue