Skip to content

Dataset value is returned as undefined when it is set to empty string #1689

Open
@pdanpdan

Description

Describe the bug
Happy-Dom evaluates a dataset key as undefined when it is set to an empty string.
The browser evaluates it correctly to empty string.

To Reproduce
Steps to reproduce the behavior:

  1. document.body.dataset.test = ''
  2. console.log(document.body.dataset.test)
  3. It will output undefined while it should output ''

Expected behavior
It should be evaluated to empty string.

Additional context
It is a regression introduced in v16.0.0 - latest working version is v15.11.7.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions