_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

[Bug] empty functions (or event handlers) are not allowed

Open rozek opened this issue 3 years ago • 0 comments

it would surprise me if the following behaviour would be intended:

trying to define an empty function causes the parser to throw an error - just a comment as function body is not sufficient:

  def globalFunction ()
--    get $x
  end

throws the following error

_hyperscript.min.js:1 hyperscript errors were found on the following element: <script type=​"text/​hyperscript">​…​</script>​ 

 Expected commandList

--    get $x
                ^^

 Error: Expected commandList

--    get $x
                ^^


    at a.raiseParseError (https://127.0.0.1:7443/js/_hyperscript.min.js:1:11785)
    at a.requireElement (https://127.0.0.1:7443/js/_hyperscript.min.js:1:10734)
    at https://127.0.0.1:7443/js/_hyperscript.min.js:1:54063
    at n (https://127.0.0.1:7443/js/_hyperscript.min.js:1:11188)
    at https://127.0.0.1:7443/js/_hyperscript.min.js:1:8747
    at a.parseElement (https://127.0.0.1:7443/js/_hyperscript.min.js:1:10515)
    at a.requireElement (https://127.0.0.1:7443/js/_hyperscript.min.js:1:10706)
    at https://127.0.0.1:7443/js/_hyperscript.min.js:1:47578
    at a.parseElement (https://127.0.0.1:7443/js/_hyperscript.min.js:1:10515)
    at a.parseHyperScript (https://127.0.0.1:7443/js/_hyperscript.min.js:1:11895)

The same applies to event handlers

rozek avatar Jul 26 '22 11:07 rozek