如何使用带有阴影DOM的< content>的:first-child选择器元素? [英] How can I use the :first-child selector w/ shadow DOM's <content> element?
本文介绍了如何使用带有阴影DOM的< content>的:first-child选择器元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从自定义元素的内容中提取第一段(作为摘要).我希望以下方法能起作用:
I'd like to extract the first paragraph from a custom element's content (as a summary). I would expect the following to work:
<polymer-element name="x-thing" noscript>
<template>
<segment class="summary">
<content select="p:first-child"></content>
</segment>
<segment>
<content></content>
</segment>
</template>
</polymer-element>
不幸的是,<content select="p:first-child">
似乎与任何内容都不匹配:(
Unfortunately, the <content select="p:first-child">
doesn't appear to match anything :(
推荐答案
Only :not()
is supported in the Shadow DOM spec: http://w3c.github.io/webcomponents/spec/shadow/#dfn-matching-criteria
相关错误: http://crbug.com/343332
这篇关于如何使用带有阴影DOM的< content>的:first-child选择器元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文