Repository navigation
fix: 修复子应用document.querySelectorAll('script')获取长度为0 (#822) - #843
Merged
Merged
Conversation
子应用脚本都在 js iframe 中执行,shadowRoot / 渲染 iframe 中没有可执行的 script。
与 getElementsByTagName('script') 保持一致,querySelectorAll('script') 改为从 js iframe 获取,
用原生 querySelectorAll 保证返回值仍是 NodeList;降级模式下 querySelector('script') 同样处理。
撤回对所有选择器的空结果兜底,其他选择器行为与之前一致,修复 querySelectorAll('base') 返回 null 的问题;补充单测。
Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
|
感谢修复!在作者分支上补了一个修正提交,调整了实现方式,说明如下。 问题原因子应用的 实现调整不再对所有选择器做「空结果兜底」,改为只处理
验证在 Chrome 中分别以非降级、降级模式运行子应用,子应用在自己的脚本里调用:
已知限制
Fixes #822 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
npm run test通过详细描述