| <!DOCTYPE html> |
| <title>Selection UseCounters</title> |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script> |
| test(function() { |
| var SelectionCollapseNull = 1083; // From UseCounter.h |
| assert_false(internals.isUseCounted(document, SelectionCollapseNull)); |
| document.getSelection().collapse(null, -1); |
| assert_true(internals.isUseCounted(document, SelectionCollapseNull)); |
| }, 'selection.collapse(null, -1)'); |
| |
| test(function() { |
| var SelectionSetBaseAndExtentNull = 1084; // From UseCounter.h |
| assert_false(internals.isUseCounted(document, SelectionSetBaseAndExtentNull)); |
| assert_throws('IndexSizeError', function() { |
| document.getSelection().setBaseAndExtent(null, -1, null, -1); |
| }); |
| assert_false(internals.isUseCounted(document, SelectionSetBaseAndExtentNull)); |
| document.getSelection().setBaseAndExtent(null, 0, null, 0) |
| assert_true(internals.isUseCounted(document, SelectionSetBaseAndExtentNull)); |
| }, 'selection.setBaseAndExtent(null, 0, null, 0)'); |
| </script> |