How can I use: first-child w / shadow selector DOM <content>?

I would like to extract the first paragraph from the content of the user element (as a summary). I 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>

Unfortunately, <content select="p:first-child">does not match anything :(

Here is the corresponding code .

+4
source share
1 answer

In the specification, the Shadow DOM only supports :not(): http://w3c.imtqy.com/webcomponents/spec/shadow/#dfn-matching-criteria

Corresponding error: http://crbug.com/343332

+4
source

Source: https://habr.com/ru/post/1543482/


All Articles