From 96a12d12a93a25d1b57c339ebc3b3f7dbc2982ae Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 13 Jul 2022 19:28:59 +0530 Subject: [PATCH] guard against possible type error, lint compliance --- customize.dist/pre-loading.js | 6 ++++-- www/common/sframe-common-outer.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/customize.dist/pre-loading.js b/customize.dist/pre-loading.js index 2b276ff20..551362975 100644 --- a/customize.dist/pre-loading.js +++ b/customize.dist/pre-loading.js @@ -1,5 +1,6 @@ +(function () { var logoPath = '/customize/CryptPad_logo.svg'; -if (location.pathname == '/' || location.pathname == '/index.html') { +if (location.pathname === '/' || location.pathname === '/index.html') { logoPath = '/customize/CryptPad_logo_hero.svg'; } @@ -14,6 +15,7 @@ elem.innerHTML = [ '' ].join(''); -document.addEventListener('DOMContentLoaded', function(e) { +document.addEventListener('DOMContentLoaded', function() { document.body.appendChild(elem); }); +}()); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 931146b37..18fdc92f8 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -1955,7 +1955,10 @@ define([ rtStarted = true; // Remove the outer placeholder once iframe overwrites it for sure - document.querySelector('#placeholder').remove(); + var placeholder = document.querySelector('#placeholder'); + if (placeholder && typeof(placeholder.remove) === 'function') { + placeholder.remove(); + } var replaceHash = function (hash) { // The pad has just been created but is not stored yet. We'll switch