diff --git a/public/js/common.js b/public/js/common.js index 6696c5ef..4e9d0be5 100644 --- a/public/js/common.js +++ b/public/js/common.js @@ -24,6 +24,7 @@ ForkBB.common = (function (doc, win) { backs[i].addEventListener("click", function (event) { win.history.back(); event.preventDefault(); + return false; }); } @@ -43,7 +44,7 @@ ForkBB.common = (function (doc, win) { } } - function initShowPAss() + function initShowPass() { var inps = doc.querySelectorAll("input[type='password']"); @@ -83,13 +84,14 @@ ForkBB.common = (function (doc, win) { return { init : function () { initGoBack(); - initAnchorHL(); - initShowPAss(); initForm(); + + if (typeof DOMTokenList !== 'undefined') { + initAnchorHL(); + initShowPass(); + } }, }; }(document, window)); -if (document.addEventListener) { - document.addEventListener("DOMContentLoaded", ForkBB.common.init, false); -} +document.addEventListener("DOMContentLoaded", ForkBB.common.init, false); diff --git a/public/js/media.js b/public/js/media.js index b001d0ed..4121e64d 100644 --- a/public/js/media.js +++ b/public/js/media.js @@ -459,7 +459,9 @@ ForkBB.media = (function (doc, win, nav) { return { init : function () { - crawl(); + if (!!Element.prototype.closest) { + crawl(); + } }, }; }(document, window, navigator)); diff --git a/public/js/poll.js b/public/js/poll.js index 9d18cd54..1c088c21 100644 --- a/public/js/poll.js +++ b/public/js/poll.js @@ -57,7 +57,10 @@ ForkBB.poll = (function (doc, win) { return { init : function () { - if (0 !== inputPE) { + if ( + 0 !== inputPE + || typeof DOMTokenList === 'undefined' + ) { return; } @@ -188,6 +191,4 @@ ForkBB.poll = (function (doc, win) { }; }(document, window)); -if (document.addEventListener) { - document.addEventListener("DOMContentLoaded", ForkBB.poll.init, false); -} +document.addEventListener("DOMContentLoaded", ForkBB.poll.init, false); diff --git a/public/js/scloader.js b/public/js/scloader.js index 0e32d5c4..62bfb0a1 100644 --- a/public/js/scloader.js +++ b/public/js/scloader.js @@ -40,7 +40,8 @@ ForkBB.editor = (function (doc, win) { var conf, smiliesEnabled, linkEnabled; if ( - !sceditor + !Object.assign + || !sceditor || !(textarea = doc.querySelector(selector)) || !(conf = JSON.parse(textarea.getAttribute(dataName))) ) { @@ -109,6 +110,4 @@ ForkBB.editor = (function (doc, win) { }; }(document, window)); -if (document.addEventListener && Object.assign) { - document.addEventListener("DOMContentLoaded", ForkBB.editor.init, false); -} +document.addEventListener("DOMContentLoaded", ForkBB.editor.init, false);