{"action":"closed","issue":{"url":"https://api.github.com/repos/AmpersandJS/ampersand-state/issues/226","labels_url":"https://api.github.com/repos/AmpersandJS/ampersand-state/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/AmpersandJS/ampersand-state/issues/226/comments","events_url":"https://api.github.com/repos/AmpersandJS/ampersand-state/issues/226/events","html_url":"https://github.com/AmpersandJS/ampersand-state/issues/226","id":129310645,"number":226,"title":"Possible need for semver major","user":{"login":"dhritzkiv","id":1349865,"avatar_url":"https://avatars.githubusercontent.com/u/1349865?v=3","gravatar_id":"","url":"https://api.github.com/users/dhritzkiv","html_url":"https://github.com/dhritzkiv","followers_url":"https://api.github.com/users/dhritzkiv/followers","following_url":"https://api.github.com/users/dhritzkiv/following{/other_user}","gists_url":"https://api.github.com/users/dhritzkiv/gists{/gist_id}","starred_url":"https://api.github.com/users/dhritzkiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhritzkiv/subscriptions","organizations_url":"https://api.github.com/users/dhritzkiv/orgs","repos_url":"https://api.github.com/users/dhritzkiv/repos","events_url":"https://api.github.com/users/dhritzkiv/events{/privacy}","received_events_url":"https://api.github.com/users/dhritzkiv/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-28T00:22:14Z","updated_at":"2016-01-29T16:36:04Z","closed_at":"2016-01-29T16:36:04Z","body":"With the optimisation changes made in c6a16ed689dea762b2b7c67368ae8c4456d506e7, I've come across an edge case that may require a major release (and possible deprecation of v4.9.0+).\r\n\r\nThe optimisations included a transition away from using `for (attr in obj)` to `Object.keys(obj)` in order to iterate the object properties. While this is more efficient, and what is necessary nearly all of the time, it changes which properties are iterated over. Essentially, `for…in` loops over all enumerable properties, including those inherited through the prototype chain, while `Object.keys` only returns own attributes that are enumerable.\r\n\r\n[See this small example on tonicdev](https://tonicdev.com/dhritzkiv/56a9571b33bb660f00ce789c)\r\n\r\nThis switch also affects instances of certain constructors like Blob/File, among others. `for...in` loops through those instances' keys (size, name, type, slice), while `Object.keys` does not (at least in Safari). I actually don't know why, but I suspect this has to do with getters/setters and the Browser specific-implementation nature of these instances. ~~[Here's a another small example working with Blobs, on jsbin](http://jsbin.com/lifuhavano/edit?js,console)~~ Since the JSBin example isn't working consistently, I've inlined the code and results:\r\n\r\n```js\r\n\r\nvar blob = new Blob([\"hello\"]);\r\n\r\nconsole.log(blob.size);//5\r\n\r\nconsole.log(\"Object.keys\", Object.keys(blob)); // \"Object.keys\" []\r\n\r\nvar attr;\r\nvar attrs = [];\r\n\r\nfor (attr in blob) {\r\n    attrs.push(attr);\r\n}\r\n\r\nconsole.log(\"for in\", attrs); // \"for in\" [\"size\", \"slice\", \"type\"]\r\n\r\n```\r\n\r\nThis change actually bit me while working in my ampersand-file-drop-view module which works with Blob/File objects, and `set`ting those blobs onto a State model. (I'm working to make changes in that module to be more explicit about setting the appropriate properties).\r\n\r\nAgain, these are edge cases, but functionality breaking nonetheless, warranting a major semver release, as annoying as it is. It would also warrant a note in a README."}}