Skip to content

Commit

Permalink
addEventListener fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gotwarlost committed Feb 7, 2015
1 parent 583c8b0 commit 93d5b6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/assets/sorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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));
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/report/templates/foot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
{{#if prettify}}
<script src="{{prettify.js}}"></script>
<script>
window.addEventListener('load', function () {
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
});
};
</script>
{{/if}}
<script src="{{sorter.js}}"></script>
Expand Down

0 comments on commit 93d5b6d

Please sign in to comment.