Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<title>Range getClientRects() and getBoundingClientRect() for empty range</title>
<script src="https://rawgit.com/w3c/testharness.js/master/testharness.js"></script>
<script src="https://rawgit.com/w3c/testharness.js/master/testharnessreport.js"></script>
<script>
test(function() {
  const range = new Range,
        clientRects = range.getClientRects(),
        boundingClientRect = range.getBoundingClientRect(); 
  assert_equals(clientRects.length, 0);
  assert_equals(typeof boundingClientRect, 'object');
  assert_equals(boundingClientRect.left, 0);
  assert_equals(boundingClientRect.top, 0);
  assert_equals(boundingClientRect.width, 0);
  assert_equals(boundingClientRect.height, 0);
});
</script>
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
foolippro
0viewers