I ran into some interesting behavior that raised some questions.

I wrote an element that takes a list of nodes as children, shows one at a 
time, and allows switching which one is visible.

<state-manager>
  <state-one statename="home" initial></state-one>
  <state-two statename="shop" ></state-two>
  <state-three statename="checkout"></state-three>
</state-manager>


The state manager has interface that lets you select a state to be active. 
 To do that, it takes the requested child element and inserts it into it's 
shadowDOM template.

Here's a working example:
http://jsbin.com/EleTuCO/6/edit
You click the button, and the cat-in-hat switches between it's things.

This Bin is the same as the last, except it doesn't remove the children 
from normal DOM before attaching them inside:
http://jsbin.com/OLOfANuH/2/edit

It looks like Polymer lets me have the element in two places, which I would 
think illegal.  The initial node isn't properly removed when switching the 
first time, so both show up, and when you click the button often enough, 
everything falls apart.  The bins are using Polymer 0.1.1, but it did the 
same with 0.1.2.

I'm wondering if Platform shouldn't warn me when I try to have a single 
node exist both in normal DOM and in the element's shadow?

This also made me wonder about how node distribution with 
<content></content> works.  Does Platform pull the nodes out of normal DOM 
before distributing them in the shadow, or clone them, or is it really 
legal for that node to be in two document fragments at the same time?

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to