peterbe / premailer

Turns CSS blocks into style attributes
https://premailer.io
BSD 3-Clause "New" or "Revised" License
1.06k stars 188 forks source link

Direct child selector (">") is ignored #272

Open skrhlm opened 2 years ago

skrhlm commented 2 years ago

When inlining CSS using a direct child selector all child elements are affected by the styling as if the ">" was not there.

example:

css:

.pad-t-12 > td {
    padding-top: 12px;
}

html:

<table>
    <tr class="pad-t-12">
        <td>
            <table>
                 <tr>
                     <td></td>
                 </tr>
            </table>
        </td>
    </tr>
</table>

results in:

<table>
    <tr>
        <td style="padding-top:12px;">
            <table>
                 <tr>
                      <td style="padding-top:12px;"></td>
                 </tr>
            </table>
        </td>
    </tr>
</table>

Desired behavior:

<table>
    <tr>
        <td style="padding-top:12px;">
            <table>
                 <tr>
                      <td></td>
                 </tr>
            </table>
        </td>
    </tr>
</table>