1
0
mirror of https://github.com/webslides/WebSlides.git synced 2025-08-22 21:03:23 +02:00

Avoiding to use Array.from

This commit is contained in:
Antonio Laguna
2017-02-23 16:16:14 +01:00
parent 36c1f1997b
commit bb5ae82995
2 changed files with 10 additions and 1 deletions

View File

@@ -141,7 +141,7 @@ export default class WebSlides {
* @private
*/
grabSlides_() {
this.slides = Array.from(this.el.childNodes)
this.slides = DOM.toArray(this.el.childNodes)
.map((slide, i) => new Slide(slide, i));
this.maxSlide_ = this.slides.length;

View File

@@ -72,4 +72,13 @@ export default class DOM {
target.dispatchEvent(event);
}
/**
* Converts an iterable to an array.
* @param {*} iterable Element to convert to array
* @return {Array} the element casted to an array.
*/
static toArray(iterable) {
return [].slice.call(iterable);
}
}