capricorn86 / happy-dom

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

URLSearchParams is missing "size" property #1396

Open shadow-identity opened 3 months ago

shadow-identity commented 3 months ago

Describe the bug URLSearchParams should have its size property which indicates the total number of search parameter entries. However, happy-dom implementation always returns undefined when trying to access it.

To Reproduce Steps to reproduce the behavior:

  1. In node environment, for example in vitest, add this code:
    const searchParams = new URLSearchParams()
    console.log(searchParams.size)
    searchParams.append('foo', 'bar')
    console.log(searchParams.size)
  2. Run and check the console output

Expected behavior Console should return

0
1

But it returns

undefined
undefined

Device: