yourtempo / tempo-email-parser

MIT License
132 stars 14 forks source link

Always insert the viewport tag to the head element in the top #26

Closed 0nn0 closed 4 years ago

0nn0 commented 4 years ago

If a viewport-tag is found we replace the first one with the viewport-tag we want. However, this viewport-tag can actually be in the part of the message that is removed. This results in that the part of the message that is rendered does not contain the viewport-tag causing the scaling to be off.

Example input.

<div>
<p>Forwarding you a message</p>
<blockquote class="gmail_quote">
<meta name="viewport" content="width=device-width">
<div>blabla</div>
</blockqoute>
<div>

Result (missing the viewport-tag)

<div>
<p>Forwarding you a message</p>
<div>

Result we want

<div>
<meta name="viewport" content="width=device-width">
<p>Forwarding you a message</p>
<div>

Another solution to the one I have committed is to move the enforceViewport call in prepareMessage to after we have done all removals.

0nn0 commented 4 years ago

Thanks for the input!