OLD | NEW |
1 --- | 1 --- |
2 layout: default | 2 layout: default |
3 title: "Improving the DOM" | 3 title: "Improving the DOM" |
4 rel: | 4 rel: |
5 author: bob-nystrom | 5 author: bob-nystrom |
6 description: "Learn how Dart's HTML library improves the browser programming exp
erience." | 6 description: "Learn how Dart's HTML library improves the browser programming exp
erience." |
7 has-permalinks: true | 7 has-permalinks: true |
8 --- | 8 --- |
9 | 9 |
10 <h1>Improving the DOM</h1> | 10 <h1>Improving the DOM</h1> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // Old: | 84 // Old: |
85 elem.hasAttribute('name'); | 85 elem.hasAttribute('name'); |
86 elem.getAttribute('name') | 86 elem.getAttribute('name') |
87 elem.setAttribute('name', 'value'); | 87 elem.setAttribute('name', 'value'); |
88 elem.removeAttribute('name'); | 88 elem.removeAttribute('name'); |
89 </pre> | 89 </pre> |
90 </td> | 90 </td> |
91 <td width="50%"> | 91 <td width="50%"> |
92 <pre> | 92 <pre> |
93 // New: | 93 // New: |
94 elem.attributes.contains('name'); | 94 elem.attributes.containsKey('name'); |
95 elem.attributes['name']; | 95 elem.attributes['name']; |
96 elem.attributes['name'] = 'value'; | 96 elem.attributes['name'] = 'value'; |
97 elem.attributes.remove('name'); | 97 elem.attributes.remove('name'); |
98 </pre> | 98 </pre> |
99 </td> | 99 </td> |
100 </tr> | 100 </tr> |
101 </table> | 101 </table> |
102 | 102 |
103 <p>Likewise, by making <code>nodes</code> and <code>elements</code> full-feature
d collections, we can get rid of a bunch of methods on <code>Element</code> and
<code>Node</code>:</p> | 103 <p>Likewise, by making <code>nodes</code> and <code>elements</code> full-feature
d collections, we can get rid of a bunch of methods on <code>Element</code> and
<code>Node</code>:</p> |
104 | 104 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 <p> | 217 <p> |
218 Read the <a href="http://api.dartlang.org/html.html">dart:html API docs</a>. | 218 Read the <a href="http://api.dartlang.org/html.html">dart:html API docs</a>. |
219 Also see the following samples, which are included in the | 219 Also see the following samples, which are included in the |
220 <a href="/docs/editor/">Dart Editor</a> download and | 220 <a href="/docs/editor/">Dart Editor</a> download and |
221 which use the dart:html library: | 221 which use the dart:html library: |
222 <a href="http://code.google.com/p/dart/source/browse/trunk/dart/samples/slider/"
>Slider</a> and | 222 <a href="http://code.google.com/p/dart/source/browse/trunk/dart/samples/slider/"
>Slider</a> and |
223 <a href="http://code.google.com/p/dart/source/browse/trunk/dart/samples/sunflowe
r/">Sunflower</a>. | 223 <a href="http://code.google.com/p/dart/source/browse/trunk/dart/samples/sunflowe
r/">Sunflower</a>. |
224 </p> | 224 </p> |
225 | 225 |
OLD | NEW |