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

passing "truthy" values for classes should add them to the output #59

Closed
mreinstein opened this issue Jun 29, 2021 · 0 comments
Closed
Labels

Comments

@mreinstein
Copy link
Contributor

example:

<img></img>


<script type="module">
    import { init, classModule, h } from 'https://cdn.skypack.dev/snabbdom'

    const patch = init([ classModule ])

    const container = document.querySelector('img')

    const vnode = h('img', {
        class: {
          selected: 'true'
        }
      })

    patch(container, vnode)
</script>

When inspecting the DOM, you'll see this:

<img class="selected">

This is because snabbdom internally is not doing a strict compare against true, it'd doing a "truthy" check:

https://github.com/snabbdom/snabbdom/blob/e203f711c60fde72fa391f0a8e927df4a376204b/src/modules/class.ts#L23-L24

@mreinstein mreinstein added the bug label Jun 29, 2021
@acstll acstll closed this as completed in 0b992ea Jun 30, 2021
acstll added a commit that referenced this issue Jun 30, 2021
make class inclusion check truthy to match snabbdom. fixes #59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant