Commit a9d1e5c2 authored by JC Brand's avatar JC Brand

Don't use `forEach` on nodeList objects (not supported by all browsers).

parent 8113a14a
......@@ -137,7 +137,7 @@
initialize () {
this.model.on('change:current_skintone', this.render, this);
this.model.on('change:current_category', this.render, this);
this.setScrollPosition = _.debounce(this.setScrollPosition, 50);
this.setScrollPosition = _.debounce(this.setScrollPosition, 50).bind(this);
},
render () {
......@@ -152,10 +152,8 @@
}
));
this.el.innerHTML = emojis_html;
this.el.querySelectorAll('.emoji-picker').forEach((el) => {
el.addEventListener(
'scroll', this.setScrollPosition.bind(this)
);
_.forEach(this.el.querySelectorAll('.emoji-picker'), (el) => {
el.addEventListener('scroll', this.setScrollPosition);
});
this.restoreScrollPosition();
return this;
......@@ -188,7 +186,7 @@
}
},
setScrollPosition (ev, position) {
setScrollPosition (ev) {
this.model.save('scroll_position', ev.target.scrollTop);
},
......
......@@ -413,8 +413,7 @@
};
this.giveFeedback = function (subject, klass, message) {
const els = document.querySelectorAll('.conn-feedback');
_.forEach(els, function (el) {
_.forEach(document.querySelectorAll('.conn-feedback'), (el) => {
el.classList.add('conn-feedback');
el.textContent = subject;
if (klass) {
......
......@@ -26,7 +26,7 @@
}
});
document.querySelectorAll('.page-scroll a').forEach(function (el) {
Array.prototype.forEach.call(document.querySelectorAll('.page-scroll a'), function (el) {
el.addEventListener('click', function (ev) {
ev.preventDefault();
var hash = this.getAttribute("href")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment