posthtml / posthtml-parser

Parse HTML/XML to PostHTMLTree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[fix]: IE® conditional comments

stevenvachon opened this issue · comments

Downlevel-hidden, -revealed and bubbling, so that we can correctly parse this:

<html>
<!--[if lt IE 7]><html class="no-js ie6"><![endif]-->
<!--[if IE 7]><html class="no-js ie7"><![endif]-->
<!--[if IE 8]><html class="no-js ie8"><![endif]-->
<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->

(Not that I condone writing such filth)

Hi @stevenvachon this related to:

I hope that you no longer use such constructions

@gitscrum cnn.com does

commented

Although it is possible to extract the content of the conditional comment and pass it back to postHtmlParser() again (just as I did in posthtml/htmlnano#119), however, the code snippet provided only has <html> start tag wrapped in a conditional comment, posthtml-render later will have to determine if </html> should be added. In posthtml/htmlnano#125 I have to manually remove </html> from result.html (kind of a dirty hack).

I thought the same, but it's very dirty

I think that it makes no sense to invest a resource in supporting something that is no longer supported.

Feel free to reopen the issue if you think it's a high priority and a must for you.