Created
May 16, 2017 12:37
-
-
Save schabluk/8c5c36820a501a84122fecd7889735f3 to your computer and use it in GitHub Desktop.
Getting index of node in HTMLCollection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const children = [].slice.call(this.snippetsList.node.children) | |
console.log( | |
data.node, | |
children.indexOf(data.node) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could be slightly leaner to do:
const children = Array.prototype.slice.call(this.snippetsList.node.children);