Index: lib/src/iron-selector/iron-selectable.html |
diff --git a/lib/src/iron-selector/iron-selectable.html b/lib/src/iron-selector/iron-selectable.html |
index 26bb2655148af3dbcabcee0601b249e545c9b120..eb1fb5fd431ab6e2548b92892004477d3143cad4 100644 |
--- a/lib/src/iron-selector/iron-selectable.html |
+++ b/lib/src/iron-selector/iron-selectable.html |
@@ -56,8 +56,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
/** |
* Gets or sets the selected element. The default is to use the index of the item. |
- * |
- * @type {string|number} |
*/ |
selected: { |
type: String, |
@@ -107,12 +105,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
}, |
/** |
- * The set of excluded elements where the key is the `localName` |
+ * The set of excluded elements where the key is the `localName` |
* of the element that will be ignored from the item list. |
* |
+ * @type {object} |
* @default {template: 1} |
*/ |
- excludedLocalNames: { |
+ _excludedLocalNames: { |
type: Object, |
value: function() { |
return { |
@@ -129,11 +128,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
created: function() { |
this._bindFilterItem = this._filterItem.bind(this); |
this._selection = new Polymer.IronSelection(this._applySelection.bind(this)); |
+ // TODO(cdata): When polymer/polymer#2535 lands, we do not need to do this |
+ // book keeping anymore: |
+ this.__listeningForActivate = false; |
}, |
attached: function() { |
this._observer = this._observeItems(this); |
this._contentObserver = this._observeContent(this); |
+ if (!this.selectedItem && this.selected) { |
+ this._updateSelected(this.attrForSelected,this.selected) |
+ } |
+ this._addListener(this.activateEvent); |
}, |
detached: function() { |
@@ -200,11 +206,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
}, |
_addListener: function(eventName) { |
+ if (!this.isAttached || this.__listeningForActivate) { |
+ return; |
+ } |
+ |
+ this.__listeningForActivate = true; |
this.listen(this, eventName, '_activateHandler'); |
}, |
_removeListener: function(eventName) { |
this.unlisten(this, eventName, '_activateHandler'); |
+ this.__listeningForActivate = false; |
}, |
_activateEventChanged: function(eventName, old) { |
@@ -221,7 +233,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
}, |
_filterItem: function(node) { |
- return !this.excludedLocalNames[node.localName]; |
+ return !this._excludedLocalNames[node.localName]; |
}, |
_valueToItem: function(value) { |