blitz icon indicating copy to clipboard operation
blitz copied to clipboard

The legacy background attribute isn't mapped to background-image

Open devahschaefers opened this issue 1 week ago • 0 comments

The legacy background attribute isn't mapped. Per the HTML spec's rendering section, on body, table, thead, tbody, tfoot, tr, td and th it maps to background-image: url(…), resolved against the document's base URL. HTML email still uses it a lot for background photos behind text, hero images and table-cell textures, because some mail clients drop CSS backgrounds. Without it, all of that content renders as empty boxes.

<table background="stripes.png" width="300"><tr><td style="height:60px"></td></tr></table>
<table width="300"><tr><td background="stripes.png" style="height:60px"></td></tr></table>

Blitz main vs Chromium

I didn't send a PR because it needs a decision first. The natural place is compute_presentational_hints next to bgcolor, but hints are computed per element and cached, and they parse with DocumentUrl::default(), so a relative background URL would resolve against the wrong base. The base URL would need to reach hint computation in some form, or the hint could be resolved later where the document is available. Happy to implement whichever approach you prefer.

🤖 Generated with Claude Code

devahschaefers avatar Nov 27 '26 21:11 devahschaefers