{"action":"created","comment":{"url":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/22427114","id":22427114,"diff_hunk":"@@ -77,32 +78,43 @@ function Window(options) {\n   this.clearTimeout = stopTimer.bind(this, window);\n   this.__stopAllTimers = stopAllTimers.bind(this, window);\n \n+  var wrapConsoleMethod = function(method) {\n+    return function() {\n+      var args = Array.prototype.slice.call(arguments);\n+      vConsole.fireEvent(window, method, args);\n+    };\n+  };\n+\n   this.console = {","path":"lib/jsdom/browser/Window.js","position":19,"original_position":19,"commit_id":"12accff7a89715bc1941ae9287e2bdaf6197861c","original_commit_id":"12accff7a89715bc1941ae9287e2bdaf6197861c","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":"No need to keep the `raise`s. I'd like to get rid of `raise` entirely, actually.","created_at":"2015-01-02T23:56:18Z","updated_at":"2015-01-02T23:56:18Z","html_url":"https://github.com/tmpvar/jsdom/pull/991#discussion_r22427114","pull_request_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/991","_links":{"self":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/22427114"},"html":{"href":"https://github.com/tmpvar/jsdom/pull/991#discussion_r22427114"},"pull_request":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/991"}}},"pull_request":{"url":"https://api.github.com/repos/tmpvar/jsdom/pulls/991","id":26741455,"html_url":"https://github.com/tmpvar/jsdom/pull/991","diff_url":"https://github.com/tmpvar/jsdom/pull/991.diff","patch_url":"https://github.com/tmpvar/jsdom/pull/991.patch","issue_url":"https://api.github.com/repos/tmpvar/jsdom/issues/991","number":991,"state":"open","locked":false,"title":"Add virtual console","user":{"login":"jeffcarp","id":916028,"avatar_url":"https://avatars.githubusercontent.com/u/916028?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffcarp","html_url":"https://github.com/jeffcarp","followers_url":"https://api.github.com/users/jeffcarp/followers","following_url":"https://api.github.com/users/jeffcarp/following{/other_user}","gists_url":"https://api.github.com/users/jeffcarp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffcarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffcarp/subscriptions","organizations_url":"https://api.github.com/users/jeffcarp/orgs","repos_url":"https://api.github.com/users/jeffcarp/repos","events_url":"https://api.github.com/users/jeffcarp/events{/privacy}","received_events_url":"https://api.github.com/users/jeffcarp/received_events","type":"User","site_admin":false},"body":"(via #971)\r\n\r\n#### Adds:\r\n\r\n- `jsdom.getVirtualConsole`, for fetching an internal console emitter\r\n- `virtualConsole.sendTo`, for forwarding internal output to any console\r\n\r\n#### Design decisions:\r\n\r\n1. `sendTo` requires its argument to only have at least one valid console method. I did this so that you could pick and choose which methods you wanted to proxy. Let me know if you think it should be fully compliant.\r\n1. Kept the `window.raise` calls in the original console handlers (it looks like `'error'` is [the only method that has a side effect](https://github.com/jeffcarp/jsdom/blob/virtual-console/lib/jsdom/level1/core.js#L969)  in `raise`).\r\n\r\n#### Questions:\r\n\r\n1. The way I accomplished keeping console events separate between windows doesn't feel super elegant. If anything comes to mind in this area I'd love to hear how to improve it.\r\n1. This PR doesn't replicate any console functionality (like `console.count` having internal state). Is that a needed feature?\r\n\r\n~~[edit] jshint fixes forthcoming...~~","created_at":"2015-01-01T08:25:43Z","updated_at":"2015-01-02T23:56:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5a09fda790bdac37962641f6a51aa368beee2a45","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/991/commits","review_comments_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/991/comments","review_comment_url":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/{number}","comments_url":"https://api.github.com/repos/tmpvar/jsdom/issues/991/comments","statuses_url":"https://api.github.com/repos/tmpvar/jsdom/statuses/12accff7a89715bc1941ae9287e2bdaf6197861c","head":{"label":"jeffcarp:virtual-console","ref":"virtual-console","sha":"12accff7a89715bc1941ae9287e2bdaf6197861c","user":{"login":"jeffcarp","id":916028,"avatar_url":"https://avatars.githubusercontent.com/u/916028?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffcarp","html_url":"https://github.com/jeffcarp","followers_url":"https://api.github.com/users/jeffcarp/followers","following_url":"https://api.github.com/users/jeffcarp/following{/other_user}","gists_url":"https://api.github.com/users/jeffcarp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffcarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffcarp/subscriptions","organizations_url":"https://api.github.com/users/jeffcarp/orgs","repos_url":"https://api.github.com/users/jeffcarp/repos","events_url":"https://api.github.com/users/jeffcarp/events{/privacy}","received_events_url":"https://api.github.com/users/jeffcarp/received_events","type":"User","site_admin":false},"repo":{"id":26305355,"name":"jsdom","full_name":"jeffcarp/jsdom","owner":{"login":"jeffcarp","id":916028,"avatar_url":"https://avatars.githubusercontent.com/u/916028?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffcarp","html_url":"https://github.com/jeffcarp","followers_url":"https://api.github.com/users/jeffcarp/followers","following_url":"https://api.github.com/users/jeffcarp/following{/other_user}","gists_url":"https://api.github.com/users/jeffcarp/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffcarp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffcarp/subscriptions","organizations_url":"https://api.github.com/users/jeffcarp/orgs","repos_url":"https://api.github.com/users/jeffcarp/repos","events_url":"https://api.github.com/users/jeffcarp/events{/privacy}","received_events_url":"https://api.github.com/users/jeffcarp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeffcarp/jsdom","description":"A javascript implementation of the DOM, for use with node.js.","fork":true,"url":"https://api.github.com/repos/jeffcarp/jsdom","forks_url":"https://api.github.com/repos/jeffcarp/jsdom/forks","keys_url":"https://api.github.com/repos/jeffcarp/jsdom/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeffcarp/jsdom/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeffcarp/jsdom/teams","hooks_url":"https://api.github.com/repos/jeffcarp/jsdom/hooks","issue_events_url":"https://api.github.com/repos/jeffcarp/jsdom/issues/events{/number}","events_url":"https://api.github.com/repos/jeffcarp/jsdom/events","assignees_url":"https://api.github.com/repos/jeffcarp/jsdom/assignees{/user}","branches_url":"https://api.github.com/repos/jeffcarp/jsdom/branches{/branch}","tags_url":"https://api.github.com/repos/jeffcarp/jsdom/tags","blobs_url":"https://api.github.com/repos/jeffcarp/jsdom/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeffcarp/jsdom/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeffcarp/jsdom/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeffcarp/jsdom/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeffcarp/jsdom/statuses/{sha}","languages_url":"https://api.github.com/repos/jeffcarp/jsdom/languages","stargazers_url":"https://api.github.com/repos/jeffcarp/jsdom/stargazers","contributors_url":"https://api.github.com/repos/jeffcarp/jsdom/contributors","subscribers_url":"https://api.github.com/repos/jeffcarp/jsdom/subscribers","subscription_url":"https://api.github.com/repos/jeffcarp/jsdom/subscription","commits_url":"https://api.github.com/repos/jeffcarp/jsdom/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeffcarp/jsdom/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeffcarp/jsdom/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeffcarp/jsdom/issues/comments/{number}","contents_url":"https://api.github.com/repos/jeffcarp/jsdom/contents/{+path}","compare_url":"https://api.github.com/repos/jeffcarp/jsdom/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeffcarp/jsdom/merges","archive_url":"https://api.github.com/repos/jeffcarp/jsdom/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeffcarp/jsdom/downloads","issues_url":"https://api.github.com/repos/jeffcarp/jsdom/issues{/number}","pulls_url":"https://api.github.com/repos/jeffcarp/jsdom/pulls{/number}","milestones_url":"https://api.github.com/repos/jeffcarp/jsdom/milestones{/number}","notifications_url":"https://api.github.com/repos/jeffcarp/jsdom/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeffcarp/jsdom/labels{/name}","releases_url":"https://api.github.com/repos/jeffcarp/jsdom/releases{/id}","created_at":"2014-11-07T05:31:51Z","updated_at":"2014-12-28T06:31:39Z","pushed_at":"2015-01-02T04:49:26Z","git_url":"git://github.com/jeffcarp/jsdom.git","ssh_url":"git@github.com:jeffcarp/jsdom.git","clone_url":"https://github.com/jeffcarp/jsdom.git","svn_url":"https://github.com/jeffcarp/jsdom","homepage":"","size":9234,"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":"ae490dd733ca5be56c952df5c3b122b768fe2909","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 DOM, 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}","created_at":"2010-01-19T06:55:19Z","updated_at":"2015-01-02T13:07:16Z","pushed_at":"2014-12-29T16:31:51Z","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":15525,"stargazers_count":3613,"watchers_count":3613,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":427,"mirror_url":null,"open_issues_count":117,"forks":427,"open_issues":117,"watchers":3613,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/991"},"html":{"href":"https://github.com/tmpvar/jsdom/pull/991"},"issue":{"href":"https://api.github.com/repos/tmpvar/jsdom/issues/991"},"comments":{"href":"https://api.github.com/repos/tmpvar/jsdom/issues/991/comments"},"review_comments":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/991/comments"},"review_comment":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/tmpvar/jsdom/pulls/991/commits"},"statuses":{"href":"https://api.github.com/repos/tmpvar/jsdom/statuses/12accff7a89715bc1941ae9287e2bdaf6197861c"}}}}