ITKeyword,专注技术干货聚合推荐

注册 | 登录

解决Extend polymer element - access parent content

itPublisher 分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

【阿里云】双十一活动,全年抄底价,限时3天!(老用户也有),
入口地址https://www.aliyun.com/1111/home

I have the following polymer:

<polymer-element name="popup-element" attributes="popupStyle">
    <template>
        <div class="popup" id="popup" style="{{popupStyle}}">
            <div class="closebutton"></div>
            <content select=".title"></content>
            <br /><br />
            <content></content>
        </div>
    </template>
    <script type="text/javascript">
        Polymer('popup-element');
    </script>
</polymer-element>

Now I want to extend it in another polymer:

<polymer-element name="newfolder-element" attributes="popupStyle" extends="popup-element">
    <template>
        <shadow>
            <span class="title">Utwórz nowy folder</span>
            <input type="text" class="ginput" style="width: 350px; padding: 5px;" placeholder="Nowy katalog" />
            <br />
            <button class="action blue"><span class="label">Utwórz</span></button>
            <button class="action red" id="cancelBtn" on-click="{{closePopup}}"><span class="label">Anuluj</span></button>
            <content></content>
        </shadow>
    </template>
    <script>
        Polymer('newfolder-element');
    </script>

</polymer-element>

Why content between <shadow> and </shadow> doesn't appear. I want to place content of <shadow> ... </shadow> (child element) to <content></content> of parent element. How to make it working ?

polymer
|
  this question
edited Aug 6 '14 at 19:32 asked Aug 6 '14 at 18:53 Mother Lover 47 7

 | 

2 Answers
2

解决方法

This used to be supported, but due to implementation concerns, it was removed. It will most likely be added in a future revision to the Shadow DOM spec.

Update: Here's a possible interim solution to this problem.


|
  this answer
edited Feb 20 '15 at 18:39 answered Aug 7 '14 at 21:02 CletusW 2,558 1 14 26

 | 

This almost makes the extends feature useless for template inheritance! I take a look at all the core-elements and paper-elements, rarely are they reusing templates from their base element. To get around this limitation I have to use a preprocessor like jade to mix-in partials. But if polymer or the spec can support this, it will be much more convenient. A little bit frustrating that I need to spend so much time just to fix something that should be there.


|
  this answer
answered Mar 12 '15 at 23:13 MrW 31 1 5

 | 


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。