AttributeChanged callback not firing with 0.2.3

139 views
Skip to first unread message

akhile...@gmail.com

unread,
May 5, 2014, 10:15:30 PM5/5/14
to polym...@googlegroups.com
Did anything change in the Polymer API for attributeChanged callback? With 0.2.3, attributeChanged is not getting called whenever a property changes on the element. Strongly typed observers are getting called though. Check out this sample: http://jsbin.com/kucuqete/1/edit

Am I missing something obvious? This used to work till 0.2.2.

Rob Dodson

unread,
May 5, 2014, 10:38:32 PM5/5/14
to akhile...@gmail.com, polymer-dev

One of my students mentioned this today. Going to double check when I get home

On May 5, 2014 7:15 PM, <akhile...@gmail.com> wrote:
Did anything change in the Polymer API for attributeChanged callback? With 0.2.3, attributeChanged is not getting called whenever a property changes on the element. Strongly typed observers are getting called though. Check out this sample: http://jsbin.com/kucuqete/1/edit

Am I missing something obvious? This used to work till 0.2.2.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/2a7f2b1a-9037-48fa-a11b-060bc653b2e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Miles

unread,
May 5, 2014, 11:02:49 PM5/5/14
to Rob Dodson, Akhilesh Gupta, polymer-dev
Published properties are no longer reflected back to attributes by default, see the notes here: https://github.com/Polymer/polymer/releases/tag/0.2.3.


Eric Bidelman

unread,
May 5, 2014, 11:07:14 PM5/5/14
to Scott Miles, Rob Dodson, Akhilesh Gupta, polymer-dev

akhile...@gmail.com

unread,
May 6, 2014, 8:36:56 PM5/6/14
to polym...@googlegroups.com, Scott Miles, Rob Dodson, Akhilesh Gupta
Oh ok. Yeah I saw that change in 0.2.3 release notes but somehow didn't realize that it will impact callback methods too. 

I somehow feel though that the reflection of values should be default on, while opt out should be an option too. I understand there's probably some performance impact, not sure how big, but having default off is slightly un-intuitive and inspecting DOM during debug process gets harder too. May be other option is to just have a global reflect property that could be set/unset for debugging purposes.

One of the cases where I ran into this was in a child element that wants to watch changes to all attributes of a parent element. What's the best way to achieve this in a way such that the child callback always happens no matter how the change watcher is defined on parent for the attributes? i was using attributeChanged callback method on the child, but I think that's not the best way because attributeChanged won't be called if a more specific observer is defined for an attribute by the parent. May be, in the child element, I should attach another Object observer to the instance to watch for specific changes.

John Messerly

unread,
May 8, 2014, 11:01:09 AM5/8/14
to akhile...@gmail.com, polymer-dev, Scott Miles, Rob Dodson
On Tue, May 6, 2014 at 5:36 PM, <akhile...@gmail.com> wrote:
Oh ok. Yeah I saw that change in 0.2.3 release notes but somehow didn't realize that it will impact callback methods too. 

I somehow feel though that the reflection of values should be default on, while opt out should be an option too. I understand there's probably some performance impact, not sure how big, but having default off is slightly un-intuitive and inspecting DOM during debug process gets harder too. May be other option is to just have a global reflect property that could be set/unset for debugging purposes.

One of the cases where I ran into this was in a child element that wants to watch changes to all attributes of a parent element. What's the best way to achieve this in a way such that the child callback always happens no matter how the change watcher is defined on parent for the attributes? i was using attributeChanged callback method on the child, but I think that's not the best way because attributeChanged won't be called if a more specific observer is defined for an attribute by the parent. May be, in the child element, I should attach another Object observer to the instance to watch for specific changes.

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver is good for watching HTML attribute changes.
 
Reply all
Reply to author
Forward
0 new messages