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

Side by Side Diff: recipes/web/html/creating_elements.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 unified diff | Download patch
« no previous file with comments | « no previous file | recipes/web/html/inserting_elements.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2
3 <html>
4 <div class='container'></div>
5 <body>
6 <script type="application/dart">
7
8 import 'dart:html';
9
10 void main() {
11
12 // Creating a specific element
13 LIElement item = new LIElement();
14 item.text = 'Mango';
15 assert(item is LIElement);
16 assert(item.innerHtml == 'Mango');
17
18 // Using the Element.html() constructor.
19 assert(new Element.html('<div>I love Strawberries.</div>') is DivElement );
20
21 // Using the Element.tag() constructor
22 var td = new Element.tag('td');
23 td.text = 'guava';
24 assert(td is TableCellElement);
25
26 // Using an invalid tag.
27 assert(new Element.tag('bogusTag') is UnknownElement);
28 assert(Element.isTagSupported('bogusTag') == false);
29
30 // Using another element's outerHtml.
31 var containerDiv = query('div.container');
32 var newDiv = new Element.html(containerDiv.outerHtml);
33 assert(newDiv is DivElement);
34 assert(newDiv.innerHtml == containerDiv.innerHtml);
35 }
36 </script>
37
38
39 <script src="packages/browser/dart.js"></script>
40 </body>
41 </html>
OLDNEW
« no previous file with comments | « no previous file | recipes/web/html/inserting_elements.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698