html5 shadow dom,html5 – 镜像HTML元素,可能使用shadow DOM

我希望在页面上的多个位置呈现“相同”的

HTML元素.

此元素是脚本/动画的,各种渲染需要保持同步.

我考虑过的解决方案包括:

>将元素的副本放在多个位置并更新所有元素.这就是我想要避免的.

>将元素的副本放在多个位置.更新其中一个副本,并使用突变事件捕获这些更改并将其重放到其他副本.好像很多工作.

>使用shadow DOM.我对这个替代方案寄予厚望,最初似乎是可能的,使用“插入点”,允许这里的DOM子树虚拟放置在那里的DOM子树中.

One case that deserves special consideration is the situation when an

insertion point is a child node of another shadow host…The effect of a node being

distributed into more than one insertion point is called reprojection.

但是之后…

Despite being distributed to more than one insertion point during

reprojection,a node is still only rendered once,because of the

constraints under which the reprojection occurs: since the insertion

points are only subject to reprojection when they are children of a

shadow host,they are never rendered. Instead the shadow tree is

rendered in their place.

是否有可能影子DOM可能做我想要的并且值得测试,或者是否有其他推荐的方法?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值