fx-compat: Fix New Item menu

This commit is contained in:
Dan Stillman 2022-05-11 06:10:14 -04:00
parent 2e26703b50
commit 909d68eac3

View file

@ -281,10 +281,9 @@ var ZoteroPane = new function()
var addMenu = document.getElementById('zotero-tb-add').firstElementChild; var addMenu = document.getElementById('zotero-tb-add').firstElementChild;
// Remove all nodes so we can regenerate // Remove all nodes so we can regenerate
var options = addMenu.querySelectorAll('.zotero-tb-add'); var options = [...addMenu.querySelectorAll('.zotero-tb-add')];
while (options.length) { while (options.length) {
var p = options[0].parentNode; options.shift().remove();
p.removeChild(options[0]);
} }
var moreMenu = document.getElementById('zotero-tb-add-more'); var moreMenu = document.getElementById('zotero-tb-add-more');
while (moreMenu.hasChildNodes()) { while (moreMenu.hasChildNodes()) {
@ -308,7 +307,7 @@ var ZoteroPane = new function()
return collation.compareString(1, a.localized, b.localized); return collation.compareString(1, a.localized, b.localized);
}); });
for (let itemType of itemTypes) { for (let itemType of itemTypes) {
let menuitem = document.createElement("menuitem"); let menuitem = document.createXULElement("menuitem");
menuitem.setAttribute("label", itemType.localized); menuitem.setAttribute("label", itemType.localized);
menuitem.setAttribute("tooltiptext", ""); menuitem.setAttribute("tooltiptext", "");
let type = itemType.id; let type = itemType.id;
@ -333,7 +332,7 @@ var ZoteroPane = new function()
return collation.compareString(1, a.localized, b.localized); return collation.compareString(1, a.localized, b.localized);
}); });
for (var i = 0; i<itemTypes.length; i++) { for (var i = 0; i<itemTypes.length; i++) {
var menuitem = document.createElement("menuitem"); var menuitem = document.createXULElement("menuitem");
menuitem.setAttribute("label", itemTypes[i].localized); menuitem.setAttribute("label", itemTypes[i].localized);
menuitem.setAttribute("tooltiptext", ""); menuitem.setAttribute("tooltiptext", "");
let type = itemTypes[i].id; let type = itemTypes[i].id;