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

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

Issue 18182010: Make html metadata follow the spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed DocsEditable, Experimental, Unstable 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 // WARNING: Do not edit - generated code. 5 // WARNING: Do not edit - generated code.
6 6
7 part of $LIBRARYNAME; 7 part of $LIBRARYNAME;
8 8
9 9
10 /** 10 /**
(...skipping 21 matching lines...) Expand all
32 * 32 *
33 * ... 33 * ...
34 * 34 *
35 * TemplateElement.syntax['MySyntax'] = new MySyntax(); 35 * TemplateElement.syntax['MySyntax'] = new MySyntax();
36 * 36 *
37 * See <https://github.com/polymer-project/mdv/blob/master/docs/syntax.md> for 37 * See <https://github.com/polymer-project/mdv/blob/master/docs/syntax.md> for
38 * more information about Custom Syntax. 38 * more information about Custom Syntax.
39 */ 39 */
40 // TODO(jmesserly): if this is just one method, a function type would make it 40 // TODO(jmesserly): if this is just one method, a function type would make it
41 // more Dart-friendly. 41 // more Dart-friendly.
42 @Experimental 42 @Experimental()
43 abstract class CustomBindingSyntax { 43 abstract class CustomBindingSyntax {
44 /** 44 /**
45 * This syntax method allows for a custom interpretation of the contents of 45 * This syntax method allows for a custom interpretation of the contents of
46 * mustaches (`{{` ... `}}`). 46 * mustaches (`{{` ... `}}`).
47 * 47 *
48 * When a template is inserting an instance, it will invoke this method for 48 * When a template is inserting an instance, it will invoke this method for
49 * each mustache which is encountered. The function is invoked with four 49 * each mustache which is encountered. The function is invoked with four
50 * arguments: 50 * arguments:
51 * 51 *
52 * - [model]: The data context for which this instance is being created. 52 * - [model]: The data context for which this instance is being created.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 * This syntax method allows a syntax to provide an alterate expansion of 92 * This syntax method allows a syntax to provide an alterate expansion of
93 * the [template] contents. When the template wants to create an instance, 93 * the [template] contents. When the template wants to create an instance,
94 * it will call this method with the template element. 94 * it will call this method with the template element.
95 * 95 *
96 * By default this will call `template.createInstance()`. 96 * By default this will call `template.createInstance()`.
97 */ 97 */
98 getInstanceFragment(Element template) => template.createInstance(); 98 getInstanceFragment(Element template) => template.createInstance();
99 } 99 }
100 100
101 101
102 @Experimental 102 @Experimental()
103 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 103 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
104 $!MEMBERS 104 $!MEMBERS
105 105
106 // For real TemplateElement use the actual DOM .content field instead of 106 // For real TemplateElement use the actual DOM .content field instead of
107 // our polyfilled expando. 107 // our polyfilled expando.
108 @Experimental 108 @Experimental()
109 DocumentFragment get content => $dom_content; 109 DocumentFragment get content => $dom_content;
110 110
111 111
112 /** 112 /**
113 * The MDV package, if available. 113 * The MDV package, if available.
114 * 114 *
115 * This can be used to initialize MDV support via: 115 * This can be used to initialize MDV support via:
116 * 116 *
117 * import 'dart:html'; 117 * import 'dart:html';
118 * import 'package:mdv/mdv.dart' as mdv; 118 * import 'package:mdv/mdv.dart' as mdv;
(...skipping 10 matching lines...) Expand all
129 /** 129 /**
130 * Ensures proper API and content model for template elements. 130 * Ensures proper API and content model for template elements.
131 * 131 *
132 * [instanceRef] can be used to set the [Element.ref] property of [template], 132 * [instanceRef] can be used to set the [Element.ref] property of [template],
133 * and use the ref's content will be used as source when createInstance() is 133 * and use the ref's content will be used as source when createInstance() is
134 * invoked. 134 * invoked.
135 * 135 *
136 * Returns true if this template was just decorated, or false if it was 136 * Returns true if this template was just decorated, or false if it was
137 * already decorated. 137 * already decorated.
138 */ 138 */
139 @Experimental 139 @Experimental()
140 static bool decorate(Element template, [Element instanceRef]) { 140 static bool decorate(Element template, [Element instanceRef]) {
141 // == true check because it starts as a null field. 141 // == true check because it starts as a null field.
142 if (template._templateIsDecorated == true) return false; 142 if (template._templateIsDecorated == true) return false;
143 143
144 _injectStylesheet(); 144 _injectStylesheet();
145 145
146 var templateElement = template; 146 var templateElement = template;
147 var isNative = templateElement is TemplateElement; 147 var isNative = templateElement is TemplateElement;
148 var bootstrapContents = isNative; 148 var bootstrapContents = isNative;
149 var liftContents = !isNative; 149 var liftContents = !isNative;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 /** 249 /**
250 * This used to decorate recursively all templates from a given node. 250 * This used to decorate recursively all templates from a given node.
251 * 251 *
252 * By default [decorate] will be called on templates lazily when certain 252 * By default [decorate] will be called on templates lazily when certain
253 * properties such as [model] are accessed, but it can be run eagerly to 253 * properties such as [model] are accessed, but it can be run eagerly to
254 * decorate an entire tree recursively. 254 * decorate an entire tree recursively.
255 */ 255 */
256 // TODO(rafaelw): Review whether this is the right public API. 256 // TODO(rafaelw): Review whether this is the right public API.
257 @Experimental 257 @Experimental()
258 static void bootstrap(Node content) { 258 static void bootstrap(Node content) {
259 void _bootstrap(template) { 259 void _bootstrap(template) {
260 if (!TemplateElement.decorate(template)) { 260 if (!TemplateElement.decorate(template)) {
261 bootstrap(template.content); 261 bootstrap(template.content);
262 } 262 }
263 } 263 }
264 264
265 // Need to do this first as the contents may get lifted if |node| is 265 // Need to do this first as the contents may get lifted if |node| is
266 // template. 266 // template.
267 // TODO(jmesserly): content is DocumentFragment or Element 267 // TODO(jmesserly): content is DocumentFragment or Element
(...skipping 30 matching lines...) Expand all
298 option[template] { 298 option[template] {
299 display: none; 299 display: none;
300 }'''; 300 }''';
301 document.head.append(style); 301 document.head.append(style);
302 } 302 }
303 303
304 /** 304 /**
305 * A mapping of names to Custom Syntax objects. See [CustomBindingSyntax] for 305 * A mapping of names to Custom Syntax objects. See [CustomBindingSyntax] for
306 * more information. 306 * more information.
307 */ 307 */
308 @Experimental 308 @Experimental()
309 static Map<String, CustomBindingSyntax> syntax = {}; 309 static Map<String, CustomBindingSyntax> syntax = {};
310 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698