{"action":"opened","issue":{"url":"https://api.github.com/repos/cyclejs/cycle-dom/issues/81","labels_url":"https://api.github.com/repos/cyclejs/cycle-dom/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/cyclejs/cycle-dom/issues/81/comments","events_url":"https://api.github.com/repos/cyclejs/cycle-dom/issues/81/events","html_url":"https://github.com/cyclejs/cycle-dom/issues/81","id":122389008,"number":81,"title":"isolateSink svg","user":{"login":"laszlokorte","id":26493,"avatar_url":"https://avatars.githubusercontent.com/u/26493?v=3","gravatar_id":"","url":"https://api.github.com/users/laszlokorte","html_url":"https://github.com/laszlokorte","followers_url":"https://api.github.com/users/laszlokorte/followers","following_url":"https://api.github.com/users/laszlokorte/following{/other_user}","gists_url":"https://api.github.com/users/laszlokorte/gists{/gist_id}","starred_url":"https://api.github.com/users/laszlokorte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laszlokorte/subscriptions","organizations_url":"https://api.github.com/users/laszlokorte/orgs","repos_url":"https://api.github.com/users/laszlokorte/repos","events_url":"https://api.github.com/users/laszlokorte/events{/privacy}","received_events_url":"https://api.github.com/users/laszlokorte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-15T23:06:06Z","updated_at":"2015-12-15T23:06:06Z","closed_at":null,"body":"isolateSink does not work with svg elements, because it modifies `vnode.properties.className` but className is not supported by svg nodes.\r\n\r\nSee:\r\nhttps://github.com/Matt-Esch/virtual-dom/issues/262\r\nhttps://github.com/Matt-Esch/virtual-dom/pull/271\r\n\r\nLocally I did the following, but there might be a better solutions.\r\n(I am not perfectly sure what exactly are the differences between attributes.class and properties.className inside virtual-dom except that one works for svg and the other does not)\r\n```diff\r\nfunction isolateSink(sink, scope) {\r\n  return sink.map(function (vtree) {\r\n    var _vtree$properties$className2 = vtree.properties.className;\r\n    var vtreeClass = _vtree$properties$className2 === undefined ? \"\" : _vtree$properties$className2;\r\n\r\n    if (vtreeClass.indexOf(\"cycle-scope-\" + scope) === -1) {\r\n      var c = (vtreeClass + \" cycle-scope-\" + scope).trim();\r\n      vtree.properties.className = c;\r\n    }\r\n\r\n+    if(vtree.properties.attributes) {\r\n+      var _vtree$attributes$class2 = vtree.properties.attributes.class;\r\n+      var vtreeAttrClass = _vtree$attributes$class2 === undefined ? \"\" : _vtree$attributes$class2;\r\n+\r\n+      if (vtreeAttrClass.indexOf(\"cycle-scope-\" + scope) === -1) {\r\n+        var cattr = (vtreeAttrClass + \" cycle-scope-\" + scope).trim();\r\n+        vtree.properties.attributes.class = cattr;\r\n+      }\r\n+    }\r\n\r\n    return vtree;\r\n  });\r\n}\r\n```\r\nThe `if(vtree.properties.attributes)` check is not quite correct because one might want to set the class even if no other attributes have been set."}}