title: Expanding Text Area throws error on Chrome/Firefox but not Safari
body: <p>I have a text area that dynamically expands to fit the content inputed. It works correctly on all browsers, as far as I can tell, but on FireFox and Chrome it gives this error in the console:</p>
  <p><code>Uncaught TypeError: Cannot set properties of undefined (setting 'height') at oninput</code></p>
  <p>Here's the code with an example:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let ta = document.getElementsByTagName("textarea");
  
      for (let i = 0; i &lt; ta.length; i++) {
          ta[i].setAttribute("style", "min-height:" + (ta[i].scrollHeight) + "px;overflow-y:hidden;");
          ta[i].addEventListener("input", oninput, false);
      
  
      function oninput() {
          this.style.height = "auto";
          let maxheight = 200;
          if (this.scrollHeight &lt; maxheight){
              this.style.height = (this.scrollHeight) + "px";
          }else{
              this.style.height = maxheight + "px";
          
      }
  }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;textarea&gt;type here...&lt;/textarea&gt;
  
  &lt;br&gt;&lt;br&gt;
  
  &lt;input type="text" placeholder="This should not be affected"&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I would like this code to run smoothly on all platforms. Additionally I want to make sure I am only targeting <code>textarea</code> and not <code>input</code>, as the error presents if I change a normal input as well.</p>