OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #import('dart:html'); | 5 import 'dart:html'; |
6 | 6 |
7 // Utility functions: | 7 // Utility functions: |
8 String safeHTML(String value) { | 8 String safeHTML(String value) { |
9 // TODO(terry): TBD | 9 // TODO(terry): TBD |
10 return value; | 10 return value; |
11 } | 11 } |
12 | 12 |
13 /* Data Model */ | 13 /* Data Model */ |
14 class Friend { | 14 class Friend { |
15 String name; | 15 String name; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 document.body.elements.add(clickableFriend.root); | 234 document.body.elements.add(clickableFriend.root); |
235 clickableFriend.friendElem.on.click.add((e) { | 235 clickableFriend.friendElem.on.click.add((e) { |
236 var elemStyle = e.srcElement.style; | 236 var elemStyle = e.srcElement.style; |
237 String toggleColor = elemStyle.getPropertyValue("background-color") == "red"
? "white" : "red"; | 237 String toggleColor = elemStyle.getPropertyValue("background-color") == "red"
? "white" : "red"; |
238 elemStyle.setProperty("background-color", "${toggleColor}"); | 238 elemStyle.setProperty("background-color", "${toggleColor}"); |
239 }); | 239 }); |
240 | 240 |
241 // Calling template inside of a template: | 241 // Calling template inside of a template: |
242 // document.body.elements.add(new Templates(friends).root); | 242 // document.body.elements.add(new Templates(friends).root); |
243 } | 243 } |
OLD | NEW |