{"action":"created","comment":{"url":"https://api.github.com/repos/angular/zone.js/pulls/comments/30487988","id":30487988,"diff_hunk":"@@ -16,15 +16,20 @@ function apply() {\n   ];\n \n   document.registerElement = function (name, opts) {\n-    callbacks.forEach(function (callback) {\n-      if (opts.prototype[callback]) {\n-        var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);\n-        if (descriptor.value) {\n-          descriptor.value = global.zone.bind(descriptor.value || opts.prototype[callback]);\n-          _redefineProperty(opts.prototype, callback, descriptor);\n+    if (opts && opts.prototype) {\n+      callbacks.forEach(function (callback) {\n+        if (opts.prototype.hasOwnProperty(callback)) {\n+          var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback);\n+          if (descriptor.value) {\n+            descriptor.value = global.zone.bind(descriptor.value || opts.prototype[callback]);","path":"lib/patch/register-element.js","position":15,"original_position":15,"commit_id":"1807fcd39ea156b5916d94962b458d18934b673c","original_commit_id":"1807fcd39ea156b5916d94962b458d18934b673c","user":{"login":"vicb","id":248818,"avatar_url":"https://avatars.githubusercontent.com/u/248818?v=3","gravatar_id":"","url":"https://api.github.com/users/vicb","html_url":"https://github.com/vicb","followers_url":"https://api.github.com/users/vicb/followers","following_url":"https://api.github.com/users/vicb/following{/other_user}","gists_url":"https://api.github.com/users/vicb/gists{/gist_id}","starred_url":"https://api.github.com/users/vicb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicb/subscriptions","organizations_url":"https://api.github.com/users/vicb/orgs","repos_url":"https://api.github.com/users/vicb/repos","events_url":"https://api.github.com/users/vicb/events{/privacy}","received_events_url":"https://api.github.com/users/vicb/received_events","type":"User","site_admin":false},"body":"you should be able to safely remove ` || opts.prototype[callback]` ","created_at":"2015-05-18T08:13:26Z","updated_at":"2015-05-18T08:13:26Z","html_url":"https://github.com/angular/zone.js/pull/107#discussion_r30487988","pull_request_url":"https://api.github.com/repos/angular/zone.js/pulls/107","_links":{"self":{"href":"https://api.github.com/repos/angular/zone.js/pulls/comments/30487988"},"html":{"href":"https://github.com/angular/zone.js/pull/107#discussion_r30487988"},"pull_request":{"href":"https://api.github.com/repos/angular/zone.js/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/angular/zone.js/pulls/107","id":35475343,"html_url":"https://github.com/angular/zone.js/pull/107","diff_url":"https://github.com/angular/zone.js/pull/107.diff","patch_url":"https://github.com/angular/zone.js/pull/107.patch","issue_url":"https://api.github.com/repos/angular/zone.js/issues/107","number":107,"state":"open","locked":false,"title":"fix(register-element): add check for descriptor being defined","user":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"body":"Using other component libraries, like Polymer, alongside Angular2+zones would\r\ncause errors because the descriptor was undefined when the patched registerElement\r\nwas being called.","created_at":"2015-05-15T00:21:14Z","updated_at":"2015-05-18T08:13:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7001cc1ec4ef12146828af7a0a91b4fab0910488","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/angular/zone.js/pulls/107/commits","review_comments_url":"https://api.github.com/repos/angular/zone.js/pulls/107/comments","review_comment_url":"https://api.github.com/repos/angular/zone.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/zone.js/issues/107/comments","statuses_url":"https://api.github.com/repos/angular/zone.js/statuses/1807fcd39ea156b5916d94962b458d18934b673c","head":{"label":"jeffbcross:fix-descriptor","ref":"fix-descriptor","sha":"1807fcd39ea156b5916d94962b458d18934b673c","user":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"repo":{"id":18338254,"name":"zone.js","full_name":"jeffbcross/zone.js","owner":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeffbcross/zone.js","description":"Implements Zones for JavaScript","fork":true,"url":"https://api.github.com/repos/jeffbcross/zone.js","forks_url":"https://api.github.com/repos/jeffbcross/zone.js/forks","keys_url":"https://api.github.com/repos/jeffbcross/zone.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeffbcross/zone.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeffbcross/zone.js/teams","hooks_url":"https://api.github.com/repos/jeffbcross/zone.js/hooks","issue_events_url":"https://api.github.com/repos/jeffbcross/zone.js/issues/events{/number}","events_url":"https://api.github.com/repos/jeffbcross/zone.js/events","assignees_url":"https://api.github.com/repos/jeffbcross/zone.js/assignees{/user}","branches_url":"https://api.github.com/repos/jeffbcross/zone.js/branches{/branch}","tags_url":"https://api.github.com/repos/jeffbcross/zone.js/tags","blobs_url":"https://api.github.com/repos/jeffbcross/zone.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeffbcross/zone.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeffbcross/zone.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeffbcross/zone.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeffbcross/zone.js/statuses/{sha}","languages_url":"https://api.github.com/repos/jeffbcross/zone.js/languages","stargazers_url":"https://api.github.com/repos/jeffbcross/zone.js/stargazers","contributors_url":"https://api.github.com/repos/jeffbcross/zone.js/contributors","subscribers_url":"https://api.github.com/repos/jeffbcross/zone.js/subscribers","subscription_url":"https://api.github.com/repos/jeffbcross/zone.js/subscription","commits_url":"https://api.github.com/repos/jeffbcross/zone.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeffbcross/zone.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeffbcross/zone.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeffbcross/zone.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeffbcross/zone.js/contents/{+path}","compare_url":"https://api.github.com/repos/jeffbcross/zone.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeffbcross/zone.js/merges","archive_url":"https://api.github.com/repos/jeffbcross/zone.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeffbcross/zone.js/downloads","issues_url":"https://api.github.com/repos/jeffbcross/zone.js/issues{/number}","pulls_url":"https://api.github.com/repos/jeffbcross/zone.js/pulls{/number}","milestones_url":"https://api.github.com/repos/jeffbcross/zone.js/milestones{/number}","notifications_url":"https://api.github.com/repos/jeffbcross/zone.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeffbcross/zone.js/labels{/name}","releases_url":"https://api.github.com/repos/jeffbcross/zone.js/releases{/id}","created_at":"2014-04-01T17:32:56Z","updated_at":"2014-04-01T17:44:48Z","pushed_at":"2015-05-15T16:30:36Z","git_url":"git://github.com/jeffbcross/zone.js.git","ssh_url":"git@github.com:jeffbcross/zone.js.git","clone_url":"https://github.com/jeffbcross/zone.js.git","svn_url":"https://github.com/jeffbcross/zone.js","homepage":"https://github.com/angular/zone.js","size":499,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"8f262aadcba3a9e3899d23f988f4b97fd602b588","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":15467734,"name":"zone.js","full_name":"angular/zone.js","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/zone.js","description":"Implements Zones for JavaScript","fork":false,"url":"https://api.github.com/repos/angular/zone.js","forks_url":"https://api.github.com/repos/angular/zone.js/forks","keys_url":"https://api.github.com/repos/angular/zone.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/zone.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/zone.js/teams","hooks_url":"https://api.github.com/repos/angular/zone.js/hooks","issue_events_url":"https://api.github.com/repos/angular/zone.js/issues/events{/number}","events_url":"https://api.github.com/repos/angular/zone.js/events","assignees_url":"https://api.github.com/repos/angular/zone.js/assignees{/user}","branches_url":"https://api.github.com/repos/angular/zone.js/branches{/branch}","tags_url":"https://api.github.com/repos/angular/zone.js/tags","blobs_url":"https://api.github.com/repos/angular/zone.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/zone.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/zone.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/zone.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/zone.js/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/zone.js/languages","stargazers_url":"https://api.github.com/repos/angular/zone.js/stargazers","contributors_url":"https://api.github.com/repos/angular/zone.js/contributors","subscribers_url":"https://api.github.com/repos/angular/zone.js/subscribers","subscription_url":"https://api.github.com/repos/angular/zone.js/subscription","commits_url":"https://api.github.com/repos/angular/zone.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/zone.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/zone.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/zone.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/zone.js/contents/{+path}","compare_url":"https://api.github.com/repos/angular/zone.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/zone.js/merges","archive_url":"https://api.github.com/repos/angular/zone.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/zone.js/downloads","issues_url":"https://api.github.com/repos/angular/zone.js/issues{/number}","pulls_url":"https://api.github.com/repos/angular/zone.js/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/zone.js/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/zone.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/zone.js/labels{/name}","releases_url":"https://api.github.com/repos/angular/zone.js/releases{/id}","created_at":"2013-12-27T06:08:07Z","updated_at":"2015-05-15T22:56:36Z","pushed_at":"2015-05-18T07:23:25Z","git_url":"git://github.com/angular/zone.js.git","ssh_url":"git@github.com:angular/zone.js.git","clone_url":"https://github.com/angular/zone.js.git","svn_url":"https://github.com/angular/zone.js","homepage":"https://github.com/angular/zone.js","size":1672,"stargazers_count":720,"watchers_count":720,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":42,"forks":52,"open_issues":42,"watchers":720,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/zone.js/pulls/107"},"html":{"href":"https://github.com/angular/zone.js/pull/107"},"issue":{"href":"https://api.github.com/repos/angular/zone.js/issues/107"},"comments":{"href":"https://api.github.com/repos/angular/zone.js/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/zone.js/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/zone.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/zone.js/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/angular/zone.js/statuses/1807fcd39ea156b5916d94962b458d18934b673c"}}}}