OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 /** | 7 /** |
8 * Lazy implementation of the child nodes of an element that does not request | 8 * Lazy implementation of the child nodes of an element that does not request |
9 * the actual child nodes of an element until strictly necessary greatly | 9 * the actual child nodes of an element until strictly necessary greatly |
10 * improving performance for the typical cases where it is not required. | 10 * improving performance for the typical cases where it is not required. |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 /** | 272 /** |
273 * Print out a String representation of this Node. | 273 * Print out a String representation of this Node. |
274 */ | 274 */ |
275 String toString() { | 275 String toString() { |
276 String value = nodeValue; // Fetch DOM Node property once. | 276 String value = nodeValue; // Fetch DOM Node property once. |
277 return value == null ? super.toString() : value; | 277 return value == null ? super.toString() : value; |
278 } | 278 } |
| 279 |
| 280 $if JSINTEROP |
| 281 List<Node> _childNodes; |
| 282 |
| 283 /** |
| 284 * A list of this node's children. |
| 285 * |
| 286 * ## Other resources |
| 287 * |
| 288 * * [Node.childNodes] |
| 289 * (https://developer.mozilla.org/en-US/docs/Web/API/Node.childNodes) |
| 290 * from MDN. |
| 291 */ |
| 292 @DomName('Node.childNodes') |
| 293 @DocsEditable() |
| 294 List<Node> get childNodes { |
| 295 if (_childNodes == null) { |
| 296 window.console.log(">>> construct childNodes collection/list"); |
| 297 List<Node> nodes = new List<Node>(); |
| 298 var jsCollection = _blink.BlinkNode.instance.childNodes_Getter_(unwrap_js
o(this)); |
| 299 var collectionLen = jsCollection['length']; |
| 300 for (var i = 0; i < collectionLen; i++) { |
| 301 nodes.add(wrap_jso(jsCollection.callMethod('item', [i]))); |
| 302 } |
| 303 _childNodes = nodes; |
| 304 } |
| 305 return _childNodes; |
| 306 } |
| 307 $else |
| 308 /** |
| 309 * A list of this node's children. |
| 310 * |
| 311 * ## Other resources |
| 312 * |
| 313 * * [Node.childNodes] |
| 314 * (https://developer.mozilla.org/en-US/docs/Web/API/Node.childNodes) |
| 315 * from MDN. |
| 316 */ |
| 317 @DomName('Node.childNodes') |
| 318 @DocsEditable() |
| 319 @Returns('NodeList') |
| 320 @Creates('NodeList') |
| 321 final List<Node> childNodes; |
| 322 |
| 323 $endif |
279 $!MEMBERS | 324 $!MEMBERS |
280 } | 325 } |
OLD | NEW |