_hyperscript
_hyperscript copied to clipboard
[Doc/Bug] you may omit a single "end", but not two of them
According to the overview it is allowed to omit the end which terminates a feature or a statement if a new feature starts.
The following code, however
<script type="text/hyperscript">
on mousemove if (event.target is not me) log 'delegated mousemove'
on mouseenter if (event.target is not me) log 'delegated mouseenter'
</script>
fails to parse with the following error message
VM2252 about:srcdoc:167 hyperscript errors were found on the following element: <script type="text/hyperscript">…</script>
Expected 'end' but found 'on'
on mouseenter if (event.target is not me) log 'delegated mouseenter'
^^
Error: Expected 'end' but found 'on'
on mouseenter if (event.target is not me) log 'delegated mouseenter'
^^
at a.raiseParseError (https://unpkg.com/hyperscript.org:1:11785)
at i.raiseError (https://unpkg.com/hyperscript.org:1:5948)
at i.requireToken (https://unpkg.com/hyperscript.org:1:6848)
at https://unpkg.com/hyperscript.org:1:67955
at n (https://unpkg.com/hyperscript.org:1:10985)
at https://unpkg.com/hyperscript.org:1:8962
at a.parseElement (https://unpkg.com/hyperscript.org:1:10515)
at https://unpkg.com/hyperscript.org:1:9180
at a.parseElement (https://unpkg.com/hyperscript.org:1:10515)
at a.requireElement (https://unpkg.com/hyperscript.org:1:10706)
(and parsing seems to take longer than normal)
Adding an end after each if statement satisfies the parser, though
For me, it's unclear whether this is a bug or just a problem with the documentation which may be too unspecific here