Skip to content

Loading…

Annotated attribute binding issues #1874

Closed
robrez opened this Issue · 2 comments

2 participants

@robrez

I'm having trouble w/ a callback not executing whenever an annotated attribute binding uses a function which takes multiple args and one of them is undefined.

If I limit the number of arguments to 1, everything seems to work as expected.

Here's a plnkr
http://plnkr.co/edit/FlN0SJmmjgyEJRlkRE0w?p=preview

Note: That example uses dom-repeat, but I'm getting the same result when using a standalone object outside of any repeater.

@kevinpschaaf

As you noted in #1877 (comment), what you are seeing is a result of Polymer's rule to not call observers/computing functions with undefined dependencies (discussed in docs here), which has both performance and ergonomic benefits, but has this side-effect of slightly unintuitive results when structured data may have optional properties that lead to undefined dependencies.

In this case, I'd recommend using a wildcard argument, which guarantees the function is called for each change to the base object and sub-properties thereof:
http://plnkr.co/edit/EyibXcM5hFYrpEbxZ3Jq?p=preview

We'll consider improvements to this API on #1877, so we'll go ahead and close this issue.

@robrez

Thanks for the help

@sorvell sorvell referenced this issue from a commit
@sorvell sorvell Fixes #1938: make host selector not tripped up by id, attr, or pseudo…
… properties

Fixes #1874, #1761: maintain static declarations within declarations that contain custom properties
Fixes #1927: make custom property parser able to see property endings of ; or \n or end token.
ab8c285
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.