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

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

Issue 868973002: Don't set expression attributes before they're bound. (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/examples/widgets/index.sky ('k') | sky/framework/sky-element/sky-binder.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/sky-element/element-registry.sky
diff --git a/sky/framework/sky-element/element-registry.sky b/sky/framework/sky-element/element-registry.sky
index a38f22b37fe358a666efc46a89aa64305689d0a1..4aacabaa0f714dd785b078b287fd180c722b17c0 100644
--- a/sky/framework/sky-element/element-registry.sky
+++ b/sky/framework/sky-element/element-registry.sky
@@ -18,6 +18,16 @@ var globalAttributesNames = new Set([
'style',
]);
+function isExpandableAttribute(name) {
+ return name.startsWith('data-') || name.startsWith('on-');
+}
+
+function isGlobalAttribute(name) {
+ if (isExpandableAttribute(name))
+ return true;
+ return globalAttributesNames.has(name);
+}
+
var attributeConverters = {
boolean: function(value) {
if (typeof value == 'string')
@@ -56,9 +66,7 @@ class ElementRegistration {
}
allowsAttribute(name) {
- if (name.startsWith('data-'))
- return true;
- if (globalAttributesNames.has(name))
+ if (isGlobalAttribute(name))
return true;
if (this.attributes.has(name))
return true;
@@ -120,7 +128,7 @@ function checkAttribute(tagName, attrName) {
var registration = getRegistration(tagName);
if (!registration)
- return globalAttributesNames.has(attrName);
+ return isGlobalAttribute(attrName);
return registration.allowsAttribute(attrName);
}
@@ -161,5 +169,7 @@ module.exports = {
registerElement: registerElement,
getRegistration: getRegistration,
checkAttribute: checkAttribute,
+ isGlobalAttribute: isGlobalAttribute,
+ isExpandableAttribute: isExpandableAttribute,
};
</script>
« no previous file with comments | « sky/examples/widgets/index.sky ('k') | sky/framework/sky-element/sky-binder.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698