_hyperscript icon indicating copy to clipboard operation
_hyperscript copied to clipboard

Javascript functions with numbers in name return "Must be a function invocation" error

Open Nicero opened this issue 4 years ago • 2 comments

_hyperscript v0.9.7

I noticed this strange behaviour and I don't know if I doing something wrong or it's a bug.

If a Javascript function has a number in its name _hyperscript returns the error Must be a function invocation.

Take for example the following code: the value of the first INPUT is sent to the function text101 which simply returns the same string which is put as value of the second INPUT.

_hyperscript returns Must be a function invocation error.

If you rename the function removing the number '101', the code works properly.

<input id="one" type="text" 
    _="on keyup call text101(my.value) then put result into #two.value">

<input id="two" type="text">

<script type="text/javascript">
    function text101(s) {
        return s;
    }
</script>

Nicero avatar Sep 08 '22 15:09 Nicero

Sounds like a lexing error, I will look at it for the next release

1cg avatar Oct 04 '22 20:10 1cg

We have a test verifying this works:

https://github.com/bigskysoftware/_hyperscript/blob/d5da09ea618fc18a0cc0de141a7433212c808d0c/test/core/regressions.js#L132

1cg avatar Dec 17 '24 21:12 1cg