| OLD | NEW |
| 1 /// The Dart HTML library. | 1 /// The Dart HTML library. |
| 2 /// | 2 /// |
| 3 /// For examples, see | 3 /// For examples, see |
| 4 /// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples) | 4 /// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples) |
| 5 /// on Github. | 5 /// on Github. |
| 6 library dart.dom.html; | 6 library dart.dom.html; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 import 'dart:_collection-dev' hide Symbol, deprecated; | 10 import 'dart:_collection-dev' hide Symbol, deprecated; |
| (...skipping 8564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8575 | 8575 |
| 8576 | 8576 |
| 8577 /** | 8577 /** |
| 8578 * Gets the template this node refers to. | 8578 * Gets the template this node refers to. |
| 8579 * This is only supported if [isTemplate] is true. | 8579 * This is only supported if [isTemplate] is true. |
| 8580 */ | 8580 */ |
| 8581 @Experimental() | 8581 @Experimental() |
| 8582 Element get ref { | 8582 Element get ref { |
| 8583 _ensureTemplate(); | 8583 _ensureTemplate(); |
| 8584 | 8584 |
| 8585 Element ref = null; | 8585 Element result = null; |
| 8586 var refId = attributes['ref']; | 8586 var refId = attributes['ref']; |
| 8587 if (refId != null) { | 8587 if (refId != null) { |
| 8588 var treeScope = this; | 8588 var treeScope = this; |
| 8589 while (treeScope.parentNode != null) { | 8589 while (treeScope.parentNode != null) { |
| 8590 treeScope = treeScope.parentNode; | 8590 treeScope = treeScope.parentNode; |
| 8591 } | 8591 } |
| 8592 | 8592 |
| 8593 // Note: JS code tests that getElementById is present. We can't do that | 8593 // Note: JS code tests that getElementById is present. We can't do that |
| 8594 // easily, so instead check for the types known to implement it. | 8594 // easily, so instead check for the types known to implement it. |
| 8595 if (treeScope is Document || | 8595 if (treeScope is Document || |
| 8596 treeScope is ShadowRoot || | 8596 treeScope is ShadowRoot || |
| 8597 treeScope is svg.SvgSvgElement) { | 8597 treeScope is svg.SvgSvgElement) { |
| 8598 | 8598 |
| 8599 ref = treeScope.getElementById(refId); | 8599 result = treeScope.getElementById(refId); |
| 8600 } | 8600 } |
| 8601 } | 8601 } |
| 8602 | 8602 |
| 8603 return ref != null ? ref : _templateInstanceRef; | 8603 if (result == null) { |
| 8604 result = _templateInstanceRef; |
| 8605 if (result == null) return this; |
| 8606 } |
| 8607 |
| 8608 var nextRef = result.ref; |
| 8609 return nextRef != null ? nextRef : result; |
| 8604 } | 8610 } |
| 8605 | 8611 |
| 8606 /** | 8612 /** |
| 8607 * Gets the content of this template. | 8613 * Gets the content of this template. |
| 8608 * This is only supported if [isTemplate] is true. | 8614 * This is only supported if [isTemplate] is true. |
| 8609 */ | 8615 */ |
| 8610 @Experimental() | 8616 @Experimental() |
| 8611 DocumentFragment get content { | 8617 DocumentFragment get content { |
| 8612 _ensureTemplate(); | 8618 _ensureTemplate(); |
| 8613 return _templateContent; | 8619 return _templateContent; |
| (...skipping 20852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 29466 _position = nextPosition; | 29472 _position = nextPosition; |
| 29467 return true; | 29473 return true; |
| 29468 } | 29474 } |
| 29469 _current = null; | 29475 _current = null; |
| 29470 _position = _array.length; | 29476 _position = _array.length; |
| 29471 return false; | 29477 return false; |
| 29472 } | 29478 } |
| 29473 | 29479 |
| 29474 T get current => _current; | 29480 T get current => _current; |
| 29475 } | 29481 } |
| OLD | NEW |