title: document.getElementById('someId') results in "Object does not support the property or method 'getElementById'"
body: <p>I have a weird JavaScript exception in Internet Explorer 9:</p>
  
  <p><img src="https://i.stack.imgur.com/R9tj0.png" alt="Screenshot"></p>
  
  <p>Translated to English, the message reads:</p>
  
  <blockquote>
    <p>Object does not support the property or method 'getElementById'</p>
  </blockquote>
  
  <p>However, when I execute <code>document.getElementById</code> through the JavaScript console, the function is found. In fact, if I execute the entire statement that caused the exception there, it succeeds! (c.f. the screenshot).</p>
  
  <p>What could be the cause of this weirdness? <code>document</code> should have a <code>getElementById</code> method at all times, should it not? And why would the same statement succeed if I retry it in the debugger?</p>
  
  <p>I can reproduce the problem with Internet Explorer 9, but not IE 11 or Firefox. </p>