question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditional tags are converted to conditional comments (nuget version 0.9.9)

See original GitHub issue

Hello,

when conditional tags are parsed, they are converted to conditional comments.

var source = "<![if IE]> if-IE comment revealed <![endif]>";
var doc = parser.Parse(source);
var out = doc.ToHtml();
out == "<!--[if IE]--> if-IE comment revealed <!--[endif]-->";

see About conditional comments

I do not think this should happen. Alexander.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mdesousacommented, Nov 12, 2018

Sharing the code that I used to delete the conditional comments… thanks

document.Descendents<IComment>().Where(x => x.NodeValue.StartsWith("[")).ToList().ForEach(x => x.Remove());
0reactions
mdesousacommented, Nov 12, 2018

Hi, I’m running into this same issue. Unfortunately, if the document forces IE compatibility to an old version you actually get incorrect display in IE. The code below illustrates the problem (you need to save the result in a file and open in IE). I’ll try the recommendation to remove the nodes through the tree walker, and will post the code for that:

var html = "<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=5\"></head><body><![if !supportLists]><span>Hello World</span><![endif]></body></html>";
var parser = new HtmlParser();
var document = parser.Parse(html);
document.DocumentElement.OuterHtml.Should().Be(html);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a conditional NuGet package
Can our NuGet package have some sort of conditional behaviour, i.e. if its a VB.Net project add the AppStart class in VB.Net and...
Read more >
Target-typed conditional expression - C# 9.0 draft feature ...
we define a new implicit conditional expression conversion that permits an implicit conversion from the conditional expression to any type T ...
Read more >
Full ChangeLog | BenchmarkDotNet
#290 Question: Any official way to benchmark same method between different assembly versions? #931 Same NuGet version used when benchmarking different packages ...
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
... Bug:259848 - "new package request sci-biology/gap2caf: convert from gap4 file format to consed" status:RESOLVED resolution:OBSOLETE severity:enhancement ...
Read more >
Conditional comments - CSS
If you have multiple IEs installed on one system the conditional comments will view each install as the highest installed version.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found