textarea-select-event-manual.html (875B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>HTMLTextAreaElement Test: select event</title> 4 <link rel="author" title="Intel" href="http://www.intel.com/"> 5 <meta name="flags" content="interact"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <p>Select any numberic characters in the text area below</p> 10 11 <form id="testForm" name="testForm"> 12 <textarea id="testtextarea">0123456789</textarea> 13 </form> 14 15 <script> 16 17 var textarea = document.getElementById("testtextarea"); 18 19 setup({explicit_done : true}); 20 setup({explicit_timeout : true}); 21 22 on_event(textarea, "select", function(evt) { 23 test(function() { 24 assert_greater_than(textarea.value.substring(textarea.selectionStart, textarea.selectionEnd).length, 0, "Check if select event captured when text selected"); 25 }); 26 done(); 27 }); 28 29 </script> 30 31 <div id="log"></div>