summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-08-31 13:48:21 +0200
committerDylan William Hardison <dylan@hardison.net>2017-08-31 13:55:05 +0200
commita781aaf9e0ab46c08e8cb74c259106ef5acd7251 (patch)
tree77794a72980691e3af3b08c4f128ca191bd8095b /extensions
parenta164a52baf8b6b676627780114543d76329cbced (diff)
downloadbugzilla-a781aaf9e0ab46c08e8cb74c259106ef5acd7251.tar.gz
bugzilla-a781aaf9e0ab46c08e8cb74c259106ef5acd7251.tar.xz
Bug 1395143 - Remove onclick/onchange handlers in favor of event listener
Diffstat (limited to 'extensions')
-rw-r--r--extensions/Splinter/web/splinter.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/extensions/Splinter/web/splinter.js b/extensions/Splinter/web/splinter.js
index d249ef17a..277a7ff86 100644
--- a/extensions/Splinter/web/splinter.js
+++ b/extensions/Splinter/web/splinter.js
@@ -2016,14 +2016,15 @@ Splinter.addPatchFile = function (file) {
Dom.addClass(fileLabel, 'file-label');
fileLabel.appendTo(fileDiv);
- var fileCollapseLink = new Element(document.createElement('a'));
- Dom.addClass(fileCollapseLink, 'file-label-collapse');
- fileCollapseLink.appendChild(document.createTextNode('[-]'));
- Dom.setAttribute(fileCollapseLink, 'href', 'javascript:void(0);')
- Dom.setAttribute(fileCollapseLink, 'onclick', "Splinter.toggleCollapsed('" +
- encodeURIComponent(file.filename) + "');");
- Dom.setAttribute(fileCollapseLink, 'title', 'Click to expand or collapse this file table');
- fileCollapseLink.appendTo(fileLabel);
+ var fileCollapseLink = document.createElement('a');
+ fileCollapseLink.classList.add('file-label-collapse');
+ fileCollapseLink.appendChild(document.createTextNode("[-]"));
+ fileCollapseLink.setAttribute('href', "javascript:void(0);");
+ fileCollapseLink.addEventListener("click", function() {
+ Splinter.toggleCollapsed(encodeURIComponent(file.filename));
+ });
+ fileCollapseLink.setAttribute("title", 'Click to expand or collapse this file table');
+ new Element(fileCollapseLink).appendTo(fileLabel);
var fileLabelName = new Element(document.createElement('span'));
Dom.addClass(fileLabelName, 'file-label-name');
@@ -2043,15 +2044,17 @@ Splinter.addPatchFile = function (file) {
'on the published review.');
fileReviewed.appendTo(fileLabel);
- var fileReviewedInput = new Element(document.createElement('input'));
- Dom.setAttribute(fileReviewedInput, 'type', 'checkbox');
- Dom.setAttribute(fileReviewedInput, 'id', 'file-review-checkbox-' + encodeURIComponent(file.filename));
- Dom.setAttribute(fileReviewedInput, 'onchange', "Splinter.toggleFileReviewed('" +
- encodeURIComponent(file.filename) + "');");
+ var fileReviewedInput = document.createElement('input');
+ fileReviewedInput.setAttribute("type", "checkbox");
+ fileReviewedInput.setAttribute("id", 'file-review-checkbox-' + encodeURIComponent(file.filename));
+ fileReviewedInput.addEventListener("change", function() {
+ Splinter.toggleFileReviewed(encodeURIComponent(file.filename));
+ });
+
if (file.fileReviewed) {
- Dom.setAttribute(fileReviewedInput, 'checked', 'true');
+ fileReviewedInput.setAttribute("checked", 'true');
}
- fileReviewedInput.appendTo(fileReviewed);
+ new Element(fileReviewedInput).appendTo(fileReviewed);
var fileReviewedLabel = new Element(document.createElement('label'));
Dom.addClass(fileReviewedLabel, 'file-review-label')