Replace setAttribute("oncommand", ...) with addEventListener()

For AMO validator
This commit is contained in:
Dan Stillman 2012-02-06 02:38:53 -05:00
parent c987130323
commit 84fe2728da
3 changed files with 7 additions and 4 deletions

View File

@ -103,8 +103,9 @@ const ZoteroStandalone = new function() {
for (var i = 0; i<itemTypes.length; i++) {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", itemTypes[i].localized);
menuitem.setAttribute("oncommand","ZoteroPane_Local.newItem("+itemTypes[i]['id']+")");
menuitem.setAttribute("tooltiptext", "");
let type = itemTypes[i].id;
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type); }, false);
menuitem.className = "zotero-tb-add";
addMenu.appendChild(menuitem);
}

View File

@ -274,8 +274,9 @@ var ZoteroPane = new function()
for (var i = 0; i<itemTypes.length; i++) {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", itemTypes[i].localized);
menuitem.setAttribute("oncommand","ZoteroPane_Local.newItem("+itemTypes[i]['id']+")");
menuitem.setAttribute("tooltiptext", "");
let type = itemTypes[i].id;
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type); }, false);
moreMenu.appendChild(menuitem);
}
}
@ -311,8 +312,9 @@ var ZoteroPane = new function()
for (var i = 0; i<itemTypes.length; i++) {
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", itemTypes[i].localized);
menuitem.setAttribute("oncommand","ZoteroPane_Local.newItem("+itemTypes[i]['id']+")");
menuitem.setAttribute("tooltiptext", "");
let type = itemTypes[i].id;
menuitem.addEventListener("command", function() { ZoteroPane_Local.newItem(type); }, false);
menuitem.className = "zotero-tb-add";
addMenu.insertBefore(menuitem, separator);
}

View File

@ -38,7 +38,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="include.js"/>
<script src="zoteroPane.js"/>
<script src="zoteroPane.js" type="application/javascript;version=1.8"/>
<script src="fileInterface.js"/>
<script src="reportInterface.js"/>
<script src="timelineInterface.js"/>