Note the ordering of border and border-bottom-width.
Suggested fix
The underlying reason for this error is that when you assign to an existing key in OrderedDict, it replaces the value in-place instead of appending it to the end. That is,
>>> import collections
>>> d = collections.OrderedDict((("a", 1), ("b", 2)))
>>> d["a"] = 3
>>> d
OrderedDict([('a', 3), ('b', 2)])
This way, the inline border style in the example takes place of the border style inherited from the .c class, and gets lesser priority than border-bottom-width.
The simplest fix to achieve the desired behavior would be to del the key from the OrderedDict first.
PR contents
PR contains a fix and a unit test failing without the fix.
"Constituent" styles are, for example,
margin-bottom
formargin
.Rationale
To illustrate the problem, suppose you have this HTML:
After "premailing" with the current version, this becomes
what is obviously wrong. The desired output would be:
Note the ordering of
border
andborder-bottom-width
.Suggested fix
The underlying reason for this error is that when you assign to an existing key in
OrderedDict
, it replaces the value in-place instead of appending it to the end. That is,This way, the inline
border
style in the example takes place of theborder
style inherited from the.c
class, and gets lesser priority thanborder-bottom-width
.The simplest fix to achieve the desired behavior would be to
del
the key from theOrderedDict
first.PR contents
PR contains a fix and a unit test failing without the fix.