1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-17 03:31:52 +00:00

Fixed the "Uncaught TypeError: Cannot read property 'className' of null" bug that appears when creating folders (coding style adjustments)

This commit is contained in:
Alan Richey
2017-10-13 09:30:41 -05:00
parent 7c9596308e
commit 590aa9ab17

View File

@@ -27,10 +27,10 @@ document.addEventListener('click', function (e) {
const className = e.target.className const className = e.target.className
if (!className && typeof (className) !== 'string') return if (!className && typeof (className) !== 'string') return
const isInfoButton = className.includes('infoButton') const isInfoButton = className.includes('infoButton')
let isInfoPanel = false const offsetParent = e.target.offsetParent
if (e.target.offsetParent !== null) { const isInfoPanel = offsetParent !== null
isInfoPanel = e.target.offsetParent.className.includes('infoPanel') ? offsetParent.className.includes('infoPanel')
} : false
if (isInfoButton || isInfoPanel) return if (isInfoButton || isInfoPanel) return
const infoPanel = document.querySelector('.infoPanel') const infoPanel = document.querySelector('.infoPanel')
if (infoPanel) infoPanel.style.display = 'none' if (infoPanel) infoPanel.style.display = 'none'