-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure attr's with property effects. More robust fix for #3288. #3383
Conversation
So, currently if I have a property defined in the Does this fix mean that if I have |
@arthurevans See #3288 for a description of the bug; for an attribute binding like |
LGTM. |
Configure attr's with property effects. More robust fix for #3288.
@arthurevans We should probably include a note in the next release notes highlighting the bug in case users had previously relied on it. Basically something like:
|
@kevinpschaaf Is there a way to dynamically set properties based on attributes in that case? An API consumption element of mine accepts all And the reason it's not a |
I understand your point of view of this feeling non-backward compatible but it truly was an unintended side-effect of a bug, and its unfortunate you were relying on the buggy behavior. However, we can't force every user to go through a manual step of opting into a new major change for every bug fix because someone might have been relying on a side-effect of the bug. To be clear on the nature of the bug, although bound attributes were deserialized to otherwise unknown properties once, subsequent changes to the attribute would never update the property -- this is why the initial reporter filed the bug in the first place, and highlighted an undocumented behavior we were not aware of until then. As the docs on attribute deserialization state, properties should be declared in the If your element was reading |
@kevinpschaaf: So right now it will still do the binding, but the binding will only bind to the attribute? Because the parsing of And as far as semver, yes the idea is indeed that if a bugfix is likely going to break stuff (as you seemed to be aware of) that you postpone it till the next major release or make the release it is in a major release. I have not so far encountered a library which has introduced so many breaking changes in minor releases ( |
In Polymer you can either bind to a property or an attribute:
That's all the binding does, either set a property or an attribute. It is the behavior of the target element to decide what happens when either an attribute or property is set on it. As you can see with a If you have no reason to have the param data available on an attribute (as opposed to a property), then you should simply bind to the param-* property via a property binding as opposed to an attribute binding, which will avoid the need to call
Hope that helps. |
@kevinpschaaf I feel somewhat bad for hijacking this thread for a specific issue, but regardless, what do you mean with:
because as far as I know it's not possible to have wildcarded properties. I mean, I know everything else you said, but the thing this incomplete feature/'bug' made possible was exactly that: allowing wildcarded property names (an API consumption element doesn't know what parameters each call accepts, because that would be redundant). It looks however like there is a different way to bind to wilcarded property names based on your comment, but I have no idea how that's supposed to work. |
Sorry I didn't mean use a wildcard literally, but that you can bind With property binding the host will set the properties listed directly on the child: <my-el param-foo="[[foo]]" param-bar="[[bar]]"> As opposed to attribute binding (which would require cooperation from <my-el param-foo$="[[foo]]" param-bar$="[[bar]]"> You can bind to |
Can you clarify whether you're actually seeing your element break with 1.3.0? If so, can you supply a repro for your problem? To be clear, any API element that relied on this side effect would only ever work once, since as the bug describes, the bogus property was only set during element initialization and never updated. |
@kevinpschaaf does this change the custom element boolean "toggle" logic. I'm thinking of upgrading from 1.2.4 and have this type of code <paper-tabs scrollable$="[[ myBool ]]"> I'm not certain from the docs if that I think other than that I'm safe as have always used <div my-data$="[[ obj.id ]]"> // the attr still updates if obj.id changes, right? |
Right, in the paper-tabs case, where In the case of binding to a random custom attribute like Also note that Polymer will happily bind any value to a property on an element regardless of whether the element cares about the property or not. So e.g. |
No description provided.