Skip to content

Commit 0a57e5e

Browse files
committed
Fix NodeList to Array convertion
Related to issue #256
1 parent c4a4f87 commit 0a57e5e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import getPosition from './utils/getPosition'
1616
import getTipContent from './utils/getTipContent'
1717
import { parseAria } from './utils/aria'
1818

19+
import createArrayFromMixed from 'fbjs/lib/createArrayFromMixed'
20+
1921
/* CSS */
2022
import cssStyle from './style'
2123

@@ -153,11 +155,7 @@ class ReactTooltip extends Component {
153155
targetArray = document.querySelectorAll(`[data-tip][data-for="${id}"]`)
154156
}
155157

156-
// targetArray is a NodeList, convert it to a real array
157-
// I hope I can use Object.values...
158-
return Object.getOwnPropertyNames(targetArray).map(key => {
159-
return targetArray[key]
160-
})
158+
return createArrayFromMixed(targetArray)
161159
}
162160

163161
/**

0 commit comments

Comments
 (0)