{"action":"closed","issue":{"url":"https://api.github.com/repos/GetmeUK/ContentTools/issues/111","labels_url":"https://api.github.com/repos/GetmeUK/ContentTools/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/GetmeUK/ContentTools/issues/111/comments","events_url":"https://api.github.com/repos/GetmeUK/ContentTools/issues/111/events","html_url":"https://github.com/GetmeUK/ContentTools/issues/111","id":128722380,"number":111,"title":"Attributes with quotation marks in the value get busted on attributesToString","user":{"login":"bfintal","id":1033611,"avatar_url":"https://avatars.githubusercontent.com/u/1033611?v=3","gravatar_id":"","url":"https://api.github.com/users/bfintal","html_url":"https://github.com/bfintal","followers_url":"https://api.github.com/users/bfintal/followers","following_url":"https://api.github.com/users/bfintal/following{/other_user}","gists_url":"https://api.github.com/users/bfintal/gists{/gist_id}","starred_url":"https://api.github.com/users/bfintal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bfintal/subscriptions","organizations_url":"https://api.github.com/users/bfintal/orgs","repos_url":"https://api.github.com/users/bfintal/repos","events_url":"https://api.github.com/users/bfintal/events{/privacy}","received_events_url":"https://api.github.com/users/bfintal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GetmeUK/ContentTools/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-26T04:36:41Z","updated_at":"2016-01-26T11:22:35Z","closed_at":"2016-01-26T11:22:35Z","body":"For example if you have a background image in the style attribute:\r\n\r\n    elem.attr( 'style', 'background-image: url(\"http://somepath.to/image.jpg\")' );\r\n\r\nor even without the quotes since they get added when you get the attribute:\r\n\r\n    elem.attr( 'style', 'background-image: url(http://somepath.to/image.jpg)' );\r\n\r\nUpon saving, the quotes breaks the output of the function `attributesToString` into\r\n\r\n    style=\"background-image: url(&quot;&quot;);\" http:=\"\" somepath.to=\"\" image.jpg=\"\"\r\n\r\nHere's my fix:\r\n\r\n\t(function() {\r\n\t\tvar proxied = window.ContentEdit.attributesToString;\r\n\t\twindow.ContentEdit.attributesToString = function( attributes ) {\r\n\t\t\tfor ( var i in attributes ) {\r\n\t\t\t\tif ( typeof attributes[ i ] === 'string' ) {\r\n\t\t\t\t\tattributes[ i ] = attributes[ i ].replace( /\\\"/g, '\\'' );\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn proxied.call( this, attributes );\r\n\t\t};\r\n\t})();"}}