Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address polymer-elements that take child elements #337

Closed
jyasskin opened this issue Nov 3, 2013 · 1 comment
Closed

Address polymer-elements that take child elements #337

jyasskin opened this issue Nov 3, 2013 · 1 comment

Comments

@jyasskin
Copy link

jyasskin commented Nov 3, 2013

The documentation has a lot of examples of polymer-elements with attributes, but aside from mentioning that child elements are possible at http://www.html5rocks.com/en/tutorials/webcomponents/customelements/, I don't see anything about how to use the templating engine to generate different shadow-dom based on the child elements of the polymer-element.

For example, maybe I want to implement the dateRangePicker from http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/#toc-projection. Or maybe I want to generate a shadow-table whose rows depend on which child elements are present, but then use <content select> to attach those child elements.

@sorvell
Copy link
Contributor

sorvell commented Aug 11, 2014

The simplest way to control what is rendered in a shadowRoot via templating is to use <template if>.

Note that a shadowRoot is generated for each element form which the element extends. To customize this behavior and control what's stamped into the element's shadowRoot, you can implement parseDeclarations and call this.shadowFromTemplate(template).

@sorvell sorvell closed this as completed Aug 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants