old-docs-site icon indicating copy to clipboard operation
old-docs-site copied to clipboard

Add note for automatic capitalization detection of attribute bindings

Open TimvdLippe opened this issue 7 years ago • 1 comments

In https://github.com/Polymer/polymer/pull/5125 we are fixing bindings to HTML attributes that have capitalization. The resulting change is the following:

Rather than the broken viewBox$="[[binding]]", Polymer will now automatically set an attribute when encountering viewBox="[[binding]]". This will only work if the attribute maintains capitalization. This is only the case for existing attributes, which mostly live in the SVG namespace: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute

This clarifying note should probably be added to https://www.polymer-project.org/2.0/docs/devguide/data-binding#attribute-binding

TimvdLippe avatar Mar 07 '18 11:03 TimvdLippe

Suggested text:

Note: One exception is made for binding to built-in case-sensitive attributes like <svg>'s viewBox attribute. For built-in case-sensitive attributes, bindings should not include the $ normally required for attribute bindings. The following example results in an attribute binding to viewBox:

<svg viewBox="[[viewBox]]">

kevinpschaaf avatar Mar 12 '18 19:03 kevinpschaaf