Index: third_party/polymer/v0_8/components/more-routing/more-route-selector.html |
diff --git a/third_party/polymer/v0_8/components/more-routing/more-route-selector.html b/third_party/polymer/v0_8/components/more-routing/more-route-selector.html |
index 9ad19070ef60f64aeb597318aae9963259917643..c45a1937b9d72e4dce5a724de95c21c42ef8f3cf 100644 |
--- a/third_party/polymer/v0_8/components/more-routing/more-route-selector.html |
+++ b/third_party/polymer/v0_8/components/more-routing/more-route-selector.html |
@@ -127,6 +127,7 @@ Polymer({ |
* defined by the current URL. |
*/ |
_onSelectedItemChanged: function(event) { |
+ if (this._settingSelection) return; |
var route = this._routeForItem(event.detail.value); |
if (!route) return; |
route.navigateTo(); |
@@ -142,8 +143,23 @@ Polymer({ |
_onMoreRouteChange: function(event) { |
if (!this._managedSelector) return; |
- var route = event.detail.newRoute; |
- this._managedSelector.select(this.routes.indexOf(route)); |
+ |
+ var selected = ''; |
+ |
+ var index = this.routes.indexOf(event.detail.newRoute); |
+ var attrForSelected = this._managedSelector.attrForSelected; |
+ if (!attrForSelected) { |
+ selected = index; |
+ } else { |
+ var item = this._managedSelector.items[index]; |
+ if (item) |
+ selected = item[attrForSelected] || item.getAttribute(attrForSelected); |
+ } |
+ |
+ // Make sure that we don't turn around and re-navigate |
+ this._settingSelection = true; |
+ this._managedSelector.select(selected); |
+ this._settingSelection = false; |
}, |
_findTargetSelector: function() { |