Skip to content

Commit 1897300

Browse files
tianyong90eddyerburgh
authored andcommitted
fix: wrapper.attributes() method (#265)
1 parent b5d4ce2 commit 1897300

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/wrappers/wrapper.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ export default class Wrapper implements BaseWrapper {
3737
* Returns an Object containing all the attribute/value pairs on the element.
3838
*/
3939
attributes (): { [name: string]: string } {
40-
const attributes = [...this.element.attributes] // NameNodeMap is not iterable
40+
const attributes = this.element.attributes
4141
const attributeMap = {}
42-
attributes.forEach((att) => {
42+
for (let i = 0; i < attributes.length; i++) {
43+
const att = attributes.item(i)
4344
attributeMap[att.localName] = att.value
44-
})
45+
}
4546
return attributeMap
4647
}
4748

0 commit comments

Comments
 (0)