[Mono-osx] HTML comments are not parsed correctly / IE Conditionals break page

johnb dullobject at gmail.com
Fri Mar 12 16:57:40 EST 2010


It appears that when running/debugging an application, HTML comments are
parsed incorrectly which can break the page or cause an Error 500 screen.

Test Case #1

<%@ Page Language="C#" Inherits="htmlCommentsBreakPages.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
<title>HTML Comments are not parsed correctly</title>
<!--[if IE 6]>
<script src="js/jquery-iepngfix.js" type=text/javascript></script>
<![endif]-->
</head>
<body>
<form id="form1" runat="server">
<p>This is a test</p>
</form>
</body>
</html>

The above test case, when run, results in an Error 500 screen. "Server Error
in '/' Application - Expecting </script> and got EOF."

Test Case #2

<%@ Page Language="C#" Inherits="htmlCommentsBreakPages.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
	<title>HTML Comments are not parsed correctly</title>
</head>
<body>
<form id="form1" runat="server">
<div id="main">
	<!--p>This line of text has been commented out</p-->
	<h2>Heading2</h2>
	<ul>
	  <li>List item 1</li>
	  <!--<li>list item 2</li>-->
	  <li>List item 3</li>
	</ul>
</div><!-- /main -->
</form><!-- /form -->
</body>
</html>

The above test case, when run, results in:
Server Error in '/' Application
Parser Error
Description: Error parsing a resource required to service this request.
Review your source file and modify it to fix this error.
Parser Error Message: expecting '>'. Got 'p'

Text Case#3

<%@ Page Language="C#" Inherits="htmlCommentsBreakPages.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head runat="server">
	<title>HTML Comments are not parsed correctly</title>
</head>
<body>
<form id="form1" runat="server">
<div id="main">
	<p>This is a line of text</p>
	<h2>Heading2</h2>
	<ul>
	  <li>List item 1</li>
	  <!--<li>list item 2</li>-->
	  <li>List item 3</li>
	</ul>
</div><!-- /main -->
</form><!-- /form -->
</body>
</html>

The above test case renders, but does not display correctly. It looks like:

This is a line of text
Heading2

    * List item 1
    <!--
    * List item 3


Further, if you do a "view source", the code looks like (excerpt):

<div id="main">
	<p>This is a line of text</p>

	<h2>Heading2</h2>
	<ul>
	  <li>List item 1</li>
	  <!--<!--list item 2em 2<-->
	  <li>List item 3</li>
	</ul>
</div><!-- /main -->

Notice how the comment around the <li> is all garbled.

------

I'm using MonoDevelop 2.2.1 and Mono 2.6.1 + GTK# on OSX 10.4 (also tested
on OSX 10.6 which had the same results).

Interestingly, if I run the test cases on windows XP (MonoDevelop 2.2.1 and
Mono 2.6.1), the HTML is rendered correctly.

Anyone else developing on OSX have this same problem? 

Thanks
-John
-- 
View this message in context: http://n4.nabble.com/HTML-comments-are-not-parsed-correctly-IE-Conditionals-break-page-tp1591195p1591195.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list