Skip to content

Commit

Permalink
fix URLSearchParams#size in ES3 engines (IE8-)
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jun 11, 2023
1 parent 63fbc1b commit 57dd86a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Added `value` argument of `URLSearchParams.prototype.{ has, delete }`, [url/735](https://github.com/whatwg/url/pull/735)
- Fixed some cases of increasing buffer size in `ArrayBuffer.prototype.{ transfer, transferToFixedLength }` polyfills
- Fixed awaiting async `AsyncDisposableStack.prototype.adopt` callback, [#1258](https://github.com/zloirock/core-js/issues/1258)
- Fixed `URLSearchParams#size` in ES3 engines (IE8-)
- Added TypeScript definitions to `core-js-compat`, [#1235](https://github.com/zloirock/core-js/issues/1235), thanks [@susnux](https://github.com/susnux)
- Compat data improvements:
- [`Set.prototype.difference`](https://github.com/tc39/proposal-set-methods) that was missed in Bun because of [a bug](https://github.com/oven-sh/bun/issues/2309) added in 0.6.0
Expand Down
6 changes: 3 additions & 3 deletions packages/core-js/modules/web.url-search-params.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
anInstance(this, URLSearchParamsPrototype);
var init = arguments.length > 0 ? arguments[0] : undefined;
var state = setInternalState(this, new URLSearchParamsState(init));
if (!DESCRIPTORS) this.length = state.entries.length;
if (!DESCRIPTORS) this.size = state.entries.length;
};

var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
Expand Down Expand Up @@ -237,7 +237,7 @@ defineBuiltIns(URLSearchParamsPrototype, {
if (value !== undefined) break;
} else index++;
}
if (!DESCRIPTORS) this.length = entries.length;
if (!DESCRIPTORS) this.size = entries.length;
state.updateURL();
},
// `URLSearchParams.prototype.get` method
Expand Down Expand Up @@ -302,7 +302,7 @@ defineBuiltIns(URLSearchParamsPrototype, {
}
}
if (!found) push(entries, { key: key, value: val });
if (!DESCRIPTORS) this.length = entries.length;
if (!DESCRIPTORS) this.size = entries.length;
state.updateURL();
},
// `URLSearchParams.prototype.sort` method
Expand Down

0 comments on commit 57dd86a

Please sign in to comment.