Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Error when using with axios: "TypeError: Cannot read properties of undefined (reading 'charAt')"

未关闭
#259 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
web-dev

调研方向

从 Axios 的 lib/helpers/isURLSameOrigin.js 第 41 行开始,跟踪报告中描述的 anchor 元素行为。比较创建 anchor 并为其赋值 href 对 linkedom 中 pathname 的影响,与 Axios 的预期进行对照;当报告中的 Axios 错误不再发生且 anchor 暴露出预期的 pathname 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

When used with axios I'm finding this error:
Screenshot 2024-03-03 at 1 50 27 PM
I did the work of following the stack trace and found where is the problem. At line 41 in https://github.com/axios/axios/blob/v1.x/lib/helpers/isURLSameOrigin.js
Screenshot 2024-03-03 at 1 56 47 PM
Seems like Axios checks if the browser is a "standard" one by creating an element. The problem is that it expects that when you create an anchor element it sets itself the pathname property when you add the href property.

I tried setting the user agent to msie or trident but the issue is still showing up

主要语言
HTML
星标
2.1k
派生
104
PR 合并指标
30 天内没有已合并 PR

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

WebReflection/linkedom 的其他 Issue

查看 WebReflection/linkedom 的全部 Issue

相似的 Issue

更多 Web Dev Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。