title: Element.getBoundingClientRect() on dom with applied CSS3 perspective Property return DOMRect object as before transformation
body: <p>I would like to know if it is possible to return coordinates for a div being transformed using CSS3 perspective property using <code>Element.getBoundingClientRect()</code> <a href="https://developer.mozilla.org/en/docs/Web/API/Element/getBoundingClientRect" rel="nofollow noreferrer">Ref</a>.</p>
  
  <p>I notice that <code>Element.getBoundingClientRect()</code> works fine for CSS 3 Transforms like <code>scale()</code> <code>skewX()</code>, but when <code>perspective</code> is applied, values returned (<a href="https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDOMClientRect" rel="nofollow noreferrer">DOMRect</a>) do not match the dom element size after the transformation.</p>
  
  <p>In my case I need to make sure that div with id <code>bb</code> has the width/height/top/left position on top of the bounding box for the element after the CSS transformation (as you see now the blue box match the element before transformation).</p>
  
  <p>Any idea is welcome.</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>var elm = document.querySelector('#div2');
  var elmBb = document.querySelector('#bb');
  var rect = elm.getBoundingClientRect();
  //console.log(rect);
  elmBb.style.top = rect.top + 'px';
  elmBb.style.left = rect.left + 'px';
  elmBb.style.width = rect.width + 'px';
  elmBb.style.height = rect.height + 'px';</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#div1 {
    position: fixed;
    height: 150px;
    width: 150px;
    margin: 50px;
    padding: 10px;
    border: 1px solid black;
    perspective: 150px;
  }
  
  #div2 {
    padding: 50px;
    position: absolute;
    border: 1px solid black;
    background-color: red;
    transform: rotateX(45deg);
  }
  
  #bb {
    position: fixed;
    border: 1px solid blue;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="div1"&gt;
    &lt;div id="div2"&gt;HELLO&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id="bb"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>