props.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <script>(function(){
  6. var props = {};
  7. function addObject(obj) {
  8. if (obj == null) return;
  9. try {
  10. Object.getOwnPropertyNames(obj).forEach(add);
  11. } catch(ex) {}
  12. if (obj.prototype) {
  13. Object.getOwnPropertyNames(obj.prototype).forEach(add);
  14. }
  15. if (typeof obj == "function") {
  16. try {
  17. Object.getOwnPropertyNames(new obj).forEach(add);
  18. } catch(ex) {}
  19. }
  20. }
  21. function add(name) {
  22. props[name] = true;
  23. }
  24. Object.getOwnPropertyNames(window).forEach(function(thing){
  25. addObject(window[thing]);
  26. });
  27. try {
  28. addObject(new Event("click"));
  29. addObject(new Event("contextmenu"));
  30. addObject(new Event("mouseup"));
  31. addObject(new Event("mousedown"));
  32. addObject(new Event("keydown"));
  33. addObject(new Event("keypress"));
  34. addObject(new Event("keyup"));
  35. addObject(new Event("input"));
  36. addObject(new Event("touchstart"));
  37. addObject(new Event("touchmove"));
  38. addObject(new Event("touchend"));
  39. addObject(new Event("touchcancel"));
  40. addObject(new Event("pointerdown"));
  41. addObject(new Event("pointermove"));
  42. addObject(new Event("pointerup"));
  43. addObject(new Event("pointercancel"));
  44. addObject(new Event("pointerenter"));
  45. addObject(new Event("pointerleave"));
  46. } catch(ex) {}
  47. var ta = document.createElement("textarea");
  48. ta.style.width = "100%";
  49. ta.style.height = "20em";
  50. ta.style.boxSizing = "border-box";
  51. ta.value = 'export var domprops = ' + JSON.stringify(Object.keys(props).sort(cmp), null, 4);
  52. document.body.appendChild(ta);
  53. function cmp(a, b) {
  54. a = a.toLowerCase();
  55. b = b.toLowerCase();
  56. return a < b ? -1 : a > b ? 1 : 0;
  57. }
  58. })();</script>
  59. </body>
  60. </html>