diff src/goodjava/html/Html.java @ 1800:a045f30fa67d

html fix
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 08 Mar 2024 10:24:00 -0700
parents 31a82b0d0a87
children
line wrap: on
line diff
--- a/src/goodjava/html/Html.java	Thu Feb 22 08:34:55 2024 -0700
+++ b/src/goodjava/html/Html.java	Fri Mar 08 10:24:00 2024 -0700
@@ -132,10 +132,14 @@
 						if( container != null )
 							el = container;
 					}
-					if( el != null 
-						|| (el = parseComment()) != null
-						|| (el = parseCdata()) != null
-					) {
+					add(list,sb);
+					list.add(el);
+					continue;
+				} else {
+					Object el = parseComment();
+					if( el == null )
+						el = parseCdata();
+					if( el != null ) {
 						add(list,sb);
 						list.add(el);
 						continue;
@@ -166,6 +170,7 @@
 				return parser.failure(null);
 		}
 		String text = parser.textFrom(start);
+		parser.match("-->");
 		Comment comment = new Comment(text);
 		return parser.success(comment);
 	}
@@ -180,6 +185,7 @@
 				return parser.failure(null);
 		}
 		String text = parser.textFrom(start);
+		parser.match("]]>");
 		CData cdata = new CData(text);
 		return parser.success(cdata);
 	}