You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
akira-cn
changed the title
patch 的 insert 方法硬编码了判断 ref.parentNode 的逻辑
The insert method get ref.parentNode at patch.js, it should be nodeOps.parentNode(ref)
Aug 26, 2018
Version
2.5.17
Reproduction link
https://code.h5jun.com/mewa/edit?html,output
Steps to reproduce
Note: Reproduction link 里面的bug我是已经临时修了,用这个文件覆盖了patch.js
我在修改runtime以支持spritejs,发现vdom的patch.js里面使用了ref.parentNode
因为v-if指令用CommentNode作为占位符,但是spritejs是基于canvas的,没有实体DOM,所以我没办法把CommentNode添加到DOM上,我做了一个适配,将它作为spritejs的children添加到容器里。这么做我需要改变该占位元素的parent,因为这是一个HTML元素,parentNode是只读的,我没法直接修改,所以我在这个元素上添加一个新的parent属性:
然后重写:
结果发现使用 v-if 切换的时候不行(现象是toggle元素的时候能隐藏不能显现)。后来我发现在patch.js里这段代码:
应该改为:
这样才能拿到正确的parentNode。
因为只有一行代码修改,我就不提PR了。我现在先采用patch-fix的方式修复。
如果下一个版本能顺便修一下,我会很感激 :)。
What is expected?
应该得到:nodeOps.parentNode(ref)
What is actually happening?
实际得到:ref.parentNode
The text was updated successfully, but these errors were encountered: