{"action":"created","issue":{"url":"https://api.github.com/repos/atom/tabs/issues/230","labels_url":"https://api.github.com/repos/atom/tabs/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/atom/tabs/issues/230/comments","events_url":"https://api.github.com/repos/atom/tabs/issues/230/events","html_url":"https://github.com/atom/tabs/pull/230","id":114486914,"number":230,"title":"Fix bad `this` binding","user":{"login":"as-cii","id":482957,"avatar_url":"https://avatars.githubusercontent.com/u/482957?v=3","gravatar_id":"","url":"https://api.github.com/users/as-cii","html_url":"https://github.com/as-cii","followers_url":"https://api.github.com/users/as-cii/followers","following_url":"https://api.github.com/users/as-cii/following{/other_user}","gists_url":"https://api.github.com/users/as-cii/gists{/gist_id}","starred_url":"https://api.github.com/users/as-cii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/as-cii/subscriptions","organizations_url":"https://api.github.com/users/as-cii/orgs","repos_url":"https://api.github.com/users/as-cii/repos","events_url":"https://api.github.com/users/as-cii/events{/privacy}","received_events_url":"https://api.github.com/users/as-cii/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-01T19:24:07Z","updated_at":"2015-11-02T17:09:53Z","closed_at":"2015-11-02T17:09:48Z","pull_request":{"url":"https://api.github.com/repos/atom/tabs/pulls/230","html_url":"https://github.com/atom/tabs/pull/230","diff_url":"https://github.com/atom/tabs/pull/230.diff","patch_url":"https://github.com/atom/tabs/pull/230.patch"},"body":"Fixes #229.\r\n\r\nWith #222 we dropped jQuery and used a custom element to encapsulate the behavior of a `TabBarView`. When instantiating a custom element, though, any custom constructor that's set on the prototype won't be called. This means that, if we're using Coffeescript's fat arrow facility to define a method on the object's prototype, this is not going to work because of how this feature is implemented in the language. e.g.\r\n\r\n```coffee\r\nclass Foo\r\n  something: => 1\r\n```\r\n\r\nIt will be translated to something like the following:\r\n\r\n```js\r\nclass A {\r\n  constructor () {\r\n    this.something = this.something.bind(this)\r\n  }\r\n  something () {\r\n    return 1\r\n  }\r\n}\r\n```\r\n\r\nSince the constructor cannot be executed, `this` will be set to a wrong value. We were making use of this functionality in `::onDropOnOtherWindow`, which started to fail as soon as started using custom elements.\r\n\r\nI think this is yet another signal that we need to move away from custom elements, but rewriting the whole object right now to not use them seems a bit riskier than simply fixing #229.\r\n\r\n/cc: @izuzak @nathansobo "},"comment":{"url":"https://api.github.com/repos/atom/tabs/issues/comments/153086227","html_url":"https://github.com/atom/tabs/pull/230#issuecomment-153086227","issue_url":"https://api.github.com/repos/atom/tabs/issues/230","id":153086227,"user":{"login":"nathansobo","id":1789,"avatar_url":"https://avatars.githubusercontent.com/u/1789?v=3","gravatar_id":"","url":"https://api.github.com/users/nathansobo","html_url":"https://github.com/nathansobo","followers_url":"https://api.github.com/users/nathansobo/followers","following_url":"https://api.github.com/users/nathansobo/following{/other_user}","gists_url":"https://api.github.com/users/nathansobo/gists{/gist_id}","starred_url":"https://api.github.com/users/nathansobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathansobo/subscriptions","organizations_url":"https://api.github.com/users/nathansobo/orgs","repos_url":"https://api.github.com/users/nathansobo/repos","events_url":"https://api.github.com/users/nathansobo/events{/privacy}","received_events_url":"https://api.github.com/users/nathansobo/received_events","type":"User","site_admin":true},"created_at":"2015-11-02T17:09:53Z","updated_at":"2015-11-02T17:09:53Z","body":":+1: Thanks!"}}