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

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

Issue 950603002: Port sky-scrollable to Dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: less setAttributes Created 5 years, 10 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/fling-curve.sky ('k') | sky/framework/sky-scrollable.sky » ('j') | 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 2015 The Chromium Authors. All rights reserved. 2 // Copyright 2015 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 <script> 6 <script>
7 import "dart:mirrors"; 7 import "dart:mirrors";
8 import "dart:sky"; 8 import "dart:sky";
9 9
10 class _Registration { 10 class _Registration {
(...skipping 29 matching lines...) Expand all
40 // Invoke attributeChanged callback when element is first created too. 40 // Invoke attributeChanged callback when element is first created too.
41 for (Attr attribute in getAttributes()) 41 for (Attr attribute in getAttributes())
42 attributeChangedCallback(attribute.name, null, attribute.value); 42 attributeChangedCallback(attribute.name, null, attribute.value);
43 } 43 }
44 44
45 attachedCallback() { 45 attachedCallback() {
46 if (shadowRoot == null) { 46 if (shadowRoot == null) {
47 var registration = _registery[tagName]; 47 var registration = _registery[tagName];
48 if (registration.template != null) { 48 if (registration.template != null) {
49 ShadowRoot shadow = ensureShadowRoot(); 49 ShadowRoot shadow = ensureShadowRoot();
50 var tree = registration.template.content.cloneNode(deep:true); 50 Node content = registration.template.content;
51 shadow.appendChild(tree); 51 shadow.appendChild(document.importNode(content, deep: true));
52 shadowRootReady(); 52 shadowRootReady();
53 } 53 }
54 } 54 }
55 attached(); 55 attached();
56 } 56 }
57 57
58 detachedCallback() { 58 detachedCallback() {
59 detached(); 59 detached();
60 } 60 }
61 61
(...skipping 12 matching lines...) Expand all
74 if (!mirror.isSubclassOf(reflectClass(SkyElement))) 74 if (!mirror.isSubclassOf(reflectClass(SkyElement)))
75 throw new UnsupportedError('@Tagname can only be used on descendants of SkyE lement'); 75 throw new UnsupportedError('@Tagname can only be used on descendants of SkyE lement');
76 76
77 String tagName = _getTagName(type); 77 String tagName = _getTagName(type);
78 Element template = definition.querySelector('template'); 78 Element template = definition.querySelector('template');
79 79
80 document.registerElement(tagName, type); 80 document.registerElement(tagName, type);
81 _registery[tagName] = new _Registration(template); 81 _registery[tagName] = new _Registration(template);
82 } 82 }
83 </script> 83 </script>
OLDNEW
« no previous file with comments | « sky/framework/fling-curve.sky ('k') | sky/framework/sky-scrollable.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698