private void ParseEndIfConditionalComment(HtmlConditionalCommentType type)
{
if (_conditionalCommentStack.Count > 0)
{
var stackedConditionalComment = _conditionalCommentStack.Pop();
var stackedType = stackedConditionalComment.Type;
if (type == HtmlConditionalCommentType.Hidden || type == HtmlConditionalCommentType.Revealed)
{
if (stackedType == type)
{
_conditionalCommentOpened = false;
}
else
{
throw new MarkupParsingException(
Strings.ErrorMessage_InvalidEndIfConditionalComment,
_innerContext.NodeCoordinates, _innerContext.GetSourceFragment());
}
}
else if (type == HtmlConditionalCommentType.RevealedValidating
|| type == HtmlConditionalCommentType.RevealedValidatingSimplified)
{
if (stackedType != HtmlConditionalCommentType.RevealedValidating
&& stackedType != HtmlConditionalCommentType.RevealedValidatingSimplified)
{
throw new MarkupParsingException(
Strings.ErrorMessage_InvalidEndIfConditionalComment,
_innerContext.NodeCoordinates, _innerContext.GetSourceFragment());
}
}
}
else
{
throw new MarkupParsingException(
Strings.ErrorMessage_IfConditionalCommentNotDeclared,
_innerContext.NodeCoordinates, _innerContext.GetSourceFragment());
}
if (_handlers.EndIfConditionalComment != null)
{
_handlers.EndIfConditionalComment(_context, type);
}
}