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

Unified Diff: recipes/web/html/scoped_selectors.html

Issue 14109034: Recipes for using CSS Selectors with dart:html (Closed) Base URL: https://github.com/dart-lang/cookbook.git@master
Patch Set: Changes based on Kathy's comments. Created 7 years, 7 months 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 | « recipes/web/html/replacing_children.html ('k') | recipes/web/html/selector_with_scope.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipes/web/html/scoped_selectors.html
diff --git a/recipes/web/html/scoped_selectors.html b/recipes/web/html/scoped_selectors.html
new file mode 100644
index 0000000000000000000000000000000000000000..46a453ba4e86266bd8eb9cfe14ae69b4723f849a
--- /dev/null
+++ b/recipes/web/html/scoped_selectors.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+
+<html>
+ <body>
+ <table>
+ <tr><td>Jose</td><td class='status'>Accepted</td></tr>
+ <tr><td>Marie</td><td class='status'>Accepted</td></tr>
+ <tr><td>Kwame</td><td class='status'>Accepted</td></tr>
+ <tr><td>Rohan</td><td class='status'>Accepted</td></tr>
+ </table>
+
+ <script type="application/dart">
+ import 'dart:html';
+
+ void main() {
+ queryAll('tr').forEach((element) {
+ element.onClick.listen((event) {
+ var record = event.currentTarget.query('.status');
+ record.text = record.text == 'Accepted' ? 'Declined' : 'Accepted';
+ });
+ });
+ }
+ </script>
+ <script src="packages/browser/dart.js"></script>
+ </body>
+</html>
« no previous file with comments | « recipes/web/html/replacing_children.html ('k') | recipes/web/html/selector_with_scope.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698