premailer now excludes pseudo selectors by default

27 May 2013   0 comments   Python, Web development

Powered by Fusion×

Thanks to Igor who emailed me and made me aware, you can't put pseudo classes in style attributes in HTML. I.e. this does not work:

<a href="#" style="color:pink :hover{color:red}">Sample Link</a>

See for yourself: Sample Link

Note how it does not become red when you hover over the link above.
This is what premailer used to do. Until yesterday.

BEFORE:

>>> from premailer import transform
>>> print transform('''
... <html>
... <style>
... a { color: pink }
... a:hover { color: red }
... </style>
... <a href="#">Sample Link</a>
... </html>
... ''')
<html><head><a href="#" style="{color:pink} :hover{color:red}">Sample Link</a></head></html>


AFTER:

>>> from premailer import transform
>>> print transform('''
... <html>
... <style>
... a { color: pink }
... a:hover { color: red }
... </style>
... <a href="#">Sample Link</a>
... </html>
... ''')
<html><head>
<style>a:hover {color:red}</style>
<a href="#" style="color:pink">Sample Link</a>
</head></html>


That's because the new default is exclude pseudo classes by default.

Thanks Igor for making me aware!

Comments

Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
What stumped me about AngularJS 12 May 2013
Next:
In Python you sort with a tuple 14 June 2013
Related:
Premailer 3.0.0 - classes kept by default 07 June 2016
CSS Bloat Comparison 03 June 2016
How to no-mincss links with django-pipeline 03 February 2016
django-semanticui-form 14 September 2015
Premailer.io 08 July 2015
premailer 2.9.0 and new rules for `base_url` 11 May 2015
Premailer on Python 3 08 October 2014
premailer now with 100% test coverage 22 August 2014
COPYFILE_DISABLE and python distutils in python 2.6 12 April 2014
premailer now honours specificity 21 March 2013