{"action":"created","comment":{"url":"https://api.github.com/repos/peterbe/premailer/pulls/comments/38936199","id":38936199,"diff_hunk":"@@ -2419,3 +2429,37 @@ def test_links_without_protocol(self):\n         # Because you can't set a base_url without a full protocol\n         p = Premailer(html, base_url='www.peterbe.com')\n         assert_raises(ValueError, p.transform)\n+\n+    def test_unset_removes_attribute(self):\n+        html = \"\"\"<html>\n+        <head>\n+        <style>\n+        div {\n+            color: green;\n+        }\n+        span {\n+            color: blue;\n+        }\n+        span.nocolor {\n+            color: unset;\n+        }\n+        </style>\n+        </head>\n+        <body>\n+        <div class=\"color\"><span class=\"nocolor\"></span></div>\n+        </body>\n+        </html>\"\"\"\n+\n+        expect_html = \"\"\"<html>\n+        <head>\n+        </head>\n+        <body>\n+        <div style=\"color:green\"><span></span></div>\n+        </body>\n+        </html>\"\"\"\n+\n+        p = Premailer(html, unset_removes_attribute=True)\n+        self.assertTrue(p.unset_removes_attribute)\n+        result_html = p.transform()\n+        print result_html","path":"premailer/tests/test_premailer.py","position":53,"original_position":53,"commit_id":"d3b1be67939ed900db5fbde752613c70021e5689","original_commit_id":"d3b1be67939ed900db5fbde752613c70021e5689","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"body":"debugging left-overs presumably :)","created_at":"2015-09-08T15:02:31Z","updated_at":"2015-09-08T15:02:31Z","html_url":"https://github.com/peterbe/premailer/pull/136#discussion_r38936199","pull_request_url":"https://api.github.com/repos/peterbe/premailer/pulls/136","_links":{"self":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/comments/38936199"},"html":{"href":"https://github.com/peterbe/premailer/pull/136#discussion_r38936199"},"pull_request":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/136"}}},"pull_request":{"url":"https://api.github.com/repos/peterbe/premailer/pulls/136","id":44245647,"html_url":"https://github.com/peterbe/premailer/pull/136","diff_url":"https://github.com/peterbe/premailer/pull/136.diff","patch_url":"https://github.com/peterbe/premailer/pull/136.patch","issue_url":"https://api.github.com/repos/peterbe/premailer/issues/136","number":136,"state":"open","locked":false,"title":"add `unset_removes_attribute` option","user":{"login":"elidickinson","id":44751,"avatar_url":"https://avatars.githubusercontent.com/u/44751?v=3","gravatar_id":"","url":"https://api.github.com/users/elidickinson","html_url":"https://github.com/elidickinson","followers_url":"https://api.github.com/users/elidickinson/followers","following_url":"https://api.github.com/users/elidickinson/following{/other_user}","gists_url":"https://api.github.com/users/elidickinson/gists{/gist_id}","starred_url":"https://api.github.com/users/elidickinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elidickinson/subscriptions","organizations_url":"https://api.github.com/users/elidickinson/orgs","repos_url":"https://api.github.com/users/elidickinson/repos","events_url":"https://api.github.com/users/elidickinson/events{/privacy}","received_events_url":"https://api.github.com/users/elidickinson/received_events","type":"User","site_admin":false},"body":"The purpose of this option is to give HTML email authors an easy way to reduce generated file size.\r\n\r\nThis option instructs premailer skip the inlining of CSS attributes that are set to `unset` because `unset` has effectively the same meaning as not inlining the property ([more](https://developer.mozilla.org/en-US/docs/Web/CSS/unset)). So a set of CSS rules that would previously have resulted in: `<p style=\"font-size: 14px; font-family: unset\">` will instead result in `<p style=\"font-size: 14px\">`, which should render exactly the same in all clients, but saves bytes. \r\n\r\nSupport for `unset` is [not unviersal](http://caniuse.com/#feat=css-unset-value), but I don't this is a problem here. In my intended use of this feature, you would never actually see `unset` in the output from premailer. You could technically accomplish a similar thing by using a made-up property like `premailer-dont-inline-this` but it's a nice bonus that `unset` is a semi-official property with roughly the same meaning and is supported natively by Chrome and Firefox.\r\n\r\nI created this as an off-by-default option to be conservative, but I actually think it could be merged into the core. Almost nobody is using `unset` in HTML emails, so for them this has no impact on the output. For people who are using it, this should only improve the output by removing a \"meaningless\" attribute that could confuse email clients.\r\n\r\nBy adding a couple of simple rules to our style sheet that look kinda like this:\r\n```css\r\nhtml body td.expander {\r\n  /* expanders never contain text so font formatting is irrelevant */\r\n  color: unset;\r\n  font-family: unset;\r\n  font-weight: unset;\r\n  font-size: unset;\r\n}\r\n```\r\nwe took a 130kb reference newsletter (based on Zurb Ink) and shrunk it to 95kb. ","created_at":"2015-09-04T18:06:11Z","updated_at":"2015-09-08T15:02:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9c734994266a430822b9b8abef9b13e026539223","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/peterbe/premailer/pulls/136/commits","review_comments_url":"https://api.github.com/repos/peterbe/premailer/pulls/136/comments","review_comment_url":"https://api.github.com/repos/peterbe/premailer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/peterbe/premailer/issues/136/comments","statuses_url":"https://api.github.com/repos/peterbe/premailer/statuses/d3b1be67939ed900db5fbde752613c70021e5689","head":{"label":"industrydive:feature/unset_removes_attribute","ref":"feature/unset_removes_attribute","sha":"d3b1be67939ed900db5fbde752613c70021e5689","user":{"login":"industrydive","id":682970,"avatar_url":"https://avatars.githubusercontent.com/u/682970?v=3","gravatar_id":"","url":"https://api.github.com/users/industrydive","html_url":"https://github.com/industrydive","followers_url":"https://api.github.com/users/industrydive/followers","following_url":"https://api.github.com/users/industrydive/following{/other_user}","gists_url":"https://api.github.com/users/industrydive/gists{/gist_id}","starred_url":"https://api.github.com/users/industrydive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/industrydive/subscriptions","organizations_url":"https://api.github.com/users/industrydive/orgs","repos_url":"https://api.github.com/users/industrydive/repos","events_url":"https://api.github.com/users/industrydive/events{/privacy}","received_events_url":"https://api.github.com/users/industrydive/received_events","type":"Organization","site_admin":false},"repo":{"id":26962334,"name":"premailer","full_name":"industrydive/premailer","owner":{"login":"industrydive","id":682970,"avatar_url":"https://avatars.githubusercontent.com/u/682970?v=3","gravatar_id":"","url":"https://api.github.com/users/industrydive","html_url":"https://github.com/industrydive","followers_url":"https://api.github.com/users/industrydive/followers","following_url":"https://api.github.com/users/industrydive/following{/other_user}","gists_url":"https://api.github.com/users/industrydive/gists{/gist_id}","starred_url":"https://api.github.com/users/industrydive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/industrydive/subscriptions","organizations_url":"https://api.github.com/users/industrydive/orgs","repos_url":"https://api.github.com/users/industrydive/repos","events_url":"https://api.github.com/users/industrydive/events{/privacy}","received_events_url":"https://api.github.com/users/industrydive/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/industrydive/premailer","description":"Turns CSS blocks into style attributes","fork":true,"url":"https://api.github.com/repos/industrydive/premailer","forks_url":"https://api.github.com/repos/industrydive/premailer/forks","keys_url":"https://api.github.com/repos/industrydive/premailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/industrydive/premailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/industrydive/premailer/teams","hooks_url":"https://api.github.com/repos/industrydive/premailer/hooks","issue_events_url":"https://api.github.com/repos/industrydive/premailer/issues/events{/number}","events_url":"https://api.github.com/repos/industrydive/premailer/events","assignees_url":"https://api.github.com/repos/industrydive/premailer/assignees{/user}","branches_url":"https://api.github.com/repos/industrydive/premailer/branches{/branch}","tags_url":"https://api.github.com/repos/industrydive/premailer/tags","blobs_url":"https://api.github.com/repos/industrydive/premailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/industrydive/premailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/industrydive/premailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/industrydive/premailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/industrydive/premailer/statuses/{sha}","languages_url":"https://api.github.com/repos/industrydive/premailer/languages","stargazers_url":"https://api.github.com/repos/industrydive/premailer/stargazers","contributors_url":"https://api.github.com/repos/industrydive/premailer/contributors","subscribers_url":"https://api.github.com/repos/industrydive/premailer/subscribers","subscription_url":"https://api.github.com/repos/industrydive/premailer/subscription","commits_url":"https://api.github.com/repos/industrydive/premailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/industrydive/premailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/industrydive/premailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/industrydive/premailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/industrydive/premailer/contents/{+path}","compare_url":"https://api.github.com/repos/industrydive/premailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/industrydive/premailer/merges","archive_url":"https://api.github.com/repos/industrydive/premailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/industrydive/premailer/downloads","issues_url":"https://api.github.com/repos/industrydive/premailer/issues{/number}","pulls_url":"https://api.github.com/repos/industrydive/premailer/pulls{/number}","milestones_url":"https://api.github.com/repos/industrydive/premailer/milestones{/number}","notifications_url":"https://api.github.com/repos/industrydive/premailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/industrydive/premailer/labels{/name}","releases_url":"https://api.github.com/repos/industrydive/premailer/releases{/id}","created_at":"2014-11-21T14:06:07Z","updated_at":"2014-11-21T21:00:59Z","pushed_at":"2015-09-04T17:45:36Z","git_url":"git://github.com/industrydive/premailer.git","ssh_url":"git@github.com:industrydive/premailer.git","clone_url":"https://github.com/industrydive/premailer.git","svn_url":"https://github.com/industrydive/premailer","homepage":"http://www.peterbe.com/plog/premailer.py","size":569,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"peterbe:master","ref":"master","sha":"c642b55a36c55e0da9a0b712626369c50a8f382e","user":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"repo":{"id":251729,"name":"premailer","full_name":"peterbe/premailer","owner":{"login":"peterbe","id":26739,"avatar_url":"https://avatars.githubusercontent.com/u/26739?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbe","html_url":"https://github.com/peterbe","followers_url":"https://api.github.com/users/peterbe/followers","following_url":"https://api.github.com/users/peterbe/following{/other_user}","gists_url":"https://api.github.com/users/peterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbe/subscriptions","organizations_url":"https://api.github.com/users/peterbe/orgs","repos_url":"https://api.github.com/users/peterbe/repos","events_url":"https://api.github.com/users/peterbe/events{/privacy}","received_events_url":"https://api.github.com/users/peterbe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peterbe/premailer","description":"Turns CSS blocks into style attributes","fork":false,"url":"https://api.github.com/repos/peterbe/premailer","forks_url":"https://api.github.com/repos/peterbe/premailer/forks","keys_url":"https://api.github.com/repos/peterbe/premailer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterbe/premailer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterbe/premailer/teams","hooks_url":"https://api.github.com/repos/peterbe/premailer/hooks","issue_events_url":"https://api.github.com/repos/peterbe/premailer/issues/events{/number}","events_url":"https://api.github.com/repos/peterbe/premailer/events","assignees_url":"https://api.github.com/repos/peterbe/premailer/assignees{/user}","branches_url":"https://api.github.com/repos/peterbe/premailer/branches{/branch}","tags_url":"https://api.github.com/repos/peterbe/premailer/tags","blobs_url":"https://api.github.com/repos/peterbe/premailer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterbe/premailer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterbe/premailer/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterbe/premailer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterbe/premailer/statuses/{sha}","languages_url":"https://api.github.com/repos/peterbe/premailer/languages","stargazers_url":"https://api.github.com/repos/peterbe/premailer/stargazers","contributors_url":"https://api.github.com/repos/peterbe/premailer/contributors","subscribers_url":"https://api.github.com/repos/peterbe/premailer/subscribers","subscription_url":"https://api.github.com/repos/peterbe/premailer/subscription","commits_url":"https://api.github.com/repos/peterbe/premailer/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterbe/premailer/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterbe/premailer/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterbe/premailer/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterbe/premailer/contents/{+path}","compare_url":"https://api.github.com/repos/peterbe/premailer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterbe/premailer/merges","archive_url":"https://api.github.com/repos/peterbe/premailer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterbe/premailer/downloads","issues_url":"https://api.github.com/repos/peterbe/premailer/issues{/number}","pulls_url":"https://api.github.com/repos/peterbe/premailer/pulls{/number}","milestones_url":"https://api.github.com/repos/peterbe/premailer/milestones{/number}","notifications_url":"https://api.github.com/repos/peterbe/premailer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterbe/premailer/labels{/name}","releases_url":"https://api.github.com/repos/peterbe/premailer/releases{/id}","created_at":"2009-07-15T10:59:28Z","updated_at":"2015-09-04T17:48:46Z","pushed_at":"2015-09-05T10:12:07Z","git_url":"git://github.com/peterbe/premailer.git","ssh_url":"git@github.com:peterbe/premailer.git","clone_url":"https://github.com/peterbe/premailer.git","svn_url":"https://github.com/peterbe/premailer","homepage":"http://premailer.io","size":1549,"stargazers_count":449,"watchers_count":449,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":107,"mirror_url":null,"open_issues_count":33,"forks":107,"open_issues":33,"watchers":449,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/136"},"html":{"href":"https://github.com/peterbe/premailer/pull/136"},"issue":{"href":"https://api.github.com/repos/peterbe/premailer/issues/136"},"comments":{"href":"https://api.github.com/repos/peterbe/premailer/issues/136/comments"},"review_comments":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/136/comments"},"review_comment":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/peterbe/premailer/pulls/136/commits"},"statuses":{"href":"https://api.github.com/repos/peterbe/premailer/statuses/d3b1be67939ed900db5fbde752613c70021e5689"}}}}