Automatically detect capitalized HTML attributes#5125
Conversation
kevinpschaaf
left a comment
There was a problem hiding this comment.
-
As a matter of convention, we put all (non-legacy) mixins in the
lib/mixinsfolder. -
I just had a thought, it might be nice to make this an "SVG-compatibility" mixin where we can do all the crazy stuff needed to support SVG's rather than this one thing (which would affect naming, mostly). But then I realized there's actually very little we can do in v1 CE, since SVGElement is no longer extendable (at least for now). The rough value-added SVG compatibility things I had in my head were:
- Make an SVG namespaced template
- Make a CE that (begrudgingly) stamps the SVG template to the light dom
@sorvell Worth considering?
| * @protected | ||
| * @suppress {missingProperties} Interfaces in closure do not inherit statics, but classes do | ||
| */ | ||
| static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { |
There was a problem hiding this comment.
Let's go ahead and just put this into PropertyEffects. It seems like it's only going to help and does no harm.
| let origName = name; | ||
| let kind = 'property'; | ||
| if (name[name.length-1] == '$') { | ||
| if (capitalAttributeRegex.test(name)) { |
There was a problem hiding this comment.
Let's add a comment in the code here explaining why we're doing this. The only way we see a capital letter here is if the attr has a capital letter in it per spec. In this case, to make sure this binding works, we go ahead and make the binding to the attribute.
We should also add something simplified about this to the doc.
|
Docs issue opened at Polymer/old-docs-site#2490 |
Support capitalized HTML attributes by providing a mixin that uses an heuristic based on capitalization.
Reference Issue
Fixes #5114
Fixes #1831