Skip to content

Inlining styles makes all elements inside mj-raw tags lowercase #1450

@wdonnell

Description

@wdonnell

Describe the bug
When using <mj-style inline="inline"> all html elements inside <mj-raw> and <mj-table> have their tag names and parameters set to lowercase, even if they aren't related to the css selectors.

My intended workflow is using MJML to render a freemarker template, which our application can process to dynamically generate unique emails. The freemarker tags include references to variables, so casing is important.

To Reproduce
Steps to reproduce the behavior:

  1. Render the following MJML using the cli application, or the try-it-live editor:
<mjml>
   <mj-head>
    <mj-style inline="inline">
      .myClass{
        background: red;
      }
    </mj-style>
  </mj-head>
  <mj-body>
    <mj-raw>
      <#if someCheckHere()>
        <p class="myClass">${someValueHere}</p>
      </#if>
    </mj-raw>
  </mj-body>
</mjml>

Expected behavior
Body output is:

<body>
  <div style="">
    <#if someCheckHere()>
      <p class="myClass" style="background: red;>${someValueHere}</p>
    </#if>
  </div>
</body>

Ideally, the styles would be inlined with the <p> tag and the unrelated <#if> would remain unchanged. Or, since it's inside an mj-raw tag, everything including the <p> would remain untouched.

Actual behavior
Body output is:

<body>
  <div style="">
    <#if somecheckhere()="">
      <p class="myClass" style="background: red;">${someValueHere}</p>
    </#if>
  </div>
</body>

The style is applied, but the <#if> tag's attribute somecheckhere is lowercased

MJML environment (please complete the following information):

  • MacOS Mojave
  • mjml-core: 4.2.1
  • mjml-cli: 4.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions