props.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. if (/^[a-z_$][a-z0-9_$]*$/i.test(name)) {
  23. props[name] = true;
  24. }
  25. }
  26. Object.getOwnPropertyNames(window).forEach(function(thing){
  27. addObject(window[thing]);
  28. });
  29. try {
  30. addObject(new Event("click"));
  31. addObject(new Event("contextmenu"));
  32. addObject(new Event("mouseup"));
  33. addObject(new Event("mousedown"));
  34. addObject(new Event("keydown"));
  35. addObject(new Event("keypress"));
  36. addObject(new Event("keyup"));
  37. addObject(new Event("input"));
  38. addObject(new Event("touchstart"));
  39. addObject(new Event("touchmove"));
  40. addObject(new Event("touchend"));
  41. addObject(new Event("touchcancel"));
  42. addObject(new Event("pointerdown"));
  43. addObject(new Event("pointermove"));
  44. addObject(new Event("pointerup"));
  45. addObject(new Event("pointercancel"));
  46. addObject(new Event("pointerenter"));
  47. addObject(new Event("pointerleave"));
  48. } catch(ex) {console.error(ex)}
  49. try {
  50. addObject(Temporal.Duration.from({ years: 1 }));
  51. addObject(new Temporal.Instant());
  52. addObject(Temporal.Now);
  53. addObject(new Temporal.PlainDate(2021, 7, 1));
  54. addObject(new Temporal.ZonedDateTime(0n, "America/New_York"));
  55. addObject(new Temporal.PlainYearMonth(2021, 7));
  56. addObject(new Temporal.PlainTime());
  57. addObject(new Temporal.PlainMonthDay(7, 1));
  58. addObject(new Temporal.PlainDateTime(2021, 7, 1));
  59. } catch(ex) {console.error(ex)}
  60. var ta = document.createElement("textarea");
  61. ta.style.width = "100%";
  62. ta.style.height = "20em";
  63. ta.style.boxSizing = "border-box";
  64. ta.value = 'export var domprops = ' + JSON.stringify(Object.keys(props).sort(cmp), null, 4);
  65. document.body.appendChild(ta);
  66. function cmp(a, b) {
  67. a = a.toLowerCase();
  68. b = b.toLowerCase();
  69. return a < b ? -1 : a > b ? 1 : 0;
  70. }
  71. })();</script>
  72. </body>
  73. </html>