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

Unified Diff: sky/framework/sky-element/sky-element.sky

Issue 692253002: Clean up SkyElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 35578725d86c927f38e68d4fb4c08d1c2be3828f..c064255a71039288b1587cab39f90f385b50b54a 100644
--- a/sky/framework/sky-element/sky-element.sky
+++ b/sky/framework/sky-element/sky-element.sky
@@ -4,60 +4,51 @@
// found in the LICENSE file.
-->
<link rel="import" href="TemplateBinding.sky" />
-
<script>
-(function(global) {
- 'use strict';
-
- 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));
- 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) {
- // override
- }
- };
-
- function SkyElement(prototype) {
- prototype.__proto__ = Base;
- document.registerElement(prototype.name, { prototype: prototype });
- prototype.register();
- };
-
- module.exports = SkyElement;
-})(this);
+var Base = Object.create(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));
+ 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) {
+ // override
+ },
+};
+
+function SkyElement(prototype) {
+ prototype.__proto__ = Base;
+ document.registerElement(prototype.name, { prototype: prototype });
+ prototype.register();
+};
+
+module.exports = SkyElement;
</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698