tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

touch-globaleventhandler-interface.html (1974B)


      1 <!DOCTYPE HTML>
      2 <title>GlobalEventHandlers Touch Interface Tests</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script>
      6 function supportsTouchEvents() {
      7  assert_implements_optional('ontouchstart' in document, "'expose legacy touch event APIs'");
      8 }
      9 test(function() {
     10    supportsTouchEvents();
     11    var touch_event_list = ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel'];
     12    var global_event_handlers = [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype];
     13    for (var i in touch_event_list) {
     14        for (var j in global_event_handlers) {
     15            assert_true(touch_event_list[i] in global_event_handlers[j], "Touch event " + touch_event_list[i] + " in " + global_event_handlers[j].constructor.name);
     16        }
     17    }
     18 }, "Touch events in GlobalEventHandlers");
     19 
     20 test(function() {
     21    supportsTouchEvents();
     22    var touch_event_list = ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel'];
     23    var global_event_handlers = [window, HTMLElement.prototype, SVGElement.prototype, Document.prototype];
     24    for (var i in touch_event_list) {
     25        for (var j in global_event_handlers) {
     26            assert_true(global_event_handlers[j].hasOwnProperty(touch_event_list[i]), "GlobalEventHandler " + global_event_handlers[j].constructor.name + " hasOwnProperty " + touch_event_list[i]);
     27        }
     28    }
     29 }, "Touch events are GlobalEventHandlers' own property");
     30 
     31 test(function() {
     32    var touch_event_list = ['ontouchstart', 'ontouchmove', 'ontouchend', 'ontouchcancel'];
     33    var non_global_event_handlers = [Element.prototype];
     34    for (var i in touch_event_list) {
     35        for (var j in non_global_event_handlers) {
     36            assert_false(touch_event_list[i] in non_global_event_handlers[j], "Touch event " + touch_event_list[i] + " not in " + non_global_event_handlers[j].constructor.name);
     37        }
     38    }
     39 }, "Touch events not in Element.prototype");
     40 </script>