Skip to content

Commit

Permalink
Fix some bugs
Browse files Browse the repository at this point in the history
- Use `continue` in for loop instead of `return`
- Fix double named variable/ function in `toggleText()`
  • Loading branch information
almic committed Apr 12, 2024
1 parent bbc4f45 commit 3ddba04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ document.addEventListener(
const clickFunc = button.onclick;
if (!clickFunc) {
button.onclick = () => console.log(buttonName + '; no click function');
return;
continue;
}
let clickFuncBody = clickFunc.toString() ?? '';
if (clickFuncBody) {
Expand Down Expand Up @@ -39,8 +39,8 @@ async function loadSourceCode(name, path) {
* Toggles collapsed state on the named elements, and toggles the text on the
* given element
*/
function collapse(self, toggleText, name) {
toggleText(self, toggleText);
function collapse(self, text, name) {
toggleText(self, text);
self.classList.toggle('collapse-active');
const elements = document.getElementsByName(name);
if (!elements.length) {
Expand Down

0 comments on commit 3ddba04

Please sign in to comment.