From 93d5b6d0b48e71e076dce9c18610b34220595ae7 Mon Sep 17 00:00:00 2001 From: gotwarlost Date: Fri, 6 Feb 2015 22:55:34 -0800 Subject: [PATCH] addEventListener fixes --- lib/assets/sorter.js | 8 +++++++- lib/report/templates/foot.txt | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/assets/sorter.js b/lib/assets/sorter.js index dd241fdf..6afb736c 100644 --- a/lib/assets/sorter.js +++ b/lib/assets/sorter.js @@ -113,6 +113,7 @@ var addSorting = (function () { // adds event listeners for all sorter widgets function enableUI() { var i, + el, ithSorter = function ithSorter(i) { var col = cols[i]; @@ -131,7 +132,12 @@ var addSorting = (function () { }; for (i =0 ; i < cols.length; i += 1) { if (cols[i].sortable) { - getNthColumn(i).querySelector('.sorter').addEventListener('click', ithSorter(i)); + el = getNthColumn(i).querySelector('.sorter'); + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } } } } diff --git a/lib/report/templates/foot.txt b/lib/report/templates/foot.txt index c6c0f085..5fdaa5ab 100644 --- a/lib/report/templates/foot.txt +++ b/lib/report/templates/foot.txt @@ -6,11 +6,11 @@ {{#if prettify}} {{/if}}