-
Notifications
You must be signed in to change notification settings - Fork 49
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
PaperDropdownMenu fails after initial import #145
Comments
Creating a Widget using the individual Elements (rather than trying to use the generated Polymer Widgets) seems to work fine: <paper-dropdown-menu-light no-label-float="" class="custom">
<paper-listbox ui:field="menu" class="dropdown-content" selected="0">
<paper-item>25</paper-item>
<paper-item>50</paper-item>
<paper-item>100</paper-item>
</paper-listbox>
</paper-dropdown-menu-light> |
It has to do with how the UiBinder is building the DOM tree. Using Elements inside the Dropdown like:
will be generated to:
with template_html1() like Using a Widget inside the Dropdown like:
will be generated to:
In this case the template_html2() is just a SPAN holding an Id: The error happens because get_domId1Element() returns a LazyDomElement and when calling the get()-method there is no element with this id. The strange thing about this all is that this does not happen in general. It happens just for some Widgets like PaperDrawerPanel or PaperDropdownMenu and only if these Components are already registered (Polymer.isRegisteredElement returns true) |
Ok, things become clearer.
Since the DomId-Holder from the UiBinder is just a SPAN-element without the class dropdown-content the element will be dropped while attaching to the DOM and then the LazyDomElement can't find this element anymore. Simple Test:
Without the class the span is missing after rendering in the browser. Since the Vaadin PolymerWidget saves and restores the element properties when the webcomponent has to be downloaded first the effect may occur only on already registered components. Conclusion: Using elements inside a webcomponent seems to be the way to go. |
I wonder if it'd be possible to specify for certain widgets (like In my case, I don't really care about |
Sorry, my assumption seems wrong. It has nothing to do with this properties save /restore but more with the fact that when the webcomponent is not loaded yet it is just a HTMLUnknownElement (without any content selector) and therefore the widget placeholder (SPAN element) is still alive. It has more to do with the webcomponent lifecycle (point of registration) |
The demo app works fine, since all dropdowns are limited to the same page...
However, if you have two pages with dropdowns, you'll notice something like the following error when opening the second page (whichever page is the second one you load):
This also occurs on the initial page load if you have statically linked the
paper-dropdown-menu.html
.This issue may be what was truly behind #85
The text was updated successfully, but these errors were encountered: