Make all CSS inline - Class Issue

I found this awesome class that converts CSS style blocks to inline. However, I think this is 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 converts the above value to:

 <p class="myclass" style="padding-top: 40px; padding:0px;">Test</p> 

But the above is incorrect. It needs to be added since the padding-top has priority because it is already inline. Therefore, it should be:

 <p class="myclass" style="padding:0px; padding-top: 40px;">Test</p> 

But I'm struggling to do this editing in class. I thought it would be easy, and I can introduce it to the creator of the class, but I'm afraid.

Any ideas?

+6
source share
3 answers

The best solution is to create a problem and contact the developer. Therefore, he can fix it for others. This is community growth.

Just quickly going through the code, I think, before creating the pieces, cancel the $ properties array

 $properties = array_reverse ( $properties, true ); // build chunks foreach($properties as $key => $values) 

$properties = array_reverse ( $properties, true ) , which saves the key at the top of the assembly lines on line 318 as linked, will cancel everything.

Hope this helps! Not sure if this will cause other problems, just try.

+4
source

to my mind

 <p class="myclass" style="padding-top: 40px; padding:0px;">Test</p> 

not mistaken. because inline style overwrites class style

0
source

Should be fixed in latest version: see https://github.com/tijsverkoyen/CssToInlineStyles

0
source

Source: https://habr.com/ru/post/895016/


All Articles