@tarojs/runtime 3.6.5-canary.0 → 3.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2795,8 +2795,7 @@ function encode(str) {
2795
2795
  class URLSearchParams {
2796
2796
  constructor(query) {
2797
2797
  _URLSearchParams_dict.set(this, Object.create(null));
2798
- if (!query)
2799
- return;
2798
+ query !== null && query !== void 0 ? query : (query = '');
2800
2799
  const dict = __classPrivateFieldGet(this, _URLSearchParams_dict, "f");
2801
2800
  if (typeof query === 'string') {
2802
2801
  if (query.charAt(0) === '?') {
@@ -2893,7 +2892,7 @@ class URL {
2893
2892
  _URL_pathname.set(this, '');
2894
2893
  _URL_port.set(this, '');
2895
2894
  _URL_protocol.set(this, '');
2896
- _URL_search.set(this, '');
2895
+ _URL_search.set(this, void 0);
2897
2896
  if (!isString(url))
2898
2897
  url = String(url);
2899
2898
  const parseResult = parseUrlBase(url, base);
@@ -2903,7 +2902,7 @@ class URL {
2903
2902
  __classPrivateFieldSet(this, _URL_pathname, pathname || '/', "f");
2904
2903
  __classPrivateFieldSet(this, _URL_port, port, "f");
2905
2904
  __classPrivateFieldSet(this, _URL_protocol, protocol, "f");
2906
- __classPrivateFieldSet(this, _URL_search, search, "f");
2905
+ __classPrivateFieldSet(this, _URL_search, new URLSearchParams(search), "f");
2907
2906
  }
2908
2907
  /* public property */
2909
2908
  get protocol() {
@@ -2953,15 +2952,13 @@ class URL {
2953
2952
  }
2954
2953
  }
2955
2954
  get search() {
2956
- return __classPrivateFieldGet(this, _URL_search, "f");
2955
+ const val = __classPrivateFieldGet(this, _URL_search, "f").toString();
2956
+ return (val.length === 0 || val.startsWith('?')) ? val : `?${val}`;
2957
2957
  }
2958
2958
  set search(val) {
2959
2959
  if (isString(val)) {
2960
2960
  val = val.trim();
2961
- if (val)
2962
- __classPrivateFieldSet(this, _URL_search, val.startsWith('?') ? val : `?${val}`, "f");
2963
- else
2964
- __classPrivateFieldSet(this, _URL_search, '', "f");
2961
+ __classPrivateFieldSet(this, _URL_search, new URLSearchParams(val), "f");
2965
2962
  }
2966
2963
  }
2967
2964
  get hash() {
@@ -3004,7 +3001,7 @@ class URL {
3004
3001
  }
3005
3002
  }
3006
3003
  get searchParams() {
3007
- return new URLSearchParams(this.search);
3004
+ return __classPrivateFieldGet(this, _URL_search, "f");
3008
3005
  }
3009
3006
  // public method
3010
3007
  toString() {