| OLD | NEW |
| 1 # Polymer TodoMVC Example | 1 TodoMVC sample application written with the |
| 2 [Polymer.dart package][polymer-dart], which includes |
| 3 custom elements and data binding. |
| 2 | 4 |
| 3 > Build structured, encapsulated, client-side web apps with Dart and web compone
nts. | 5 To run this code with Dartium, launch `web/index.html`. |
| 4 | 6 |
| 5 > _[Polymer.dart](https://www.dartlang.org/polymer-dart/)_ | 7 To run this code with Chrome/Firefox/etc, run `build.dart` first, |
| 8 and then right-click on `out/web/index.html` and select 'Run as JavaScript'. |
| 6 | 9 |
| 7 > Polymer is a new type of library for the web, built on top of Web Components,
and designed to leverage the evolving web platform on modern browsers. | 10 Generated code will be created under "out/web/". Any time you edit and save a |
| 11 source file, the necessary files will be regenerated automatically. Look at |
| 12 `build.dart` to see how this works. |
| 8 | 13 |
| 9 > _[Polymer - www.polymer-project.org](http://www.polymer-project.org/)_ | 14 View the [source][source] for this example. |
| 10 | 15 |
| 11 ## Learning Polymer | 16 Please report any [bugs or feature requests][bugs]. |
| 12 | 17 |
| 13 The [Polymer.dart website](https://www.dartlang.org/polymer-dart/) is a great re
source for getting started. | 18 [polymer-dart]: http://www.dartlang.org/polymer-dart/ |
| 14 | 19 [source]: https://code.google.com/p/dart/source/browse/branches/bleeding_edge/da
rt/samples/third_party/todomvc/ |
| 15 Get help from Polymer devs and users: | 20 [bugs]: http://dartbug.com/new |
| 16 | |
| 17 * Join the high-traffic [web-ui](https://groups.google.com/a/dartlang.org/forum/
#!forum/web-ui) Google group. | |
| 18 * As questions on [Stack Overflow](http://stackoverflow.com/tags/dart-polymer) | |
| 19 | |
| 20 ## Implementation | |
| 21 | |
| 22 The Polymer implementation of TodoMVC has a few key differences with other imple
mentations: | |
| 23 | |
| 24 * Since [Web Components](https://dvcs.w3.org/hg/webcomponents/raw-file/tip/expla
iner/index.html) allow you to create new types of DOM elements, the DOM tree is
very different from other implementations. | |
| 25 * The template, styling, and behavior are fully encapsulated in each custom elem
ent. Instead of having an overall stylesheet (`base.css` or `app.css`), each ele
ment that needs styling has its own stylesheet. | |
| 26 * Non-visual elements such as the router and the model are also implemented as c
ustom elements and appear in the DOM. Implementing them as custom elements inste
ad of plain objects allows you to take advantage of Polymer data binding and eve
nt handling throughout the app. | |
| 27 | |
| 28 ## Running this sample | |
| 29 | |
| 30 To run in Dartium (Chrome with Dart VM): | |
| 31 | |
| 32 1. Right click on web/index.html and choose "Run in Dartium" | |
| 33 | |
| 34 To run in other browsers (such as Firefox, Internet Explorer, Safari, Chrome): | |
| 35 | |
| 36 1. Right click on pubspec.yaml and choose "Pub Build" | |
| 37 2. After build finishes, expand the "build" directory | |
| 38 3. Right click on index.html and choose "Run as JavaScript" | |
| OLD | NEW |