{"action":"created","comment":{"url":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/54435638","id":54435638,"diff_hunk":"@@ -1,12 +1,74 @@\n \"use strict\";\n \n const HTMLElementImpl = require(\"./HTMLElement-impl\").implementation;\n+const MouseEvent = require(\"../generated/MouseEvent\");\n const closest = require(\"../helpers/traversal\").closest;\n+const domSymbolTree = require(\"../helpers/internal-constants\").domSymbolTree;\n+\n+function isLabelable(node) {\n+  /* labelable logic defined at: https://html.spec.whatwg.org/multipage/forms.html#category-label */\n+  if (node.nodeType !== 1) { return false; }\n+\n+  switch (node.tagName) {\n+  case 'BUTTON':\n+  case 'KEYGEN':\n+  case 'METER':\n+  case 'OUTPUT':\n+  case 'PROGRESS':\n+  case 'SELECT':\n+  case 'TEXTAREA':\n+    return true;\n+\n+  case 'INPUT':\n+    return node.type !== 'hidden' ? true : false;\n+  }\n+\n+  return false;\n+}\n+\n+function sendClickToAssociatedNode(node) {\n+  node.dispatchEvent(\n+    MouseEvent.createImpl(['click', {","path":"lib/jsdom/living/nodes/HTMLLabelElement-impl.js","position":31,"original_position":31,"commit_id":"d9e933a43f580a50dde70c5ac4b75c6ff645dd90","original_commit_id":"d9e933a43f580a50dde70c5ac4b75c6ff645dd90","user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"body":"This should be `new MouseEvent` where `MouseEvent` is `require(\"../generated/MouseEvent\").interface`, I think. Right, @Sebmaster?","created_at":"2016-02-29T16:30:34Z","updated_at":"2016-02-29T16:30:34Z","html_url":"https://github.com/tmpvar/jsdom/pull/1399#discussion_r54435638","pull_request_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399","_links":{"self":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/54435638"},"html":{"href":"https://github.com/tmpvar/jsdom/pull/1399#discussion_r54435638"},"pull_request":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399"}}},"pull_request":{"url":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399","id":60982439,"html_url":"https://github.com/tmpvar/jsdom/pull/1399","diff_url":"https://github.com/tmpvar/jsdom/pull/1399.diff","patch_url":"https://github.com/tmpvar/jsdom/pull/1399.patch","issue_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1399","number":1399,"state":"open","locked":false,"title":"Add click proxy behavior for label elements","user":{"login":"yaycmyk","id":570070,"avatar_url":"https://avatars.githubusercontent.com/u/570070?v=3","gravatar_id":"","url":"https://api.github.com/users/yaycmyk","html_url":"https://github.com/yaycmyk","followers_url":"https://api.github.com/users/yaycmyk/followers","following_url":"https://api.github.com/users/yaycmyk/following{/other_user}","gists_url":"https://api.github.com/users/yaycmyk/gists{/gist_id}","starred_url":"https://api.github.com/users/yaycmyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaycmyk/subscriptions","organizations_url":"https://api.github.com/users/yaycmyk/orgs","repos_url":"https://api.github.com/users/yaycmyk/repos","events_url":"https://api.github.com/users/yaycmyk/events{/privacy}","received_events_url":"https://api.github.com/users/yaycmyk/received_events","type":"User","site_admin":false},"body":"Clicking on a label element should trigger activation on an associated element via the `for` attribute linking, or simple nesting (if the associated element meets the [labeling criteria](https://html.spec.whatwg.org/multipage/forms.html#the-label-element:the-label-element-10)).\r\n\r\nI would also like to note that I tried very hard to get the `NodeIterator` API to work, but it doesn't seem to be hooked up, unfortunately.","created_at":"2016-02-28T07:39:32Z","updated_at":"2016-02-29T16:30:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc95028c07046a47896e0fdb6e2e67029e16e95f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399/commits","review_comments_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399/comments","review_comment_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1399/comments","statuses_url":"https://api.github.com/repos/tmpvar/jsdom/statuses/d9e933a43f580a50dde70c5ac4b75c6ff645dd90","head":{"label":"yaycmyk:label-input-activation","ref":"label-input-activation","sha":"d9e933a43f580a50dde70c5ac4b75c6ff645dd90","user":{"login":"yaycmyk","id":570070,"avatar_url":"https://avatars.githubusercontent.com/u/570070?v=3","gravatar_id":"","url":"https://api.github.com/users/yaycmyk","html_url":"https://github.com/yaycmyk","followers_url":"https://api.github.com/users/yaycmyk/followers","following_url":"https://api.github.com/users/yaycmyk/following{/other_user}","gists_url":"https://api.github.com/users/yaycmyk/gists{/gist_id}","starred_url":"https://api.github.com/users/yaycmyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaycmyk/subscriptions","organizations_url":"https://api.github.com/users/yaycmyk/orgs","repos_url":"https://api.github.com/users/yaycmyk/repos","events_url":"https://api.github.com/users/yaycmyk/events{/privacy}","received_events_url":"https://api.github.com/users/yaycmyk/received_events","type":"User","site_admin":false},"repo":{"id":47051181,"name":"jsdom","full_name":"yaycmyk/jsdom","owner":{"login":"yaycmyk","id":570070,"avatar_url":"https://avatars.githubusercontent.com/u/570070?v=3","gravatar_id":"","url":"https://api.github.com/users/yaycmyk","html_url":"https://github.com/yaycmyk","followers_url":"https://api.github.com/users/yaycmyk/followers","following_url":"https://api.github.com/users/yaycmyk/following{/other_user}","gists_url":"https://api.github.com/users/yaycmyk/gists{/gist_id}","starred_url":"https://api.github.com/users/yaycmyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaycmyk/subscriptions","organizations_url":"https://api.github.com/users/yaycmyk/orgs","repos_url":"https://api.github.com/users/yaycmyk/repos","events_url":"https://api.github.com/users/yaycmyk/events{/privacy}","received_events_url":"https://api.github.com/users/yaycmyk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yaycmyk/jsdom","description":"A JavaScript implementation of the WHATWG DOM and HTML standards, for use with node.js","fork":true,"url":"https://api.github.com/repos/yaycmyk/jsdom","forks_url":"https://api.github.com/repos/yaycmyk/jsdom/forks","keys_url":"https://api.github.com/repos/yaycmyk/jsdom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yaycmyk/jsdom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yaycmyk/jsdom/teams","hooks_url":"https://api.github.com/repos/yaycmyk/jsdom/hooks","issue_events_url":"https://api.github.com/repos/yaycmyk/jsdom/issues/events{/number}","events_url":"https://api.github.com/repos/yaycmyk/jsdom/events","assignees_url":"https://api.github.com/repos/yaycmyk/jsdom/assignees{/user}","branches_url":"https://api.github.com/repos/yaycmyk/jsdom/branches{/branch}","tags_url":"https://api.github.com/repos/yaycmyk/jsdom/tags","blobs_url":"https://api.github.com/repos/yaycmyk/jsdom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yaycmyk/jsdom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yaycmyk/jsdom/git/refs{/sha}","trees_url":"https://api.github.com/repos/yaycmyk/jsdom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yaycmyk/jsdom/statuses/{sha}","languages_url":"https://api.github.com/repos/yaycmyk/jsdom/languages","stargazers_url":"https://api.github.com/repos/yaycmyk/jsdom/stargazers","contributors_url":"https://api.github.com/repos/yaycmyk/jsdom/contributors","subscribers_url":"https://api.github.com/repos/yaycmyk/jsdom/subscribers","subscription_url":"https://api.github.com/repos/yaycmyk/jsdom/subscription","commits_url":"https://api.github.com/repos/yaycmyk/jsdom/commits{/sha}","git_commits_url":"https://api.github.com/repos/yaycmyk/jsdom/git/commits{/sha}","comments_url":"https://api.github.com/repos/yaycmyk/jsdom/comments{/number}","issue_comment_url":"https://api.github.com/repos/yaycmyk/jsdom/issues/comments{/number}","contents_url":"https://api.github.com/repos/yaycmyk/jsdom/contents/{+path}","compare_url":"https://api.github.com/repos/yaycmyk/jsdom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yaycmyk/jsdom/merges","archive_url":"https://api.github.com/repos/yaycmyk/jsdom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yaycmyk/jsdom/downloads","issues_url":"https://api.github.com/repos/yaycmyk/jsdom/issues{/number}","pulls_url":"https://api.github.com/repos/yaycmyk/jsdom/pulls{/number}","milestones_url":"https://api.github.com/repos/yaycmyk/jsdom/milestones{/number}","notifications_url":"https://api.github.com/repos/yaycmyk/jsdom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yaycmyk/jsdom/labels{/name}","releases_url":"https://api.github.com/repos/yaycmyk/jsdom/releases{/id}","deployments_url":"https://api.github.com/repos/yaycmyk/jsdom/deployments","created_at":"2015-11-29T05:24:18Z","updated_at":"2016-02-19T04:58:20Z","pushed_at":"2016-02-28T14:23:55Z","git_url":"git://github.com/yaycmyk/jsdom.git","ssh_url":"git@github.com:yaycmyk/jsdom.git","clone_url":"https://github.com/yaycmyk/jsdom.git","svn_url":"https://github.com/yaycmyk/jsdom","homepage":"","size":10683,"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":"tmpvar:master","ref":"master","sha":"9ef5127dfe5ca5549c8a5911246d5727bedda58b","user":{"login":"tmpvar","id":46673,"avatar_url":"https://avatars.githubusercontent.com/u/46673?v=3","gravatar_id":"","url":"https://api.github.com/users/tmpvar","html_url":"https://github.com/tmpvar","followers_url":"https://api.github.com/users/tmpvar/followers","following_url":"https://api.github.com/users/tmpvar/following{/other_user}","gists_url":"https://api.github.com/users/tmpvar/gists{/gist_id}","starred_url":"https://api.github.com/users/tmpvar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmpvar/subscriptions","organizations_url":"https://api.github.com/users/tmpvar/orgs","repos_url":"https://api.github.com/users/tmpvar/repos","events_url":"https://api.github.com/users/tmpvar/events{/privacy}","received_events_url":"https://api.github.com/users/tmpvar/received_events","type":"User","site_admin":false},"repo":{"id":478584,"name":"jsdom","full_name":"tmpvar/jsdom","owner":{"login":"tmpvar","id":46673,"avatar_url":"https://avatars.githubusercontent.com/u/46673?v=3","gravatar_id":"","url":"https://api.github.com/users/tmpvar","html_url":"https://github.com/tmpvar","followers_url":"https://api.github.com/users/tmpvar/followers","following_url":"https://api.github.com/users/tmpvar/following{/other_user}","gists_url":"https://api.github.com/users/tmpvar/gists{/gist_id}","starred_url":"https://api.github.com/users/tmpvar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmpvar/subscriptions","organizations_url":"https://api.github.com/users/tmpvar/orgs","repos_url":"https://api.github.com/users/tmpvar/repos","events_url":"https://api.github.com/users/tmpvar/events{/privacy}","received_events_url":"https://api.github.com/users/tmpvar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tmpvar/jsdom","description":"A JavaScript implementation of the WHATWG DOM and HTML standards, for use with node.js","fork":false,"url":"https://api.github.com/repos/tmpvar/jsdom","forks_url":"https://api.github.com/repos/tmpvar/jsdom/forks","keys_url":"https://api.github.com/repos/tmpvar/jsdom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tmpvar/jsdom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tmpvar/jsdom/teams","hooks_url":"https://api.github.com/repos/tmpvar/jsdom/hooks","issue_events_url":"https://api.github.com/repos/tmpvar/jsdom/issues/events{/number}","events_url":"https://api.github.com/repos/tmpvar/jsdom/events","assignees_url":"https://api.github.com/repos/tmpvar/jsdom/assignees{/user}","branches_url":"https://api.github.com/repos/tmpvar/jsdom/branches{/branch}","tags_url":"https://api.github.com/repos/tmpvar/jsdom/tags","blobs_url":"https://api.github.com/repos/tmpvar/jsdom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tmpvar/jsdom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tmpvar/jsdom/git/refs{/sha}","trees_url":"https://api.github.com/repos/tmpvar/jsdom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tmpvar/jsdom/statuses/{sha}","languages_url":"https://api.github.com/repos/tmpvar/jsdom/languages","stargazers_url":"https://api.github.com/repos/tmpvar/jsdom/stargazers","contributors_url":"https://api.github.com/repos/tmpvar/jsdom/contributors","subscribers_url":"https://api.github.com/repos/tmpvar/jsdom/subscribers","subscription_url":"https://api.github.com/repos/tmpvar/jsdom/subscription","commits_url":"https://api.github.com/repos/tmpvar/jsdom/commits{/sha}","git_commits_url":"https://api.github.com/repos/tmpvar/jsdom/git/commits{/sha}","comments_url":"https://api.github.com/repos/tmpvar/jsdom/comments{/number}","issue_comment_url":"https://api.github.com/repos/tmpvar/jsdom/issues/comments{/number}","contents_url":"https://api.github.com/repos/tmpvar/jsdom/contents/{+path}","compare_url":"https://api.github.com/repos/tmpvar/jsdom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tmpvar/jsdom/merges","archive_url":"https://api.github.com/repos/tmpvar/jsdom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tmpvar/jsdom/downloads","issues_url":"https://api.github.com/repos/tmpvar/jsdom/issues{/number}","pulls_url":"https://api.github.com/repos/tmpvar/jsdom/pulls{/number}","milestones_url":"https://api.github.com/repos/tmpvar/jsdom/milestones{/number}","notifications_url":"https://api.github.com/repos/tmpvar/jsdom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tmpvar/jsdom/labels{/name}","releases_url":"https://api.github.com/repos/tmpvar/jsdom/releases{/id}","deployments_url":"https://api.github.com/repos/tmpvar/jsdom/deployments","created_at":"2010-01-19T06:55:19Z","updated_at":"2016-02-29T16:26:16Z","pushed_at":"2016-02-29T07:11:58Z","git_url":"git://github.com/tmpvar/jsdom.git","ssh_url":"git@github.com:tmpvar/jsdom.git","clone_url":"https://github.com/tmpvar/jsdom.git","svn_url":"https://github.com/tmpvar/jsdom","homepage":"","size":13707,"stargazers_count":5435,"watchers_count":5435,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":597,"mirror_url":null,"open_issues_count":131,"forks":597,"open_issues":131,"watchers":5435,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399"},"html":{"href":"https://github.com/tmpvar/jsdom/pull/1399"},"issue":{"href":"https://api.github.com/repos/tmpvar/jsdom/issues/1399"},"comments":{"href":"https://api.github.com/repos/tmpvar/jsdom/issues/1399/comments"},"review_comments":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399/comments"},"review_comment":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/1399/commits"},"statuses":{"href":"https://api.github.com/repos/tmpvar/jsdom/statuses/d9e933a43f580a50dde70c5ac4b75c6ff645dd90"}}}}