function checkTransformLeak() {
    // No transforms -> definitely leaks.
    if (!isTransformSupported) return true;

    // No body available -> can't check it.
    if (!document.body) return null;

    // Do the test.
    var elems = [0, 1].map(function(elem, isInner) {
      elem = document.createElement('div');
      elem.style.position = isInner ? 'fixed' : 'absolute';
      elem.style.display = 'block';
      elem.style.visibility = 'hidden';
      elem.style.left = isInner ? '0px' : '1px';
      elem.style[transformProp] = 'none';
      return elem;
    });
    var outer = document.body.appendChild(elems[0]);
    var inner = outer.appendChild(elems[1]);
    var left = inner.getBoundingClientRect().left;
    outer.style[transformProp] = 'scale(1)';
    var ret = left === inner.getBoundingClientRect().left;
    document.body.removeChild(outer);
    return ret;
  }
/**
   * Detects if transformed elements leak fixed elements. According W3C
   * transform rendering spec a transformed element should contain even fixed
   * elements. Meaning that fixed elements are positioned relative to the
   * closest transformed ancestor element instead of window. However, not every
   * browser follows the spec (IE and older Firefox). So we need to test it.
   * https://www.w3.org/TR/css3-2d-transforms/#transform-rendering
   *
   * Borrowed from Mezr (v0.6.1):
   * https://github.com/niklasramo/mezr/blob/0.6.1/mezr.js#L607
   */
Detects if transformed elements leak fixed elements. According W3C
transform rendering spec a transformed element should contain even fixed
elements. Meaning that fixed elements are positioned relative to the
closest transformed ancestor element instead of window. However, not every
browser follows the spec . So we need to test it.


Detects if transformed elements leak fixed elements . According W3C transform rendering spec a transformed element should contain even fixed elements . Meaning that fixed elements are positioned relative to the closest transformed ancestor element instead of window . However not every browser follows the spec . So we need to test it .
function checkTransformLeak() {
    if (!isTransformSupported) return true;
    if (!document.body) return null;
    var elems = [0, 1].map(function(elem, isInner) {
      elem = document.createElement('div');
      elem.style.position = isInner ? 'fixed' : 'absolute';
      elem.style.display = 'block';
      elem.style.visibility = 'hidden';
      elem.style.left = isInner ? '0px' : '1px';
      elem.style[transformProp] = 'none';
      return elem;
    });
    var outer = document.body.appendChild(elems[0]);
    var inner = outer.appendChild(elems[1]);
    var left = inner.getBoundingClientRect().left;
    outer.style[transformProp] = 'scale(1)';
    var ret = left === inner.getBoundingClientRect().left;
    document.body.removeChild(outer);
    return ret;
  }
function checkTransformLeak ( ) { if ( ! isTransformSupported ) return true ; if ( ! document . body ) return null ; var elems = [ 0 , 1 ] . map ( function ( elem , isInner ) { elem = document . createElement ( 'div' ) ; elem . style . position = isInner ? 'fixed' : 'absolute' ; elem . style . display = 'block' ; elem . style . visibility = 'hidden' ; elem . style . left = isInner ? '0px' : '1px' ; elem . style [ transformProp ] = 'none' ; return elem ; } ) ; var outer = document . body . appendChild ( elems [ 0 ] ) ; var inner = outer . appendChild ( elems [ 1 ] ) ; var left = inner . getBoundingClientRect ( ) . left ; outer . style [ transformProp ] = 'scale(1)' ; var ret = left === inner . getBoundingClientRect ( ) . left ; document . body . removeChild ( outer ) ; return ret ; }
Detects if transformed elements leak fixed elements.
Detects if transformed elements leak fixed elements .
// No transforms -> definitely leaks. // No body available -> can't check it. // Do the test.