timdream / wordcloud2.js

Tag cloud/Wordle presentation on 2D canvas or HTML
https://wordcloud2-js.timdream.org/
MIT License
2.34k stars 510 forks source link

Keep getting many null is not an object errors #202

Open TheDude70 opened 1 year ago

TheDude70 commented 1 year ago

The below part of the code keeps getting hit regularly and errors out due to el being null or undefined. How to solve this issue?

`/js/wordcloud2.js at line 189:21

  if (typeof el === 'string') {
    elements[i] = document.getElementById(el)
    if (!elements[i]) {
      throw new Error('The element id specified is not found.')
    }
  } else if (!el.tagName && !el.appendChild) {

    throw new Error('You must pass valid HTML elements, or ID of the element.')
  }
})`