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

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

Issue 845523004: console.error when using unknown attributes in templates. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/framework/sky-element/sky-binder.sky ('k') | sky/tests/framework/templates.sky » ('j') | 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 adb7e28640924e0b0b8185a41602c31cc7d2f0cc..ea4ef8bdb6fec06616d908b63c21dd75d4168f3c 100644
--- a/sky/framework/sky-element/sky-element.sky
+++ b/sky/framework/sky-element/sky-element.sky
@@ -40,18 +40,24 @@ function defineReflectedAttribute(prototype, converter, name) {
};
}
-function defineReflectedAttributes(elementClass, list) {
- var attributeNames = (list || '').split(',');
+function defineReflectedAttributes(elementClass, tagName, list) {
+ var attributeTokens = (list || '').split(',');
+ var attributeNames = [];
var prototype = elementClass.prototype;
- for (var i = 0; i < attributeNames.length; ++i) {
- var parts = attributeNames[i].split(':');
+ for (var i = 0; i < attributeTokens.length; ++i) {
+ var parts = attributeTokens[i].split(':');
var name = parts[0].trim();
var type = (parts[1] || '').trim();
var converter = attributeConverters[type] || attributeConverters.string;
+ attributeNames.push(name);
defineReflectedAttribute(prototype, converter, name);
}
+
+ binder.registerElement(tagName, {
+ attributeNames: attributeNames,
+ });
}
class SkyElement extends HTMLElement {
@@ -70,7 +76,8 @@ class SkyElement extends HTMLElement {
if (template)
templates.set(tagName, template);
- defineReflectedAttributes(this, wrapper.getAttribute('attributes'));
+ defineReflectedAttributes(this, tagName,
+ wrapper.getAttribute('attributes'));
return document.registerElement(tagName, {
prototype: this.prototype,
« no previous file with comments | « sky/framework/sky-element/sky-binder.sky ('k') | sky/tests/framework/templates.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698