From 0a57e5e9a93d0d38ad626facf61da6e2a84b72c7 Mon Sep 17 00:00:00 2001 From: huumanoid Date: Thu, 16 Feb 2017 20:36:00 +0300 Subject: [PATCH] Fix NodeList to Array convertion Related to issue #256 --- src/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 9e2a41b30..9fca78f7f 100644 --- a/src/index.js +++ b/src/index.js @@ -16,6 +16,8 @@ import getPosition from './utils/getPosition' import getTipContent from './utils/getTipContent' import { parseAria } from './utils/aria' +import createArrayFromMixed from 'fbjs/lib/createArrayFromMixed' + /* CSS */ import cssStyle from './style' @@ -153,11 +155,7 @@ class ReactTooltip extends Component { targetArray = document.querySelectorAll(`[data-tip][data-for="${id}"]`) } - // targetArray is a NodeList, convert it to a real array - // I hope I can use Object.values... - return Object.getOwnPropertyNames(targetArray).map(key => { - return targetArray[key] - }) + return createArrayFromMixed(targetArray) } /**