title: mutation observer for HTML collection
body: <p>I am trying to add mutation observation for new element in a page. But my code below does not show &quot;change observed&quot; when new element is loaded in the page.</p>
  <pre><code>setTimeout(() =&gt; {
      const observer = new MutationObserver(mutations =&gt; {
          console.log(&quot;change obervered!!!&quot;)
          console.log(mutations)
          var seconds = new Date().getTime() / 1000
          console.log(seconds)
          dict[&quot;Paul Yang&quot;] = seconds
  
      })
      targets = document.getElementsByClassName(&quot;XEazBc adnwBd&quot;)
      length = document.getElementsByClassName('XEazBc adnwBd').length
  
  
      console.log(targets)
  
      console.log(&quot;length is: &quot;, length)
      for (let i = 0; i &lt; length; i++) {
          console.log(&quot;add one observer&quot;)
          observer.observe(targets.item(i), {
              childList: true,
              attributes: true,
              characterData: true,
              subtree: true,
          })
      }
  }, 2000);
  </code></pre>