Fix classList iteration
DOMTokenList is not Iterable in Edge, and does not have a `forEach` method, so iterate through the class names with a for loop.
This commit is contained in:
Родитель
d68a4c59e4
Коммит
10630019ab
5
index.js
5
index.js
|
@ -188,9 +188,10 @@
|
|||
var componenets = [element.nodeName.toLowerCase()]
|
||||
if (element.id) componenets.push('#' + element.id)
|
||||
if (element.classList) {
|
||||
element.classList.forEach(function(name) {
|
||||
for (var i = 0; i < element.classList.length; i++) {
|
||||
var name = element.classList[i]
|
||||
if (name.match(/^js-/)) componenets.push('.' + name)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return componenets.join('')
|
||||
|
|
Загрузка…
Ссылка в новой задаче