Index: sky/framework/sky-element/sky-element.sky |
diff --git a/sky/framework/sky-element/sky-element.sky b/sky/framework/sky-element/sky-element.sky |
new file mode 100644 |
index 0000000000000000000000000000000000000000..21ab588dcdc3ccdb16b596b62b7c15b82c5b5898 |
--- /dev/null |
+++ b/sky/framework/sky-element/sky-element.sky |
@@ -0,0 +1,66 @@ |
+<!-- |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+--> |
+<link rel="import" href="TemplateBinding.sky" /> |
+ |
+<script> |
+(function(global) { |
+ 'use strict'; |
+ |
+ // var bindigDelegate = new PolymerExpressions; |
+ var bindingDelegate; |
+ |
+ var Base = { |
+ |
+ __proto__: HTMLElement.prototype, |
+ |
+ register: function() { |
+ // This is prototype |
+ var template = document.currentScript.previousElementSibling; |
+ if (template && template.localName == 'template') { |
+ this.template_ = template; |
+ } |
+ }, |
+ |
+ createdCallback: function() { |
+ }, |
+ |
+ attachedCallback: function() { |
+ var shadow = this.createShadowRoot(); |
+ shadow.appendChild(this.template_.createInstance(this, bindingDelegate)); |
+ this.attached(); |
+ }, |
+ |
+ attached: function() { |
+ // override |
+ }, |
+ |
+ dettachedCallback: function() { |
+ this.dettached(); |
+ }, |
+ |
+ dettached: function() { |
+ // override |
+ }, |
+ |
+ attributeChangedCallback: function(attrName, oldValue, newValue) { |
+ // reserved for canonical behavior |
+ this.attributeChanged(attrName, oldValue, newValue); |
+ }, |
+ |
+ attributeChanged: function(attrName, oldValue, newValue) { |
+ // for overriding |
+ } |
+ }; |
+ |
+ function SkyElement(prototype) { |
+ prototype.__proto__ = Base; |
+ document.registerElement(prototype.name, { prototype: prototype }); |
+ prototype.register(); |
+ }; |
+ |
+ module.exports = SkyElement; |
+})(this); |
+</script> |