commit 84fe2728dae56d92d3f62b7896fb07cdbf63538e
parent c98713032380e01d8e6a4e3434173555f374e849
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 6 Feb 2012 02:38:53 -0500
Replace setAttribute("oncommand", ...) with addEventListener()
For AMO validator
Diffstat:
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js
@@ -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);
}
diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js
@@ -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);
}
diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul
@@ -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"/>