{"action":"created","issue":{"url":"https://api.github.com/repos/tmpvar/jsdom/issues/1025","labels_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1025/labels{/name}","comments_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1025/comments","events_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1025/events","html_url":"https://github.com/tmpvar/jsdom/pull/1025","id":57060025,"number":1025,"title":"Fix node-canvas integration by extending setAttribute from Element.","user":{"login":"robertjustjones","id":969390,"avatar_url":"https://avatars.githubusercontent.com/u/969390?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjustjones","html_url":"https://github.com/robertjustjones","followers_url":"https://api.github.com/users/robertjustjones/followers","following_url":"https://api.github.com/users/robertjustjones/following{/other_user}","gists_url":"https://api.github.com/users/robertjustjones/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjustjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjustjones/subscriptions","organizations_url":"https://api.github.com/users/robertjustjones/orgs","repos_url":"https://api.github.com/users/robertjustjones/repos","events_url":"https://api.github.com/users/robertjustjones/events{/privacy}","received_events_url":"https://api.github.com/users/robertjustjones/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-09T17:13:06Z","updated_at":"2015-04-21T15:01:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tmpvar/jsdom/pulls/1025","html_url":"https://github.com/tmpvar/jsdom/pull/1025","diff_url":"https://github.com/tmpvar/jsdom/pull/1025.diff","patch_url":"https://github.com/tmpvar/jsdom/pull/1025.patch"},"body":"Using the node-canvas integration with jsdom in a [simple example](https://gist.github.com/robertjustjones/9af52b2eccfbf6187ae1) will issue the following error on toDataURL():\r\n\r\n```[Error: the surface type is not appropriate for the operation]```\r\n\r\nThe root cause is that the canvas width/height do not get set by the setAttribute methods of Element.  The PR bridges and extends certain setters for Element so that both htmltodom and later calls to setAttribute now work. Although admittedly hacky, the fix is in the \"transitional\" code and applies only when node-canvas is used.  There could be other setters that need to be extended. If there's a suggestion for a cleaner or more complete fix, I'd be happy to test that. You can imagine it took a fair amount of spelunking to get to this version ;-).\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/tmpvar/jsdom/issues/comments/94831382","html_url":"https://github.com/tmpvar/jsdom/pull/1025#issuecomment-94831382","issue_url":"https://api.github.com/repos/tmpvar/jsdom/issues/1025","id":94831382,"user":{"login":"robertjustjones","id":969390,"avatar_url":"https://avatars.githubusercontent.com/u/969390?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjustjones","html_url":"https://github.com/robertjustjones","followers_url":"https://api.github.com/users/robertjustjones/followers","following_url":"https://api.github.com/users/robertjustjones/following{/other_user}","gists_url":"https://api.github.com/users/robertjustjones/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjustjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjustjones/subscriptions","organizations_url":"https://api.github.com/users/robertjustjones/orgs","repos_url":"https://api.github.com/users/robertjustjones/repos","events_url":"https://api.github.com/users/robertjustjones/events{/privacy}","received_events_url":"https://api.github.com/users/robertjustjones/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T15:01:10Z","updated_at":"2015-04-21T15:01:10Z","body":"@domenic I've updated to node-canvas@1.2.2 now that the npm registry is updated ;-).\r\n\r\nCan you help me with why the build fails here? It's working in my environment for iojs-v1.8.1.\r\n```\r\n$ node --version\r\nv1.8.1\r\n$ npm --version\r\n2.8.3\r\n$ nvm --version\r\n0.23.3\r\n```\r\n"}}