| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library router_options; | 5 library router_options; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Given a set of child links to this page, this will add the "selected" CSS | 11 * Given a set of child links to this page, this will add the "selected" CSS |
| 12 * class to the link that matches window.location.hash. | 12 * class to the link that matches window.location.hash. |
| 13 * | 13 * |
| 14 * For example, if the current window.location.hash is "#/completed" and we | 14 * For example, if the current window.location.hash is "#/completed" and we |
| 15 * have a tag like `<a href="#/completed">` it will get the class | 15 * have a tag like `<a href="#/completed">` it will get the class |
| 16 * `class="selected"`, and other links will have that CSS class removed. | 16 * `class="selected"`, and other links will have that CSS class removed. |
| 17 */ | 17 */ |
| 18 @CustomTag('router-options') |
| 18 class RouterOptions extends PolymerElement { | 19 class RouterOptions extends PolymerElement { |
| 19 | 20 |
| 20 bool get applyAuthorStyles => true; | 21 bool get applyAuthorStyles => true; |
| 21 var _sub; | 22 var _sub; |
| 22 | 23 |
| 23 void inserted() { | 24 void inserted() { |
| 24 super.inserted(); | 25 super.inserted(); |
| 25 | 26 |
| 26 var anchors = this.queryAll('a'); | 27 var anchors = this.queryAll('a'); |
| 27 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 _updateHash(null); | 41 _updateHash(null); |
| 41 _sub = windowLocation.changes.listen(_updateHash); | 42 _sub = windowLocation.changes.listen(_updateHash); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void removed() { | 45 void removed() { |
| 45 _sub.cancel(); | 46 _sub.cancel(); |
| 46 super.removed(); | 47 super.removed(); |
| 47 } | 48 } |
| 48 } | 49 } |
| OLD | NEW |