Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime): Non-standard Concatenation Algorithm in BOM URL polyfill #17472

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TechQuery
Copy link

这个 PR 做了什么?

修正 Taro runtime 中的 polyfill,对齐 Web URL 标准中的路径拼接算法https://developer.mozilla.org/zh-CN/docs/Web/API/URL/URL

这个 PR 是什么类型?

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe):

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

}
const { protocol, origin, pathname, href } = parsedBase

fullUrl = url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个人觉得这个不如之前的写法清晰易读

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个人觉得这个不如之前的写法清晰易读

在同一份数据涉及的操作不多时,展开写可能更清晰;但分支情况多了,代码行数多反而不利于阅读,格式化规范的三目运算符则能清晰展示不同条件和分支的相互关系。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants