Chromium Code Reviews| 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 todomvc.web.router_options; | 5 library todomvc.web.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 @CustomTag('router-options') |
| 19 class RouterOptions extends PolymerElement { | 19 class RouterOptions extends UListElement with Polymer, ObservableMixin { |
| 20 | 20 RouterOptions.created() : super.created() { |
| 21 factory RouterOptions() => new Element.tag('router-options'); | 21 polymerCreated(); |
|
Jennifer Messerly
2013/10/17 02:04:35
even though it's unused, should we keep this to sh
Siggi Cherem (dart-lang)
2013/10/17 02:37:40
Done. Now it becomes:
factory RouterOptions() => n
| |
| 22 | 22 } |
| 23 RouterOptions.created() : super.created(); | |
| 24 | 23 |
| 25 bool get applyAuthorStyles => true; | 24 bool get applyAuthorStyles => true; |
| 26 var _sub; | 25 var _sub; |
| 27 | 26 |
| 28 void enteredView() { | 27 void enteredView() { |
| 29 super.enteredView(); | 28 super.enteredView(); |
| 30 | 29 |
| 31 var anchors = this.queryAll('a'); | 30 var anchors = this.queryAll('a'); |
| 32 | 31 |
| 33 _updateHash(records) { | 32 _updateHash(records) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 44 | 43 |
| 45 _updateHash(null); | 44 _updateHash(null); |
| 46 _sub = windowLocation.changes.listen(_updateHash); | 45 _sub = windowLocation.changes.listen(_updateHash); |
| 47 } | 46 } |
| 48 | 47 |
| 49 void leftView() { | 48 void leftView() { |
| 50 _sub.cancel(); | 49 _sub.cancel(); |
| 51 super.leftView(); | 50 super.leftView(); |
| 52 } | 51 } |
| 53 } | 52 } |
| OLD | NEW |