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

Side by Side Diff: sky/framework/sky-element/sky-binder.sky

Issue 807243003: Be more strict about attributes in sky-binder. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix sky-box Created 5 years, 11 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
« no previous file with comments | « sky/framework/sky-element/element-registry.sky ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!-- 1 <!--
2 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 --> 5 -->
6 <import src="observe.sky" as="observe" /> 6 <import src="observe.sky" as="observe" />
7 <import src="element-registry.sky" as="registry" /> 7 <import src="element-registry.sky" as="registry" />
8 8
9 <script> 9 <script>
10 var stagingDocument = new Document(); 10 var stagingDocument = new Document();
11 11
12 class TemplateInstance { 12 class TemplateInstance {
13 constructor() { 13 constructor() {
14 this.bindings = []; 14 this.bindings = [];
15 this.terminator = null; 15 this.terminator = null;
16 this.fragment = stagingDocument.createDocumentFragment(); 16 this.fragment = stagingDocument.createDocumentFragment();
17 Object.preventExtensions(this); 17 Object.preventExtensions(this);
18 } 18 }
19 close() { 19 close() {
20 var bindings = this.bindings; 20 var bindings = this.bindings;
21 for (var i = 0; i < bindings.length; i++) { 21 for (var i = 0; i < bindings.length; i++) {
22 bindings[i].close(); 22 bindings[i].close();
23 } 23 }
24 } 24 }
25 } 25 }
26 26
27 var emptyInstance = new TemplateInstance(); 27 var emptyInstance = new TemplateInstance();
28 var directiveCache = new WeakMap(); 28 var directiveCache = new WeakMap();
29 29
30 (function() {
31 var templateRegistration = registry.registerElement('template');
32 templateRegistration.defineAttribute('if', 'string');
33 templateRegistration.defineAttribute('repeat', 'string');
34 })();
35
36 function createInstance(template, model) { 30 function createInstance(template, model) {
37 var content = template.content; 31 var content = template.content;
38 if (!content.firstChild) 32 if (!content.firstChild)
39 return emptyInstance; 33 return emptyInstance;
40 34
41 var directives = directiveCache.get(content); 35 var directives = directiveCache.get(content);
42 if (!directives) { 36 if (!directives) {
43 directives = new NodeDirectives(content); 37 directives = new NodeDirectives(content);
44 directiveCache.set(content, directives); 38 directiveCache.set(content, directives);
45 } 39 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 471
478 iterators.delete(this.template); 472 iterators.delete(this.template);
479 this.closed = true; 473 this.closed = true;
480 } 474 }
481 } 475 }
482 476
483 module.exports = { 477 module.exports = {
484 createInstance: createInstance, 478 createInstance: createInstance,
485 }; 479 };
486 </script> 480 </script>
OLDNEW
« no previous file with comments | « sky/framework/sky-element/element-registry.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698