OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html lang="en"> | 7 <html lang="en"> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 10 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
11 <title>watch_global_var_test</title> | |
12 <script type='application/javascript' src="testing.js"></script> | 11 <script type='application/javascript' src="testing.js"></script> |
13 </head> | 12 </head> |
14 <body> | 13 <body> |
15 <p>The href of these links should match:</p> | 14 <p>The href of these links should match:</p> |
16 <a href="#The "quick" \brown $fox jumps over the 'lazy' dog."> | 15 <a href="#The "quick" \brown $fox jumps over the 'lazy' dog."> |
17 first link</a> | 16 first link</a> |
18 <a href="#The "quick" \brown $fox {{j1}} over {{j2}} 'lazy' {{"
${'dog'}"}}."> | 17 <a href="#The "quick" \brown $fox {{j1}} over {{j2}} 'lazy' {{"
${'dog'}"}}."> |
19 second link</a> | 18 second link</a> |
20 <p>Here are the hrefs as text:</p> | 19 <p>Here are the hrefs as text:</p> |
21 <!-- Use data binding to display our data binding. We must go deeper. --> | 20 <!-- Use data binding to display our data binding. We must go deeper. --> |
22 <pre>{{tryQuery('a', 0, (e) => e.hash)}}</pre> | 21 <pre>{{tryQuery('a', 0, (e) => e.hash)}}</pre> |
23 <pre>{{tryQuery('a', 1, (e) => e.hash)}}</pre> | 22 <pre>{{tryQuery('a', 1, (e) => e.hash)}}</pre> |
24 <script type="application/dart"> | 23 <script type="application/dart"> |
25 import 'dart:html'; | 24 import 'dart:html'; |
26 import 'package:web_ui/watcher.dart'; | 25 import 'package:web_ui/observe.dart'; |
27 | 26 |
28 final j1 = 'jumps'; | 27 @observable var j1 = 'jumps'; |
29 final j2 = 'the'; | 28 @observable var j2 = 'the'; |
30 final fox = 'Your escaping is bad and you should feel bad!'; | 29 @observable var fox = 'Your escaping is bad and you should feel bad!'; |
31 main() { | 30 main() { |
32 window.setTimeout(() { | 31 window.setTimeout(() => window.postMessage('done', '*'), 0); |
33 dispatch(); | |
34 window.setTimeout(() => window.postMessage('done', '*'), 0); | |
35 }, 0); | |
36 } | 32 } |
37 | 33 |
38 tryQuery(String selector, int i, void callback(elem)) { | 34 tryQuery(String selector, int i, void callback(elem)) { |
39 var result = queryAll(selector); | 35 var result = queryAll(selector); |
40 if (result.length > i) return callback(result[i]); | 36 if (result.length > i) return callback(result[i]); |
41 return null; | 37 return null; |
42 } | 38 } |
43 </script> | 39 </script> |
44 </body> | 40 </body> |
45 </html> | 41 </html> |
OLD | NEW |