{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular.js/pulls/comments/64889737","id":64889737,"diff_hunk":"@@ -381,6 +381,9 @@ function generateInputCompilerHelper(helper) {\n         // Compile the lot and return the input element\n         $compile(helper.formElm)(scope);\n \n+        $rootElement.append(helper.formElm);\n+        jqLite($document[0].body).append($rootElement);","path":"test/helpers/testabilityPatch.js","position":14,"original_position":14,"commit_id":"ee23d70e97b47709cc1c5f3f0e147e4042275d3a","original_commit_id":"ee23d70e97b47709cc1c5f3f0e147e4042275d3a","user":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"body":"If we use browserTrigger, it is needed in Chrome. It works in Firefox. Haven't tested other browsers. If you use the native element.click() fn, you need it in both FF and Chrome","created_at":"2016-05-27T11:03:34Z","updated_at":"2016-05-27T11:03:34Z","html_url":"https://github.com/angular/angular.js/pull/14685#discussion_r64889737","pull_request_url":"https://api.github.com/repos/angular/angular.js/pulls/14685","_links":{"self":{"href":"https://api.github.com/repos/angular/angular.js/pulls/comments/64889737"},"html":{"href":"https://github.com/angular/angular.js/pull/14685#discussion_r64889737"},"pull_request":{"href":"https://api.github.com/repos/angular/angular.js/pulls/14685"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular.js/pulls/14685","id":71685447,"html_url":"https://github.com/angular/angular.js/pull/14685","diff_url":"https://github.com/angular/angular.js/pull/14685.diff","patch_url":"https://github.com/angular/angular.js/pull/14685.patch","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14685","number":14685,"state":"open","locked":false,"title":"fix(input): listen on \"change\" for radio and checkbox","user":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"body":"**What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)**\r\nbug fix\r\n\r\n\r\n**What is the current behavior? (You can also link to an open issue here)**\r\nradio and checkbox listen on \"click\" which can cause unforeseen behavior\r\n\r\n\r\n**What is the new behavior (if this is a feature change)?**\r\nradio and checkbox listen on \"change\"\r\n\r\n\r\n**Does this PR introduce a breaking change?**\r\nYes, for certain unit-test behaviors\r\n\r\n\r\n**Please check if the PR fulfills these requirements**\r\n- [x] The commit message follows our guidelines: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format\r\n- [x] Tests for the changes have been added (for bug fixes / features)\r\n- ~[ ] Docs have been added / updated (for bug fixes / features)~\r\n\r\n**Other information**:\r\n\r\n\r\ninput[radio] and inout[checkbox] now listen on the change event instead\r\nof the click event. This fixes issue with 3rd party libraries that trigger\r\na change event on inputs, e.g. Bootstrap 3 custom checkbox / radio button\r\ntoggles.\r\nIt also makes it easier to prevent specific events that can cause a checkbox / radio\r\nto change, e.g. click events. Previously, this was difficult because the custom click\r\nhandler had to be registered before the input directive's click handler.\r\n\r\nIt is possible that radio and checkbox listened to click because IE8 has\r\nbroken support for listening on change, see http://www.quirksmode.org/dom/events/change.html\r\n\r\nCloses #4516\r\nCloses #14667\r\n\r\nBREAKING CHANGE:\r\n\r\ninput[radio] and input[checkbox] now need to be attached to the document to propagate events\r\ncorrectly. This should only be of concern in unit-tests that compile input elements and\r\ntrigger click events on them. This is because we now listen to the change event which\r\ngets automatically triggered by browsers when a checkbox or radio is clicked. However,\r\nthis may fail in some browsers when the elements are not attached to the document.\r\n\r\nBefore:\r\n\r\n```js\r\n    it('should update the model', inject(function($compile, $rootScope) {\r\n      var inputElm = $compile('<input type=\"checkbox\" ng-model=\"checkbox\" />')($rootScope);\r\n\r\n      browserTrigger(inputElm[0], 'click');\r\n      expect($rootScope.checkbox).toBe(true);\r\n    });\r\n```\r\n\r\nWith this patch, `$rootScope.checkbox` might not be true, because the click event\r\nhasn't triggered the change event. To make the test, work append the inputElm to the app's\r\n$rootElement, and the $rootElement to the $document:\r\n\r\nAfter:\r\n\r\n```js\r\n    it('should update the model', inject(function($compile, $rootScope, $rootElement, $document) {\r\n      var inputElm = $compile('<input type=\"checkbox\" ng-model=\"checkbox\" />')($rootScope);\r\n\r\n      $rootElement.append(inputElm);\r\n      $document.append($rootElement);\r\n\r\n      browserTrigger(inputElm[0], 'click');\r\n      expect($rootScope.checkbox).toBe(true);\r\n    });\r\n```","created_at":"2016-05-27T09:33:18Z","updated_at":"2016-05-27T11:03:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b194995e8de38f3530ba88173ab77104ef96be37","assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/90","html_url":"https://github.com/angular/angular.js/milestones/1.5.x","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/90/labels","id":1025270,"number":90,"title":"1.5.x","description":"","creator":{"login":"petebacondarwin","id":15655,"avatar_url":"https://avatars.githubusercontent.com/u/15655?v=3","gravatar_id":"","url":"https://api.github.com/users/petebacondarwin","html_url":"https://github.com/petebacondarwin","followers_url":"https://api.github.com/users/petebacondarwin/followers","following_url":"https://api.github.com/users/petebacondarwin/following{/other_user}","gists_url":"https://api.github.com/users/petebacondarwin/gists{/gist_id}","starred_url":"https://api.github.com/users/petebacondarwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petebacondarwin/subscriptions","organizations_url":"https://api.github.com/users/petebacondarwin/orgs","repos_url":"https://api.github.com/users/petebacondarwin/repos","events_url":"https://api.github.com/users/petebacondarwin/events{/privacy}","received_events_url":"https://api.github.com/users/petebacondarwin/received_events","type":"User","site_admin":false},"open_issues":94,"closed_issues":133,"state":"open","created_at":"2015-03-17T12:15:49Z","updated_at":"2016-05-27T09:33:18Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/angular/angular.js/pulls/14685/commits","review_comments_url":"https://api.github.com/repos/angular/angular.js/pulls/14685/comments","review_comment_url":"https://api.github.com/repos/angular/angular.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14685/comments","statuses_url":"https://api.github.com/repos/angular/angular.js/statuses/ee23d70e97b47709cc1c5f3f0e147e4042275d3a","head":{"label":"Narretz:fix-radio-checkbox","ref":"fix-radio-checkbox","sha":"ee23d70e97b47709cc1c5f3f0e147e4042275d3a","user":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"repo":{"id":14773045,"name":"angular.js","full_name":"Narretz/angular.js","owner":{"login":"Narretz","id":1153097,"avatar_url":"https://avatars.githubusercontent.com/u/1153097?v=3","gravatar_id":"","url":"https://api.github.com/users/Narretz","html_url":"https://github.com/Narretz","followers_url":"https://api.github.com/users/Narretz/followers","following_url":"https://api.github.com/users/Narretz/following{/other_user}","gists_url":"https://api.github.com/users/Narretz/gists{/gist_id}","starred_url":"https://api.github.com/users/Narretz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Narretz/subscriptions","organizations_url":"https://api.github.com/users/Narretz/orgs","repos_url":"https://api.github.com/users/Narretz/repos","events_url":"https://api.github.com/users/Narretz/events{/privacy}","received_events_url":"https://api.github.com/users/Narretz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Narretz/angular.js","description":"","fork":true,"url":"https://api.github.com/repos/Narretz/angular.js","forks_url":"https://api.github.com/repos/Narretz/angular.js/forks","keys_url":"https://api.github.com/repos/Narretz/angular.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Narretz/angular.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Narretz/angular.js/teams","hooks_url":"https://api.github.com/repos/Narretz/angular.js/hooks","issue_events_url":"https://api.github.com/repos/Narretz/angular.js/issues/events{/number}","events_url":"https://api.github.com/repos/Narretz/angular.js/events","assignees_url":"https://api.github.com/repos/Narretz/angular.js/assignees{/user}","branches_url":"https://api.github.com/repos/Narretz/angular.js/branches{/branch}","tags_url":"https://api.github.com/repos/Narretz/angular.js/tags","blobs_url":"https://api.github.com/repos/Narretz/angular.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Narretz/angular.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Narretz/angular.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Narretz/angular.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Narretz/angular.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Narretz/angular.js/languages","stargazers_url":"https://api.github.com/repos/Narretz/angular.js/stargazers","contributors_url":"https://api.github.com/repos/Narretz/angular.js/contributors","subscribers_url":"https://api.github.com/repos/Narretz/angular.js/subscribers","subscription_url":"https://api.github.com/repos/Narretz/angular.js/subscription","commits_url":"https://api.github.com/repos/Narretz/angular.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Narretz/angular.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Narretz/angular.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Narretz/angular.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Narretz/angular.js/contents/{+path}","compare_url":"https://api.github.com/repos/Narretz/angular.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Narretz/angular.js/merges","archive_url":"https://api.github.com/repos/Narretz/angular.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Narretz/angular.js/downloads","issues_url":"https://api.github.com/repos/Narretz/angular.js/issues{/number}","pulls_url":"https://api.github.com/repos/Narretz/angular.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Narretz/angular.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Narretz/angular.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Narretz/angular.js/labels{/name}","releases_url":"https://api.github.com/repos/Narretz/angular.js/releases{/id}","deployments_url":"https://api.github.com/repos/Narretz/angular.js/deployments","created_at":"2013-11-28T09:39:41Z","updated_at":"2016-01-19T19:00:19Z","pushed_at":"2016-05-27T10:42:50Z","git_url":"git://github.com/Narretz/angular.js.git","ssh_url":"git@github.com:Narretz/angular.js.git","clone_url":"https://github.com/Narretz/angular.js.git","svn_url":"https://github.com/Narretz/angular.js","homepage":"http://angularjs.org","size":87615,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"angular:master","ref":"master","sha":"85db30a3be7918e2159b799fec190c1836b751ad","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":460078,"name":"angular.js","full_name":"angular/angular.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/angular.js","description":"HTML enhanced for web apps","fork":false,"url":"https://api.github.com/repos/angular/angular.js","forks_url":"https://api.github.com/repos/angular/angular.js/forks","keys_url":"https://api.github.com/repos/angular/angular.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular.js/teams","hooks_url":"https://api.github.com/repos/angular/angular.js/hooks","issue_events_url":"https://api.github.com/repos/angular/angular.js/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular.js/events","assignees_url":"https://api.github.com/repos/angular/angular.js/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular.js/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular.js/tags","blobs_url":"https://api.github.com/repos/angular/angular.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular.js/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular.js/languages","stargazers_url":"https://api.github.com/repos/angular/angular.js/stargazers","contributors_url":"https://api.github.com/repos/angular/angular.js/contributors","subscribers_url":"https://api.github.com/repos/angular/angular.js/subscribers","subscription_url":"https://api.github.com/repos/angular/angular.js/subscription","commits_url":"https://api.github.com/repos/angular/angular.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular.js/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular.js/merges","archive_url":"https://api.github.com/repos/angular/angular.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular.js/downloads","issues_url":"https://api.github.com/repos/angular/angular.js/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular.js/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular.js/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular.js/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular.js/releases{/id}","deployments_url":"https://api.github.com/repos/angular/angular.js/deployments","created_at":"2010-01-06T00:34:37Z","updated_at":"2016-05-27T10:34:35Z","pushed_at":"2016-05-27T10:44:23Z","git_url":"git://github.com/angular/angular.js.git","ssh_url":"git@github.com:angular/angular.js.git","clone_url":"https://github.com/angular/angular.js.git","svn_url":"https://github.com/angular/angular.js","homepage":"http://angularjs.org","size":186264,"stargazers_count":49524,"watchers_count":49524,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23845,"mirror_url":null,"open_issues_count":1091,"forks":23845,"open_issues":1091,"watchers":49524,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular.js/pulls/14685"},"html":{"href":"https://github.com/angular/angular.js/pull/14685"},"issue":{"href":"https://api.github.com/repos/angular/angular.js/issues/14685"},"comments":{"href":"https://api.github.com/repos/angular/angular.js/issues/14685/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular.js/pulls/14685/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular.js/pulls/14685/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular.js/statuses/ee23d70e97b47709cc1c5f3f0e147e4042275d3a"}}}}
{"actor":{"display_login":"Narretz"}}