isDOM doesn't work on elements outside of current window
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- frontend
调研方向
从所引用的行开始检查 src/Dom/findDOMNode.ts,并比较它对来自另一个窗口的元素的行为。然后检查 src/Dom/isVisible.ts,其中报告了相同的跨窗口问题。确认这两个 utility 都能处理当前窗口之外的元素,同时不改变对当前窗口节点的行为。
由索引模型根据 Issue 内容生成。
描述
Fails when node is not inside the current window. The main use case is using one screen for presentation and another screen for information that the presenter see.
an idea of a fix:
const nodeWindow = node?.ownerDocument?.defaultView;
return node instanceof nodeWindow.HTMLElement || node instanceof nodeWindow.SVGElement;
The issue is that the above code doesn't really work because you need to know if node is an Element first before getting the window, so we'll need a better idea for a fix.
a fix that I feel like is a hack:
return "nodeType" in node && node === Node.ELEMENT_NODE && "tagName" in node;
I don't know if this is good enough, but it works, fixes the bug.
same thing also happens here https://github.com/react-component/util/blob/288022820d2ab899c799ac6336155dedf3e9a766/src/Dom/isVisible.ts#L6
- 主要语言
- TypeScript
- 星标
- 670
- 派生
- 205
- 平均合并
- 15 天 17 小时
- 30 天内合并 PR
- 6
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react-component/util 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
react-component/util#816 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
react-component/util#671 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
react-component/util#738 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 25/100
react-component/util#710 ·
-
难度 3/5 1-2 天 新手友好度 25/100
react-component/util#647 · 5 条评论 ·
查看 react-component/util 的全部 Issue
相似的 Issue
-
comp/desktop P3 type/bug
难度 1/5 1 小时以内 新手友好度 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 85/100
getsentry/sentry-javascript#24577 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 68/100
chrisparsons83/flexspotff#153 ·