]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/expand-toggle.js
Add ALLOWED_IFRAME_SOURCES to phpunit.xml
[bookstack] / resources / js / components / expand-toggle.js
index 76928623d3bb7b70bf3b7ead7bcd2f99b4bc683e..0d2018b9da23531b27d98b18db682335ab47615b 100644 (file)
@@ -3,7 +3,7 @@ import {Component} from './component';
 
 export class ExpandToggle extends Component {
 
-    setup(elem) {
+    setup() {
         this.targetSelector = this.$opts.targetSelector;
         this.isOpen = this.$opts.isOpen === 'true';
         this.updateEndpoint = this.$opts.updateEndpoint;
@@ -25,7 +25,8 @@ export class ExpandToggle extends Component {
 
         const matchingElems = document.querySelectorAll(this.targetSelector);
         for (const match of matchingElems) {
-            this.isOpen ? this.close(match) : this.open(match);
+            const action = this.isOpen ? this.close : this.open;
+            action(match);
         }
 
         this.isOpen = !this.isOpen;