Skip to content

Bug: TypeError when setting on property as interpolated string #163

@mlamowski

Description

@mlamowski

Description

Attempting to set the property on using an interpolated string value (e.g. from a function like when()) results in a TypeError regarding addEventListener.

Steps to Reproduce

1. The component has a string property named on:

properties() {
        return {
            on: '', // '' || 'default'
        };
    }

2. Failing Syntax:
<button on="${when(condition, 'default', '')}">...</button>

3. Error Logged:
Uncaught (in promise) TypeError: Failed to execute 'addEventListener' on 'EventTarget': parameter 2 is not of type 'Object'.

4. Working Syntax:
<button on="default">...</button>
<button .on="${when(condition, 'default', '')}">...</button>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions