Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: third_party/polymer/v0_8/components/more-routing/more-route-selector.html

Issue 1140393002: Update more-routing for md-settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698