dart - 嵌套 polymer 模板继承

标签 dart dart-polymer polymer web-component shadow-dom

有没有办法用其父模板包围 polymer 子模板?

在下面的示例中,shadow 标签将父 View 的模板带入 subview ,但它忽略了其内容:

母体 polymer 元件

<polymer-element name="my-window">
  <template>
    <div class="windowframe">
      <p>test</p> <!-- can be shown with shadow tag -->
      <content></content> <!-- cannot be used with shadow tag -->

子 polymer 元件

<polymer-element name="my-window-example" extends="my-window">
  <template>
    <!-- get the hosts' shadow and insert here -->
    <shadow>
       <p>Here is the content of my window<p> <!--won't be shown -->
    </shadow>
  </template>

最佳答案

这曾经在 Chrome Canary 中是可能的(请参阅 this blog postthis discussionthe fixed spec bugthe fixed Chromium bug ),但不幸的是,它在 Linux 或 Linux 上的 Chrome 33.0.1750.22 dev 中似乎不再适用于我Windows 上的 Chrome 34.0.1809.0 canary 启用或关闭“启用实验性 Web 平台功能”标志。试试 this jsbin看看它是否适合你。

更新 :Confirmed .由于“实现问题”,此功能已从 Chrome 中 Shadow DOM 的初始实现中删除。

关于dart - 嵌套 polymer 模板继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21395702/

相关文章:

flutter - 在 Flutter 中检测我们何时移回上一页

dart - 如何向 Dart 类添加 getter,并在其构造函数上使用命名参数?

dart - 从 Dart 中的其他 Web 组件访问状态

seo - Google 抓取工具是否在索引之前等待页面完成?

javascript - 当一组 polymer 纸张切换按钮中的一个被按下时触发事件

localization - app-localize-behavior 和共享本地化缓存

flutter - 如何通过 dart 中的另一个项目列表搜索对象列表

firebase - 完成错误 : Gradle task assembleDebug failed with exit code 1

custom-controls - 以编程方式创建特殊的 polymer 元素

dart - 如何从Dart书架式静态文件处理程序为聚合物应用程序提供服务?