@tarojs/runtime 4.0.0-alpha.36 → 4.0.0-alpha.38

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.
@@ -427,11 +427,19 @@ const URLSearchParams = process.env.TARO_PLATFORM === 'web' ? env.window.URLSear
427
427
  for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
428
428
  const value = pairs[i];
429
429
  const index = value.indexOf('=');
430
- if (index > -1) {
431
- appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
430
+ // 针对不规范的 url 参数做容错处理,如:word=你%好
431
+ try {
432
+ if (index > -1) {
433
+ appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
434
+ }
435
+ else if (value.length) {
436
+ appendTo(dict, decode(value), '');
437
+ }
432
438
  }
433
- else if (value.length) {
434
- appendTo(dict, decode(value), '');
439
+ catch (err) {
440
+ if (process.env.NODE_ENV !== 'production') {
441
+ console.warn(`[Taro warn] URL 参数 ${value} decode 异常`);
442
+ }
435
443
  }
436
444
  }
437
445
  }
@@ -983,12 +991,12 @@ let now;
983
991
  let lastTime = 0;
984
992
  // https://gist.github.com/paulirish/1579671
985
993
  // https://gist.github.com/jalbam/5fe05443270fa6d8136238ec72accbc0
986
- const _raf = typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame !== null ? requestAnimationFrame : function (callback) {
994
+ const _raf = process.env.TARO_PLATFORM === 'web' ? requestAnimationFrame : function (callback) {
987
995
  const _now = now();
988
996
  const nextTime = Math.max(lastTime + 16, _now); // First time will execute it immediately but barely noticeable and performance is gained.
989
997
  return setTimeout(function () { callback(lastTime = nextTime); }, nextTime - _now);
990
998
  };
991
- const _caf = typeof cancelAnimationFrame !== 'undefined' && cancelAnimationFrame !== null
999
+ const _caf = process.env.TARO_PLATFORM === 'web'
992
1000
  ? cancelAnimationFrame
993
1001
  : function (seed) {
994
1002
  // fix https://github.com/NervJS/taro/issues/7749
@@ -3309,9 +3317,7 @@ function contains(node) {
3309
3317
  return isContains;
3310
3318
  }
3311
3319
 
3312
- const isWeb = process.env.TARO_PLATFORM === 'web';
3313
- const isHarmony = process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony';
3314
- if (!isWeb && !isHarmony) {
3320
+ if (process.env.TARO_PLATFORM !== 'web' && !(process.env.TARO_PLATFORM === 'harmony' || process.env.TARO_ENV === 'harmony')) {
3315
3321
  if (ENABLE_INNER_HTML) {
3316
3322
  TaroNode.extend('innerHTML', {
3317
3323
  set(html) {