Attempting to fill the Polymer <content> </content> element with an extended element

I have two elements: one element <drop-down>, another element <populated-drop-down>. populated-drop-down extends drop-downbut, as you might have guessed, trying to pre-populate it with some parameters. It was assumed that I could just put the HTML inside the tag <shadow></shadow>, but this does not work:

<polymer-element name="drop-down" noscript attributes="label">
  <template>
    <style>
      :host{display:inline-block;border:1px solid;padding:1rem}
      #content{position:absolute}
      #drop, #content {display:none}
      #drop:checked + #content {display:block}
    </style>
    <label for="drop">{{label}}</label>
    <input type="checkbox" id="drop">
    <div id="content"><content></content></div>
  </template>
</polymer-element>


<polymer-element name="pop-drop-down" extends="drop-down" noscript>
  <template>
    <shadow>
      <ul>
         <li>Option1</li>
         <li>Option2</li>
         <li>Option3</li>
         <li>Option4</li>
         <li>Option5</li>
      </ul>
    </shadow>
  </template>
</polymer-element>


<drop-down label="Working DropDown">
      <ul>
         <li>Option1</li>
         <li>Option2</li>
         <li>Option3</li>
         <li>Option4</li>
         <li>Option5</li>
      </ul>
</drop-down>

<pop-drop-down label="Not working pre-populated dropdown">
</pop-drop-down>

( Code is also available for code in JSBin .)

It seems I can wrap extra tags around <shadow></shadow>, but not put inside<shadow></shadow>

+4
source share

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


All Articles