_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

fixed syntax error in code example

Open esmiralha opened this issue 7 months ago • 6 comments

fixed a typo in a code example for the toggle command

esmiralha avatar Jul 21 '25 13:07 esmiralha

This is not a typo, see this test. You toggle X on Y. *display is not owned by the next <div/>, it's a class that you toggle (add/remove) on it.

Hope that made sense 😄

zyriab avatar Jul 31 '25 19:07 zyriab

This is not a typo, see this test. You toggle X on Y. *display is not owned by the next <div/>, it's a class that you toggle (add/remove) on it.

Hope that made sense 😄

I might be at fault here, but I couldn't make the example work as it is in the docs. I had to change "on" to "of" to make it work for *display.

esmiralha avatar Aug 03 '25 17:08 esmiralha

If you look at line 161 of the test it uses "of" instead of "on".

esmiralha avatar Aug 03 '25 17:08 esmiralha

Oh interesting!

zyriab avatar Aug 03 '25 18:08 zyriab

@zyriab The docs specifically mention using of for toggling *opacity

toggle [the | my] ('*opacity' | '*visibility' | '*display')
 [of <expression>]
  [(for <time expression>) |
   (until <event name> [from <expression>]]`

geoffrey-eisenbarth avatar Aug 03 '25 18:08 geoffrey-eisenbarth

yup but the code example at the bottom of the page uses on.

esmiralha avatar Aug 05 '25 18:08 esmiralha