Skip to content

Commit

Permalink
Fix NodeList to Array convertion
Browse files Browse the repository at this point in the history
Related to issue ReactTooltip#256
  • Loading branch information
huumanoid committed Feb 16, 2017
1 parent c4a4f87 commit 0a57e5e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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)
}

/**
Expand Down

0 comments on commit 0a57e5e

Please sign in to comment.