Subject: bug#56482: 29.0.50; shr displays <![if !supportLists]>...<![endif]> literally instead of dropping the tags

From: Phil Sainty <[email-masked]>
Date: Tue, 12 Jul 2022 05:46:54 +1200

On 2022-07-12 01:04, Lars Ingebrigtsen wrote:
> I'm starting to wonder...  is
> <![if !bar]>Foo<![endif]>
> valid syntax?  It's apparently an MSIE-ism:
> https://en.wikipedia.org/wiki/Conditional_comment

Yes, I believe that's invalid, and therefore it's expected
behaviour that it would have a visible effect upon rendering.

So unless HTML5 has legitimised it, it's not really a bug.

I recall encountering this unique-to-MSIE syntax well over
a decade ago at an old job, and establishing a safe way to
get the same outcome without using it, because it wasn't
valid to use.

It's unfortunate that this still exists in the wild.  Now
that MSIE is officially dead, and assuming it's *not* part
of HTML5, it would be nice if things generating that syntax
were updated to not do that.  (Perhaps libxml has dropped
support for it as a result of MSIE reaching end-of-life?)

I think what I came up with at the time was probably the
same thing I can see at that wikipedia link, which is that
instead of writing this:

<![if CONDITION]>
<link href="non-ie.css" rel="stylesheet">
<![endif]>

You instead structure it within valid comments like this:

<!--[if CONDITION]><!-->
<link href="non-ie.css" rel="stylesheet">
<!--<![endif]-->

Difficult to fix at the source if arbitrary people are
sending you this as email, though :(

-Phil