Skip to content

Commit

Permalink
fix: wrapper.attributes() method (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyong90 authored and eddyerburgh committed Dec 15, 2017
1 parent b5d4ce2 commit 1897300
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/wrappers/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ export default class Wrapper implements BaseWrapper {
* Returns an Object containing all the attribute/value pairs on the element.
*/
attributes (): { [name: string]: string } {
const attributes = [...this.element.attributes] // NameNodeMap is not iterable
const attributes = this.element.attributes
const attributeMap = {}
attributes.forEach((att) => {
for (let i = 0; i < attributes.length; i++) {
const att = attributes.item(i)
attributeMap[att.localName] = att.value
})
}
return attributeMap
}

Expand Down

0 comments on commit 1897300

Please sign in to comment.