Repository navigation
Commit f1842fb
committed
Fix URLSearchParams.keys() returning only unique keys
The WHATWG URL spec states that URLSearchParams.keys() must yield one
entry per name-value pair, meaning duplicate names appear multiple times.
The previous implementation returned Map.keys() directly, which yields each
key only once regardless of how many values are stored under it. This caused
keys() to be inconsistent with values() and entries(), both of which already
handle duplicates correctly.
Updated keys() to use a generator that yields each key once per associated
value, matching the approach already used by values() and entries().
Test plan: Added a test asserting that keys() on URLSearchParams with
duplicate key entries ('key1', 'key1', 'key2') returns all three names.
Changelog:
[General] [Fixed] - Fix URLSearchParams.keys() returning only unique keys instead of all name-value pair names1 parent 8bac1df commit f1842fb
2 files changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
0 commit comments