extend-exception.html (699B)
1 <!doctype html> 2 <html> 3 <title>Selection extend() test thrown exceptions</title> 4 <meta charset=utf-8> 5 <body> 6 <script src=/resources/testharness.js></script> 7 <script src=/resources/testharnessreport.js></script> 8 <script> 9 "use strict"; 10 11 test(function() { 12 let div = document.createElement("div"); 13 document.body.appendChild(div); 14 15 assert_throws_dom("INVALID_STATE_ERR", function() { getSelection().extend(div) }, "InvalidStateError exception should be thrown for extend() due to no ranges being added to Selection"); 16 17 this.add_cleanup(function() { div.remove() }); 18 }, "InvalidStateError exception is thrown for extend() when no ranges are present in Selection"); 19 </script> 20 </body> 21 </html>