Passing an object's property to a behavior results in undefined . [BUG]

Open
#550 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start with _hyperscript.js and trace how the direct log $obj.a expression is evaluated versus the install logval(val: $obj.a) behavior argument. Reproduce the issue with the provided HTML, then verify that clicking the second button logs 10 instead of undefined.

Written by the indexing model from the issue text.

Description

<html>
        <script src="./_hyperscript.js"></script>

        <script type="text/hyperscript">
                init
                        set $obj to {a:10,b:40}
                end

                behavior logval(val)
                        on click
                                log val
                        end
                end
        </script>
        <body>
                <button _="on click log $obj.a"> <!-- >> 10 -->
                        first button
                </button>
                <button _="install logval(val: $obj.a)"> <!-- >> undefined -->
                        second button
                </button>
        </body>
</html>

It is expected for 10 to appear in the console as a result of pressing the second button but undefined is returned .

Dominant language
JavaScript
Stars
3.8k
Forks
171
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bigskysoftware/_hyperscript

All issues in bigskysoftware/_hyperscript

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.