Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<title>Range getClientRects() with collapsed 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>
<div>words</div>
<script>
test(function() {
  const selection = document.getSelection();
  selection.selectAllChildren(document.querySelector('div'));
  selection.collapseToEnd();
  const range = selection.getRangeAt(0);
  assert_true(range.collapsed);
  const clientRects = range.getClientRects();
  assert_equals(clientRects.length, 0);
});
</script>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers