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

Unified 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: changed width of iframe for pirate badge app 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/tests/site/code/futures.dart ('k') | src/tests/site/code/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/tests/site/code/htmllib.dart
diff --git a/src/tests/site/code/htmllib.dart b/src/tests/site/code/htmllib.dart
new file mode 100644
index 0000000000000000000000000000000000000000..314e06a15fafc5e09bd66b039d8bca8aa117cd65
--- /dev/null
+++ b/src/tests/site/code/htmllib.dart
@@ -0,0 +1,20 @@
+import 'dart:html';
+import 'dart:convert' show JSON;
+
+void main() {
+ querySelector('#getColors').onClick.listen(showColors); // Event handling.
+}
+void showColors(Event e) {
+ HttpRequest.getString('colors.json') // One-line HTTP request.
+ .then((String jsonString) { // Uses Futures and Streams.
+ UListElement colors = querySelector('#colors'); // DOM element types.
+ List colorList = JSON.decode(jsonString);
+ for (int i = 0; i < colorList.length; i++) {
+ colors.children.add( // Dynamic DOM manipulation.
+ new LIElement()..text = colorList[i] // Dynamic element creation.
+ ..style.color = colorList[i] // Uniform CSS styles.
+ ..style.fontFamily = 'Marker Felt');
+ }
+ })
+ .catchError((_) { /* Handle error. */ });
+}
« no previous file with comments | « src/tests/site/code/futures.dart ('k') | src/tests/site/code/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698