|  | 
| 7 | 7 | <script src="Document-createEvent.js"></script> | 
| 8 | 8 | <div id="log"></div> | 
| 9 | 9 | <script> | 
| 10 |  | -function testAlias(arg, iface) { | 
|  | 10 | +function supportsTouchEvents(isTouchEvent) { | 
|  | 11 | +  if (isTouchEvent) { | 
|  | 12 | +    assert_implements_optional('ontouchstart' in document, "'expose legacy touch event APIs'"); | 
|  | 13 | +  } | 
|  | 14 | +} | 
|  | 15 | +function testAlias(arg, iface, isTouchEvent) { | 
| 11 | 16 |   var ev; | 
| 12 | 17 |   test(function() { | 
|  | 18 | +    supportsTouchEvents(isTouchEvent); | 
| 13 | 19 |     ev = document.createEvent(arg); | 
| 14 | 20 |     assert_equals(Object.getPrototypeOf(ev), window[iface].prototype); | 
| 15 | 21 |   }, arg + " should be an alias for " + iface + "."); | 
| 16 | 22 |   test(function() { | 
|  | 23 | +    supportsTouchEvents(isTouchEvent); | 
| 17 | 24 |     assert_equals(ev.type, "", | 
| 18 | 25 |                   "type should be initialized to the empty string"); | 
| 19 | 26 |     assert_equals(ev.target, null, | 
|  | 
| 32 | 39 |                   "isTrusted should be initialized to false"); | 
| 33 | 40 |   }, "createEvent('" + arg + "') should be initialized correctly."); | 
| 34 | 41 | } | 
|  | 42 | +aliases.TouchEvent = 'TouchEvent'; | 
| 35 | 43 | for (var alias in aliases) { | 
|  | 44 | +  var isTouchEvent = alias === 'TouchEvent'; | 
| 36 | 45 |   var iface = aliases[alias]; | 
| 37 |  | -  testAlias(alias, iface); | 
| 38 |  | -  testAlias(alias.toLowerCase(), iface); | 
| 39 |  | -  testAlias(alias.toUpperCase(), iface); | 
|  | 46 | +  testAlias(alias, iface, isTouchEvent); | 
|  | 47 | +  testAlias(alias.toLowerCase(), iface, isTouchEvent); | 
|  | 48 | +  testAlias(alias.toUpperCase(), iface, isTouchEvent); | 
| 40 | 49 | 
 | 
| 41 | 50 |   if (alias[alias.length - 1] != "s") { | 
| 42 | 51 |     var plural = alias + "s"; | 
|  | 
0 commit comments