title: IE8 Cannot add properties to JavaScript object returned by window
body: <p>I just came across this odd issue in IE8 and I cannot seem to find any more details about it. Naturally, if I create a JavaScript object, however I do it, I can simply add properties by dynamically defining them:</p>
  
  <pre><code>var rect = {};
  rect.x = 200;
  </code></pre>
  
  <p>Great. Well in IE8 (and I'm not sure what other IE's), if I call a method like this:</p>
  
  <pre><code>var span = document.getElementById('my-span');
  var rect = span.getBoundingClientRect();
  rect.x = Math.round( rect.left );
  </code></pre>
  
  <p>then I get the IE error "Object does not support this property or method." This of course does not happen in the first case I mentioned where I personally defined my own object in javascript. Now the easiest workaround will be to do this:</p>
  
  <pre><code>var clientRect = span.getBoundingClientRect();
  var rect = { top: clientRect.top, left: clientRect.left, right: clientRect.right, bottom: clientRect.bottom };
  rect.x = Math.round( rect.left );
  </code></pre>
  
  <p>That's no problem. But what I am wondering is why won't IE8 let me dynamically add fields/properties/attributes (I am not sure of the correct JS terminology) to this object returned by the <code>getBoundingClientRect()</code> method? Is there another (correct) way to add properties? Does this happen for all objects returned by methods from the <code>window</code> object? Is this documented? Or is it a bug? (In which case I'll take the workaround and move on).</p>