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

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

Issue 698653002: Add initial SkyElement & city-list example (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: ws Created 6 years, 1 month 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/observe.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
(Empty)
1 <!--
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
4 // found in the LICENSE file.
5 -->
6 <link rel="import" href="TemplateBinding.sky" />
7
8 <script>
9 (function(global) {
10 'use strict';
11
12 var Base = {
13
14 __proto__: HTMLElement.prototype,
15
16 register: function() {
17 // |this| is prototype
18 var template = document.currentScript.previousElementSibling;
19 if (template && template.localName == 'template') {
20 this.template_ = template;
21 }
22 },
23
24 createdCallback: function() {
25 },
26
27 attachedCallback: function() {
28 var shadow = this.createShadowRoot();
29 shadow.appendChild(this.template_.createInstance(this));
30 this.attached();
31 },
32
33 attached: function() {
34 // override
35 },
36
37 dettachedCallback: function() {
38 this.dettached();
39 },
40
41 dettached: function() {
42 // override
43 },
44
45 attributeChangedCallback: function(attrName, oldValue, newValue) {
46 // reserved for canonical behavior
47 this.attributeChanged(attrName, oldValue, newValue);
48 },
49
50 attributeChanged: function(attrName, oldValue, newValue) {
51 // override
52 }
53 };
54
55 function SkyElement(prototype) {
56 prototype.__proto__ = Base;
57 document.registerElement(prototype.name, { prototype: prototype });
58 prototype.register();
59 };
60
61 module.exports = SkyElement;
62 })(this);
63 </script>
OLDNEW
« no previous file with comments | « sky/framework/sky-element/observe.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698