I found this awesome class that converts CSS style blocks to inline. However, I think it has a problem. For example, if you have the following:
<style type="text/css">
.myclass{
padding:0px;
}
<style>
<p class="myclass" style="padding-top: 40px;">Test</p>
It will convert the above to:
<p class="myclass" style="padding-top: 40px; padding:0px;">Test</p>
But the above is incorrect. It should prepend since the padding-top
inline has priority as it is already inline. So it should be:
<p class="myclass" style="padding:0px; padding-top: 40px;">Test</p>
But I am struggling where to make this edit in the class. I thought it would be straightforward and I could submit it to the class creator but I am struggling.
Any ideas?
The best solution is create an issue and get in touch with the developer. So he can fix it for others too. That's a growth of the community .
Just going through the code in a quick way what I think is before building the chunks reverse the array $properties
$properties = array_reverse ( $properties, true );
// build chunks
foreach($properties as $key => $values)
The $properties = array_reverse ( $properties, true )
which preserves the key on the top of build chunks on line 318 as linked will reverse all.
Hope that helps! Not sure whether this will bring any other issues, just try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With