KeyEvent-initKeyEvent.html (960B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>KeyEvent.initKeyEvent</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <script> 8 // The legacy KeyEvent.initKeyEvent shouldn't be defined in the wild anymore. 9 // https://www.w3.org/TR/1999/WD-DOM-Level-2-19990923/events.html#Events-Event-initKeyEvent 10 test(function() { 11 const event = document.createEvent("KeyboardEvent"); 12 assert_true(event?.initKeyEvent === undefined); 13 }, "KeyboardEvent.initKeyEvent shouldn't be defined (created by createEvent(\"KeyboardEvent\")"); 14 15 test(function() { 16 const event = new KeyboardEvent("keypress"); 17 assert_true(event?.initKeyEvent === undefined); 18 }, "KeyboardEvent.initKeyEvent shouldn't be defined (created by constructor)"); 19 20 test(function() { 21 assert_true(KeyboardEvent.prototype.initKeyEvent === undefined); 22 }, "KeyboardEvent.prototype.initKeyEvent shouldn't be defined"); 23 </script>