You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A block inside an inline element inherits nothing from it, and the inline's text after the block loses its styles #541
Measured on gravitypdf at d660a410, PHP 8.5.4. With .a{color:#0f0; font-weight:bold}:
HTML
Browser
mPDF
<span class="a">xx<div>qq</div>yy</span>
xx, qq and yy green and bold
xx green and bold; qq and yy black and normal
<a href="https://example.com/"><div>qq</div></a>
qq in the link's colour, underlined
qq black, not underlined
Block links are common in HTML5 templates.
Cause.BlockTag::open() empties $mpdf->InlineProperties (src/Tag/BlockTag.php:115), which holds the saved state of every open inline element. The block's inherited properties come from the enclosing block's saved state, which the inline never wrote to. close() then restores the enclosing block's state (:1393-1394), not the inline's.
Fix. When a block opens inside open inline elements, it inherits their state (saveInlineProperties()), and their saved states survive the block, so the text after it is restored to them. With #533 the open inline elements are on the stack, and #547 inherits from them directly.
Tests. The two rows above, plus that the link still covers the block.
Activity