-
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
website out of date - incorrect arguments to attributeChanged method #419
Comments
Afaict, the spec, the polyfill, Polymer source code, and http://jsbin.com/ixIpIMa/5/edit all agree on the call signature. Do you have a reproduction you can share? |
I do, I'll grab it now and send it in a sec. Even later in the same page it http://www.polymer-project.org/polymer.html#observeprops Bugs On Thu, Feb 13, 2014 at 11:12 AM, Scott J. Miles
|
Ah, attribute confusion. For any observed property, we support a magic method called This is not to be confused with If you made a property called |
aaaaaah ok so attributeChanged is the literal name of a function that is Bugs On Thu, Feb 13, 2014 at 11:41 AM, Scott J. Miles
|
Yes, sorry for the confusion. It's best to just consider that It's true that properties are sometimes tied to attributes, but not always. Whether a change in a property results in a change in an attribute isn't as obvious as it seems. The short version is that Polymer tries to be smart about doing the least amount of work it can while keeping your logic correct. |
Excellent thanks for the explanation! Bugs On Thu, Feb 13, 2014 at 12:00 PM, Scott J. Miles
|
In the life cycle methods section of the API reference page, the attributeChanged method is demonstrated with incorrect arguments
attributeChanged: function(attrName, oldVal, newVal) {
//var newVal = this.getAttribute(attrName);
console.log(attrName, 'old: ' + oldVal, 'new:', newVal);
},
In practice, the first argument to this function is oldVal, the second is newVal.
http://www.polymer-project.org/polymer.html#lifecyclemethods
The text was updated successfully, but these errors were encountered: