{"action":"created","issue":{"url":"https://api.github.com/repos/Polymer/polymer/issues/1813","labels_url":"https://api.github.com/repos/Polymer/polymer/issues/1813/labels{/name}","comments_url":"https://api.github.com/repos/Polymer/polymer/issues/1813/comments","events_url":"https://api.github.com/repos/Polymer/polymer/issues/1813/events","html_url":"https://github.com/Polymer/polymer/issues/1813","id":86818677,"number":1813,"title":"Binding undefined does not work as expected","user":{"login":"arodic","id":708984,"avatar_url":"https://avatars.githubusercontent.com/u/708984?v=3","gravatar_id":"","url":"https://api.github.com/users/arodic","html_url":"https://github.com/arodic","followers_url":"https://api.github.com/users/arodic/followers","following_url":"https://api.github.com/users/arodic/following{/other_user}","gists_url":"https://api.github.com/users/arodic/gists{/gist_id}","starred_url":"https://api.github.com/users/arodic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arodic/subscriptions","organizations_url":"https://api.github.com/users/arodic/orgs","repos_url":"https://api.github.com/users/arodic/repos","events_url":"https://api.github.com/users/arodic/events{/privacy}","received_events_url":"https://api.github.com/users/arodic/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-10T03:21:20Z","updated_at":"2015-06-15T22:32:19Z","closed_at":"2015-06-15T22:32:19Z","body":"When binding property of a parent to property of a child, parent's property value is used.\r\n\r\nHowever, if parent's property does not have default value, or default value is explicitly set to undefined, child's property value is used instead.\r\n\r\nPersonally, I find this unintuitive and it breaks applications that deal with undefined values. For example, a value that is supposed to be undefined can suddenly become null, false, empty string or whatever is the default value of the element you bind it to.\r\n\r\nThis also applies to sibling elements. It appears that priority of values in binding corresponds to the order of elements in DOM, except if the value is undefined.\r\n\r\nBelow is a code that illustrated the problem:\r\n\r\n```HTML\r\n<dom-module id=\"child-el\">\r\n  <template>{{value}}</template>\r\n</dom-module>\r\n<script>\r\n  Polymer({\r\n    is: 'child-el',\r\n    properties: {\r\n      value: {\r\n        value: false,\r\n        notify: true,\r\n        observer: '_valueChanged'\r\n      }\r\n    },\r\n    _valueChanged: function() {\r\n      console.log('child-el value changed:', this.value);\r\n    }\r\n  });\r\n</script>\r\n\r\n<dom-module id=\"parent-el\">\r\n  <template><child-el value=\"{{value}}\"></child-el></template>\r\n</dom-module>\r\n<script>\r\n  Polymer({\r\n    is: 'parent-el',\r\n    properties: {\r\n      value: {\r\n        value: undefined,\r\n        notify: true,\r\n        observer: '_valueChanged'\r\n      }\r\n    },\r\n    _valueChanged: function() {\r\n      console.log('parent-el value changed:', this.value);\r\n    }\r\n  });\r\n</script>\r\n```\r\n\r\nIf you add parent-el to the DOM you will notice that its value is set to false while it should be undefined."},"comment":{"url":"https://api.github.com/repos/Polymer/polymer/issues/comments/112229239","html_url":"https://github.com/Polymer/polymer/issues/1813#issuecomment-112229239","issue_url":"https://api.github.com/repos/Polymer/polymer/issues/1813","id":112229239,"user":{"login":"kevinpschaaf","id":1354932,"avatar_url":"https://avatars.githubusercontent.com/u/1354932?v=3","gravatar_id":"","url":"https://api.github.com/users/kevinpschaaf","html_url":"https://github.com/kevinpschaaf","followers_url":"https://api.github.com/users/kevinpschaaf/followers","following_url":"https://api.github.com/users/kevinpschaaf/following{/other_user}","gists_url":"https://api.github.com/users/kevinpschaaf/gists{/gist_id}","starred_url":"https://api.github.com/users/kevinpschaaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevinpschaaf/subscriptions","organizations_url":"https://api.github.com/users/kevinpschaaf/orgs","repos_url":"https://api.github.com/users/kevinpschaaf/repos","events_url":"https://api.github.com/users/kevinpschaaf/events{/privacy}","received_events_url":"https://api.github.com/users/kevinpschaaf/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T22:32:19Z","updated_at":"2015-06-15T22:32:19Z","body":"Polymer uses `undefined` to mean exactly that -- a sentinel indicating when the value does not yet have a user-defined value, and gives special affordances to `undefined` under that assumption.  So its best to avoid defining user-facing an API where changes _to_ `undefined` should do something useful, and instead use `null` for those cases (which is treated as defined).\r\n\r\n"}}