capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.28k stars 201 forks source link

localStorage.setItem non-string value(such as 1, {}) not behavior as expected #1347

Closed dr2009 closed 6 months ago

dr2009 commented 6 months ago

Describe the bug

// happy-dom@14.3.1
localStorage.setItem('a', {})  // {}, expect '[object Object]'
localStorage.setItem('a', 1)  // 1, expect '1'

To Reproduce

Expected behavior

localStorage.setItem('a', {})  // '[object Object]'
localStorage.setItem('a', 1)  // '1'

Screenshots If applicable, add screenshots to help explain your problem.

Device:

Additional context happy-dom@14.3.1