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

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

Issue 14634011: move top-level internal methods into a class (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 self._attributeBindings = new Map<String, StreamSubscription>(); 683 self._attributeBindings = new Map<String, StreamSubscription>();
684 } 684 }
685 685
686 self.xtag.attributes.remove(name); 686 self.xtag.attributes.remove(name);
687 687
688 var changed; 688 var changed;
689 if (name.endsWith('?')) { 689 if (name.endsWith('?')) {
690 name = name.substring(0, name.length - 1); 690 name = name.substring(0, name.length - 1);
691 691
692 changed = (value) { 692 changed = (value) {
693 if (_templateBooleanConversion(value)) { 693 if (_Bindings._toBoolean(value)) {
694 self.xtag.attributes[name] = ''; 694 self.xtag.attributes[name] = '';
695 } else { 695 } else {
696 self.xtag.attributes.remove(name); 696 self.xtag.attributes.remove(name);
697 } 697 }
698 }; 698 };
699 } else { 699 } else {
700 changed = (value) { 700 changed = (value) {
701 // TODO(jmesserly): escape value if needed to protect against XSS. 701 // TODO(jmesserly): escape value if needed to protect against XSS.
702 // See https://github.com/toolkitchen/mdv/issues/58 702 // See https://github.com/toolkitchen/mdv/issues/58
703 self.xtag.attributes[name] = value == null ? '' : '$value'; 703 self.xtag.attributes[name] = value == null ? '' : '$value';
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 * Creates an instance of the template. 816 * Creates an instance of the template.
817 * This is only supported if [isTemplate] is true. 817 * This is only supported if [isTemplate] is true.
818 */ 818 */
819 @Experimental 819 @Experimental
820 DocumentFragment createInstance() { 820 DocumentFragment createInstance() {
821 _ensureTemplate(); 821 _ensureTemplate();
822 822
823 var template = ref; 823 var template = ref;
824 if (template == null) template = this; 824 if (template == null) template = this;
825 825
826 var instance = _createDeepCloneAndDecorateTemplates(template.content, 826 var instance = _Bindings._createDeepCloneAndDecorateTemplates(
827 attributes['syntax']); 827 template.content, attributes['syntax']);
828 828
829 if (TemplateElement._instanceCreated != null) { 829 if (TemplateElement._instanceCreated != null) {
830 TemplateElement._instanceCreated.add(instance); 830 TemplateElement._instanceCreated.add(instance);
831 } 831 }
832 return instance; 832 return instance;
833 } 833 }
834 834
835 /** 835 /**
836 * The data model which is inherited through the tree. 836 * The data model which is inherited through the tree.
837 * This is only supported if [isTemplate] is true. 837 * This is only supported if [isTemplate] is true.
838 * 838 *
839 * Setting this will destructive propagate the value to all descendant nodes, 839 * Setting this will destructive propagate the value to all descendant nodes,
840 * and reinstantiate all of the nodes expanded by this template. 840 * and reinstantiate all of the nodes expanded by this template.
841 * 841 *
842 * Currently this does not support propagation through Shadow DOMs. 842 * Currently this does not support propagation through Shadow DOMs.
843 */ 843 */
844 @Experimental 844 @Experimental
845 get model => _model; 845 get model => _model;
846 846
847 @Experimental 847 @Experimental
848 void set model(value) { 848 void set model(value) {
849 _ensureTemplate(); 849 _ensureTemplate();
850 850
851 var syntax = TemplateElement.syntax[attributes['syntax']]; 851 var syntax = TemplateElement.syntax[attributes['syntax']];
852 _model = value; 852 _model = value;
853 _addBindings(this, model, syntax); 853 _Bindings._addBindings(this, model, syntax);
854 } 854 }
855 855
856 // TODO(jmesserly): const set would be better 856 // TODO(jmesserly): const set would be better
857 static const _TABLE_TAGS = const { 857 static const _TABLE_TAGS = const {
858 'caption': null, 858 'caption': null,
859 'col': null, 859 'col': null,
860 'colgroup': null, 860 'colgroup': null,
861 'tbody': null, 861 'tbody': null,
862 'td': null, 862 'td': null,
863 'tfoot': null, 863 'tfoot': null,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 const ScrollAlignment._internal(this._value); 1032 const ScrollAlignment._internal(this._value);
1033 toString() => 'ScrollAlignment.$_value'; 1033 toString() => 'ScrollAlignment.$_value';
1034 1034
1035 /// Attempt to align the element to the top of the scrollable area. 1035 /// Attempt to align the element to the top of the scrollable area.
1036 static const TOP = const ScrollAlignment._internal('TOP'); 1036 static const TOP = const ScrollAlignment._internal('TOP');
1037 /// Attempt to center the element in the scrollable area. 1037 /// Attempt to center the element in the scrollable area.
1038 static const CENTER = const ScrollAlignment._internal('CENTER'); 1038 static const CENTER = const ScrollAlignment._internal('CENTER');
1039 /// Attempt to align the element to the bottom of the scrollable area. 1039 /// Attempt to align the element to the bottom of the scrollable area.
1040 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1040 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1041 } 1041 }
OLDNEW
« no previous file with comments | « tools/dom/src/TemplateBindings.dart ('k') | tools/dom/templates/html/impl/impl_HTMLTemplateElement.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698