gajus / dindent

HTML indentation library for development and testing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditional comments

skynet opened this issue · comments

Pity...

this piece of html:

<!DOCTYPE html>
<!--[if lt IE 7]><html lang="en-US" class="no-js ie lt-ie10 lt-ie9 lt-ie8 lt-ie7"><![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html lang="en-US" class="no-js ie ie7 lt-ie10 lt-ie9 lt-ie8"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html lang="en-US" class="no-js ie ie8 lt-ie10 lt-ie9"><![endif]-->
<!--[if IE 9]><html lang="en-US" class="no-js ie ie9 lt-ie10"><![endif]-->
<!--[if gt IE 9]><!-->
<html   lang="en-US" class="no-js" xmlns:og="http://ogp.me/ns#" style="">
<!--<![endif]-->

will end up like this:

<!DOCTYPE html>
<!--[if lt IE 7]>
<html lang="en-US" class="no-js ie lt-ie10 lt-ie9 lt-ie8 lt-ie7">
    <![endif]-->
    <!--[if (IE 7)&!(IEMobile)]>
    <html lang="en-US" class="no-js ie ie7 lt-ie10 lt-ie9 lt-ie8">
        <![endif]-->
        <!--[if (IE 8)&!(IEMobile)]>
        <html lang="en-US" class="no-js ie ie8 lt-ie10 lt-ie9">
            <![endif]-->
            <!--[if IE 9]>
            <html lang="en-US" class="no-js ie ie9 lt-ie10">
                <![endif]-->
                <!--[if gt IE 9]>
                <!-->
                <html lang="en-US" class="no-js" xmlns:og="http://ogp.me/ns#" style="">
                    <!--<![endif]-->

This is a known (https://github.com/gajus/dindent#known-issues) issue. Fortunately, it should be an easy fix. I would appreciate a contribution. If not, I will see if I can find time for it over the next week.

Given that HTML comment conditions have been deprecated and their support removed (as of IE10), this is not relevant. http://en.wikipedia.org/wiki/Conditional_comment