Document deprecation of `WCF_CLICK_EVENT` (#100)
authorMatthias Schmidt <gravatronics@live.com>
Mon, 2 Nov 2020 12:33:34 +0000 (13:33 +0100)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 12:33:34 +0000 (13:33 +0100)
* Document deprecation of `WCF_CLICK_EVENT`

* Use arrow function in WCF_CLICK_EVENT documentation

Co-authored-by: Tim Düsterhus <duesterhus@woltlab.com>
Co-authored-by: Tim Düsterhus <duesterhus@woltlab.com>
_data/sidebars/sidebar.yml
pages/migration/wsc-53/migration_wsc-53_javascript.md [new file with mode: 0644]

index f4822d63bc8f253c1370031a0548e45084b58cd5..d4a3548db2d62453aa53baf4d486eb8b73e0c0bc 100644 (file)
@@ -122,6 +122,8 @@ entries:
         - title: Migrating from WSC 5.3
           subfolderitems:
 
+          - title: JavaScript
+            url: /migration_wsc-53_javascript.html
           - title: Templates
             url: /migration_wsc-53_templates.html
           - title: Third Party Libraries
diff --git a/pages/migration/wsc-53/migration_wsc-53_javascript.md b/pages/migration/wsc-53/migration_wsc-53_javascript.md
new file mode 100644 (file)
index 0000000..54a4df6
--- /dev/null
@@ -0,0 +1,19 @@
+---
+title: Migrating from WSC 5.3 - JavaScript
+sidebar: sidebar
+permalink: migration_wsc-53_javascript.html
+folder: migration/wsc-53
+---
+
+## `WCF_CLICK_EVENT`
+
+For event listeners on click events, `WCF_CLICK_EVENT` is deprecated and should no longer be used.
+Instead, use `click` directly:
+
+```javascript
+// before
+element.addEventListener(WCF_CLICK_EVENT, this._click.bind(this));
+
+// after
+element.addEventListener('click', (ev) => this._click(ev));
+```