voterunner

quick and dirty votes and discussions
git clone https://git.ce9e.org/voterunner.git

commit
0a24d4f3eca239921e61be993dcf9a9189521dcf
parent
e8b8d970bdb89fd519e363aa1c81720ea4466c52
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2016-09-11 11:55
fix non-standard use of forEach() on DOMNodeList

Diffstat

M static/src/voterunner.js 10 ++++++++--

1 files changed, 8 insertions, 2 deletions


diff --git a/static/src/voterunner.js b/static/src/voterunner.js

@@ -9,6 +9,12 @@ var _ = function(s) {
    9     9 	return s;
   10    10 };
   11    11 
   -1    12 var forEach = function(list, fn) {
   -1    13 	for (var i = 0; i < list.length; i++) {
   -1    14 		fn(list[i], i);
   -1    15 	}
   -1    16 };
   -1    17 
   12    18 var throttle = function(fn, timeout) {
   13    19 	var called, blocked;
   14    20 
@@ -228,11 +234,11 @@ document.addEventListener('DOMContentLoaded', function() {
  228   234 	var update = initVDom(document.querySelector('#tree'), nodes, ID, function() {
  229   235 		updateUser();
  230   236 
  231    -1 		document.querySelectorAll('.expand').forEach(function(element) {
   -1   237 		forEach(document.querySelectorAll('.expand'), function(element) {
  232   238 			element.addEventListener('click', toggleExpand);
  233   239 		});
  234   240 
  235    -1 		document.querySelectorAll('.delegate').forEach(function(element) {
   -1   241 		forEach(document.querySelectorAll('.delegate'), function(element) {
  236   242 			element.addEventListener('click', setDelegate);
  237   243 		});
  238   244 	});