I am having huge difficulty to implement simple dropdown list with Polymer 0.5.
I am also parallel migrating from Polymer .5 to 1.0. But that is separate discussion ( Migrating Polymer project .5 to 1.0 error).
Here is the code I am using to define polymer element inside body:
<polymer-element name="x-trigger" extends="paper-icon-button" relative="" on-tap="{{toggle}}" noink="">
<template>
<shadow></shadow>
<content></content>
</template>
</polymer-element>
I am using the element further down the body like this:
<x-trigger icon="menu" relative="" noink="" role="button" tabindex="0" aria-label="menu">
<paper-dropdown tabindex="-1" class="core-transition" style="outline: none; display: none;">
halign = left
<br>
valign = top
</paper-dropdown>
</x-trigger>
I defined following script section in the head section of the page:
<script>
Polymer('x-trigger', {
toggle: function () {
if (!this.dropdown) {
this.dropdown = this.querySelector('paper-dropdown');
}
this.dropdown && this.dropdown.toggle();
}
});
</script>
The problem is, I do see the icon button in the page but when ever I click on that button, nothing happens.
Further debugging revealed,
- If I open the console debugger in chrome and
- Place break point on Polymer or inside toggle method in the script section
- Do page refresh
- Break point gets hit and drop-down works
I don’t know what is causing the issue
Update: While debugging i got the following error in the line:
Polymer('x-trigger', {
/deep/ combinator is deprecated
Does this mean that i have to upgrade to polymer v1 to resolve this issue or is their any workaround for polymer 0.5?