{"action":"closed","issue":{"url":"https://api.github.com/repos/aframevr/aframe/issues/571","labels_url":"https://api.github.com/repos/aframevr/aframe/issues/571/labels{/name}","comments_url":"https://api.github.com/repos/aframevr/aframe/issues/571/comments","events_url":"https://api.github.com/repos/aframevr/aframe/issues/571/events","html_url":"https://github.com/aframevr/aframe/issues/571","id":126331942,"number":571,"title":"[CLOSED] Bubble events fired on `VRNode`","user":{"login":"ngokevin","id":674727,"avatar_url":"https://avatars.githubusercontent.com/u/674727?v=3","gravatar_id":"","url":"https://api.github.com/users/ngokevin","html_url":"https://github.com/ngokevin","followers_url":"https://api.github.com/users/ngokevin/followers","following_url":"https://api.github.com/users/ngokevin/following{/other_user}","gists_url":"https://api.github.com/users/ngokevin/gists{/gist_id}","starred_url":"https://api.github.com/users/ngokevin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngokevin/subscriptions","organizations_url":"https://api.github.com/users/ngokevin/orgs","repos_url":"https://api.github.com/users/ngokevin/repos","events_url":"https://api.github.com/users/ngokevin/events{/privacy}","received_events_url":"https://api.github.com/users/ngokevin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aframevr/aframe/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-13T03:19:04Z","updated_at":"2016-01-13T03:34:13Z","closed_at":"2016-01-13T03:34:13Z","body":"<a href=\"https://github.com/cvan\"><img src=\"https://avatars.githubusercontent.com/u/203725?v=3\" align=\"left\" width=\"96\" height=\"96\" hspace=\"10\"></img></a> **Issue by [cvan](https://github.com/cvan)**\n_Wednesday Oct 21, 2015 at 22:12 GMT_\n_Originally opened as https://github.com/aframevr/aframe-core/issues/301_\n\n----\n\nWould be nice, so you could just listen for delegated clicks on `<vr-scene>`. So you don't have to add event listeners to every object you want to listen to.\r\n\r\nStarted:\r\n\r\n```diff\r\ndiff --git a/src/components/cursor.js b/src/components/cursor.js\r\nindex 16a9014..49d0ddb 100644\r\n--- a/src/components/cursor.js\r\n+++ b/src/components/cursor.js\r\n@@ -45,8 +45,8 @@ module.exports.Component = registerComponent('cursor', {\r\n       this.emit('mouseup');\r\n       if (this.data.fuse) { return; }\r\n       if (this.mouseDownEl === this.intersectedEl) {\r\n-        this.emit('click');\r\n-        this.intersectedEl.emit('click');\r\n+        this.emit('click', null, {bubbles: true});\r\n+        this.intersectedEl.emit('click', null, {bubbles: true});\r\n       }\r\n     }\r\n   },\r\n@@ -80,7 +80,7 @@ module.exports.Component = registerComponent('cursor', {\r\n       this.el.addState('hovering');\r\n       if (data.timeout === 0) { return; }\r\n       if (!data.fuse) { return; }\r\n-      this.fuseTimeout = setTimeout(this.emitter('click'), data.timeout);\r\n+      this.fuseTimeout = setTimeout(this.emitter('click', null, {bubbles: true}), data.timeout);\r\n     }\r\n   },\r\n \r\ndiff --git a/src/vr-utils.js b/src/vr-utils.js\r\nindex 458dbff..dbb03c5 100644\r\n--- a/src/vr-utils.js\r\n+++ b/src/vr-utils.js\r\n@@ -5,10 +5,17 @@\r\n  *\r\n  * @param {Element} el Element to fire the event on.\r\n  * @param {String} name Name of the event.\r\n- * @param {Object} detail Custom data to pass as `detail` if the event is a Custom Event.\r\n+ * @param {Object=} detail Custom data to pass as `detail` if the event is a Custom Event.\r\n+ * @param {Object=} customEventInit Custom data to pass if the event is a Custom Event.\r\n  */\r\n-module.exports.fireEvent = function (el, name, detail) {\r\n-  var evt = detail ? new CustomEvent(name, { detail: detail }) : new Event(name);\r\n+module.exports.fireEvent = function (el, name, detail, customEventInit) {\r\n+  if (detail || customEventInit) {\r\n+    customEventInit = customEventInit || {};\r\n+    customEventInit.detail = detail || {};\r\n+    customEventInit.detail.target = el;\r\n+  }\r\n+  var evt = customEventInit ? new CustomEvent(name, customEventInit) : new Event(name);\r\n+  evt.target = el;\r\n   el.dispatchEvent(evt);\r\n };\r\n ```\r\n\n"}}