this line can just be:

    let mainNodes = this.browserWindow.document.querySelectorAll("#" + (isTabMenu ? "tabContextMenu" : "contentAreaContextMenu") +  " > ." + ITEM_CLASS);