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

Side by Side Diff: pkg/observe/lib/html.dart

Issue 26734004: use symbol literals instead of const ctor in packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/mdv/test/template_element_test.dart ('k') | pkg/observe/lib/observe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(jmesserly): can we handle this more elegantly? 5 // TODO(jmesserly): can we handle this more elegantly?
6 // In general, it seems like we want a convenient way to take a Stream plus a 6 // In general, it seems like we want a convenient way to take a Stream plus a
7 // getter and convert this into an Observable. 7 // getter and convert this into an Observable.
8 8
9 /** Helpers for exposing dart:html as observable data. */ 9 /** Helpers for exposing dart:html as observable data. */
10 library observe.html; 10 library observe.html;
(...skipping 23 matching lines...) Expand all
34 * Has no effect if the [value] already equals [window.location.hash]. 34 * Has no effect if the [value] already equals [window.location.hash].
35 */ 35 */
36 void set hash(String value) { 36 void set hash(String value) {
37 if (value == hash) return; 37 if (value == hash) return;
38 38
39 window.history.pushState(null, '', value); 39 window.history.pushState(null, '', value);
40 _notifyHashChange(null); 40 _notifyHashChange(null);
41 } 41 }
42 42
43 void _notifyHashChange(_) { 43 void _notifyHashChange(_) {
44 notifyChange(new PropertyChangeRecord(const Symbol('hash'))); 44 notifyChange(new PropertyChangeRecord(#hash));
45 } 45 }
46 } 46 }
47 47
48 /** Add or remove CSS class [className] based on the [value]. */ 48 /** Add or remove CSS class [className] based on the [value]. */
49 void updateCssClass(Element element, String className, bool value) { 49 void updateCssClass(Element element, String className, bool value) {
50 if (value == true) { 50 if (value == true) {
51 element.classes.add(className); 51 element.classes.add(className);
52 } else { 52 } else {
53 element.classes.remove(className); 53 element.classes.remove(className);
54 } 54 }
55 } 55 }
56 56
57 /** Bind a CSS class to the observable [object] and property [path]. */ 57 /** Bind a CSS class to the observable [object] and property [path]. */
58 PathObserver bindCssClass(Element element, String className, 58 PathObserver bindCssClass(Element element, String className,
59 Observable object, String path) { 59 Observable object, String path) {
60 60
61 return new PathObserver(object, path)..bindSync((value) { 61 return new PathObserver(object, path)..bindSync((value) {
62 updateCssClass(element, className, value); 62 updateCssClass(element, className, value);
63 }); 63 });
64 } 64 }
OLDNEW
« no previous file with comments | « pkg/mdv/test/template_element_test.dart ('k') | pkg/observe/lib/observe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698