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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 19590007: [mdv] template.ref must recursive to find the original source template (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: revert file generated by dom.py Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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 class _ChildrenElementList extends ListBase<Element> { 7 class _ChildrenElementList extends ListBase<Element> {
8 // Raw Element. 8 // Raw Element.
9 final Element _element; 9 final Element _element;
10 final HtmlCollection _childElements; 10 final HtmlCollection _childElements;
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 823
824 824
825 /** 825 /**
826 * Gets the template this node refers to. 826 * Gets the template this node refers to.
827 * This is only supported if [isTemplate] is true. 827 * This is only supported if [isTemplate] is true.
828 */ 828 */
829 @Experimental() 829 @Experimental()
830 Element get ref { 830 Element get ref {
831 _ensureTemplate(); 831 _ensureTemplate();
832 832
833 Element ref = null; 833 Element result = null;
834 var refId = attributes['ref']; 834 var refId = attributes['ref'];
835 if (refId != null) { 835 if (refId != null) {
836 var treeScope = this; 836 var treeScope = this;
837 while (treeScope.parentNode != null) { 837 while (treeScope.parentNode != null) {
838 treeScope = treeScope.parentNode; 838 treeScope = treeScope.parentNode;
839 } 839 }
840 840
841 // Note: JS code tests that getElementById is present. We can't do that 841 // Note: JS code tests that getElementById is present. We can't do that
842 // easily, so instead check for the types known to implement it. 842 // easily, so instead check for the types known to implement it.
843 if (treeScope is Document || 843 if (treeScope is Document ||
844 treeScope is ShadowRoot || 844 treeScope is ShadowRoot ||
845 treeScope is svg.SvgSvgElement) { 845 treeScope is svg.SvgSvgElement) {
846 846
847 ref = treeScope.getElementById(refId); 847 result = treeScope.getElementById(refId);
848 } 848 }
849 } 849 }
850 850
851 return ref != null ? ref : _templateInstanceRef; 851 if (result == null) {
852 result = _templateInstanceRef;
853 if (result == null) return this;
854 }
855
856 var nextRef = result.ref;
857 return nextRef != null ? nextRef : result;
852 } 858 }
853 859
854 /** 860 /**
855 * Gets the content of this template. 861 * Gets the content of this template.
856 * This is only supported if [isTemplate] is true. 862 * This is only supported if [isTemplate] is true.
857 */ 863 */
858 @Experimental() 864 @Experimental()
859 DocumentFragment get content { 865 DocumentFragment get content {
860 _ensureTemplate(); 866 _ensureTemplate();
861 return _templateContent; 867 return _templateContent;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 const ScrollAlignment._internal(this._value); 1070 const ScrollAlignment._internal(this._value);
1065 toString() => 'ScrollAlignment.$_value'; 1071 toString() => 'ScrollAlignment.$_value';
1066 1072
1067 /// Attempt to align the element to the top of the scrollable area. 1073 /// Attempt to align the element to the top of the scrollable area.
1068 static const TOP = const ScrollAlignment._internal('TOP'); 1074 static const TOP = const ScrollAlignment._internal('TOP');
1069 /// Attempt to center the element in the scrollable area. 1075 /// Attempt to center the element in the scrollable area.
1070 static const CENTER = const ScrollAlignment._internal('CENTER'); 1076 static const CENTER = const ScrollAlignment._internal('CENTER');
1071 /// Attempt to align the element to the bottom of the scrollable area. 1077 /// Attempt to align the element to the bottom of the scrollable area.
1072 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1078 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1073 } 1079 }
OLDNEW
« pkg/mdv/test/template_element_test.dart ('K') | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698