Merge pull request #1054 from eguaj/3.1-A4428

fix(mailcard): Remove leading HTML comments before PDF conversion (closes #4428)
fix(search): verify if search is deleted before use it (refs #4416)
fix(search): refactor search list composition (refs #4424)
Merge pull request #1056 from Eric-Brison/3.1-I4416

fix(search): correct search list in generic (closes #4416, #4424)
fix(mailcard): Remove CSS before PDF conversion (refs #4428)

The initial problem was triggered by the string "<https://...>" appearing in a
CSS comment. As html2ps do not interpret the CSS rules in the HTML document, we
can completly remove "<style>...</style>" strings from the HTML.