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

Side by Side Diff: src/tests/site/code/htmllib.dart

Issue 83663005: added front page samples to testing, plus a couple of tweaks to front page and code lab (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: put front page code snippets under testing, minor tweaks, fixed carousel height problem Created 7 years, 1 month 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
OLDNEW
(Empty)
1 import 'dart:html';
2 import 'dart:convert' show JSON;
3
4 void main() {
5 querySelector('#getColors').onClick.listen(showColors); // Event handling.
6 }
7 void showColors(Event e) {
8 HttpRequest.getString('colors.json') // One-line HTTP request.
9 .then((String jsonString) { // Uses Futures and Streams.
10 UListElement colors = querySelector('#colors'); // DOM element types.
11 List colorList = JSON.decode(jsonString);
12 for (int i = 0; i < colorList.length; i++) {
13 colors.children.add( // Dynamic DOM manipulation.
14 new LIElement()..text = colorList[i] // Dynamic element creation.
15 ..style.color = colorList[i] // Uniform CSS styles.
16 ..style.fontFamily = 'Marker Felt');
17 }
18 })
19 .catchError((_) { /* Handle error. */ });
20 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698