Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Global style with !important do not take precedence over the respective inline style #273

Open
earshinov opened this issue Jun 21, 2022 · 0 comments

Comments

@earshinov
Copy link

For example:

import premailer

html = """
<html>
    <style type="text/css">
        img { height: auto !important; }
    </style>
    <body>
        <img src="https://via.placeholder.com/200x200" style="height: 400px;"></img>
    </body>
</html>
"""

print(premailer.transform(html))
#<html>
#    <head></head><body>
#        <img src="https://via.placeholder.com/200x200" style="height:400px" height="400">
#    </body>
#</html>

Expected result - !important takes precedence:

<img src="https://via.placeholder.com/200x200" style="height:auto" height="auto">

❌ Actual result - inline style takes precedence:

<img src="https://via.placeholder.com/200x200" style="height:400px" height="400">

Version information:

>>> premailer.__version__
'3.10.0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant