Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

behavior does not init properly when parameters are "optional" #495

Open
J-Griffin opened this issue Nov 17, 2023 · 0 comments
Open

behavior does not init properly when parameters are "optional" #495

J-Griffin opened this issue Nov 17, 2023 · 0 comments

Comments

@J-Griffin
Copy link

J-Griffin commented Nov 17, 2023

I'm using Hyperscript 0.9.12 and attempting to do something similar to what the Draggable example does. Default to "me" if a specific click target is not passed in.

The init block does not work.

<script type="text/hyperscript">
    behavior alertMe(clickElement)
        init
            if no clickElement set the clickElement to me
        end

        on click from clickElement
            call alert('behavior is working!')
        end
    end
</script>

<!-- Works: -->
<i _="install alertMe(clickElement: me)">click me</i>

<!-- Does not work: -->
<i _="install alertMe()">click me</i>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant