Index: src/htmltokenizer.c
===================================================================
--- src/htmltokenizer.c	(révision 8599)
+++ src/htmltokenizer.c	(copie de travail)
@@ -89,7 +89,6 @@
 	gboolean select; /* Are we in a <select> block? */
 	gboolean charEntity; /* Are we in an &... sequence? */
 	gboolean extension; /* Are we in an <!-- +GtkHTML: sequence? */
-	gboolean aTag; /* Are we in a <a/> tag*/
  
 	enum {
 		NoneDiscard = 0,
@@ -234,7 +233,6 @@
 	p->select = FALSE;
 	p->charEntity = FALSE;
 	p->extension = FALSE;
-	p->aTag = FALSE;
 
 	p->discard = NoneDiscard;
 	p->pending = NonePending;
@@ -1096,9 +1094,6 @@
 	else if (strncmp (p->buffer + 2, "tablesdkl", 9) == 0) {
 		html_tokenizer_blocking_push (t, Table);
 	}	
-	else if (strncmp (p->buffer + 2, "/a", 2) == 0) {
-		p->aTag = FALSE;
-	}
 	else {
 		if (p->blocking) {
 			const gchar *bn = html_tokenizer_blocking_get_name (t);
@@ -1155,8 +1150,6 @@
 static void
 in_space_or_tab (HTMLTokenizer *t, const gchar **src)
 {
-	gchar *ptr;
-	
 	if (t->priv->tquote) {
 		if (t->priv->discard == NoneDiscard)
 			t->priv->pending = SpacePending;
@@ -1165,9 +1158,6 @@
 		t->priv->searchCount = 0; /* Stop looking for <!-- sequence */
 		if (t->priv->discard == NoneDiscard)
 			t->priv->pending = SpacePending;
-		ptr = t->priv->buffer;
-		if (ptr[1] == '<' && ptr[2] == 'a' && strlen (ptr) == 3)
-			t->priv->aTag = TRUE;
 	}
 	else if (t->priv->pre || t->priv->textarea) {
 		if (t->priv->pending)
@@ -1275,6 +1265,24 @@
 	add_byte (t, src);
 }
 
+static gboolean
+is_entity_start (const gchar **src)
+{
+	int i;
+
+	if (**src != '&')
+		return FALSE;
+
+	for (i=0; i < 9; i++) {
+		if (*((*src)+i) == 0) {
+			return FALSE;
+		}
+		if (*((*src)+i) == ';')
+			return TRUE;
+	}
+	return FALSE;
+}
+
 static void
 html_tokenizer_tokenize_one_char (HTMLTokenizer *t, const gchar **src)
 {
@@ -1297,7 +1305,7 @@
 		in_entity (t, src);
 	else if (p->startTag)
 		in_tag (t, src);
-	else if (**src == '&' && !p->aTag)
+	else if (is_entity_start(src))
 		start_entity (t, src);
 	else if (**src == '<' && !p->tag)
 		start_tag (t, src);
Index: src/ChangeLog
===================================================================
--- src/ChangeLog	(révision 8599)
+++ src/ChangeLog	(copie de travail)
@@ -1,3 +1,13 @@
+2007-10-23  Frederic Peters  <fpeters@0d.be>
+
+	** Fixes bug #489452
+
+	* htmltokenizer.c: (html_tokenizer_init), (end_tag), (in_space_or_tab),
+	(is_entity_start), (html_tokenizer_tokenize_one_char): Look further in
+	the string when determining the token will be handled as an HTML
+	entity; also remove special casing for links added as a fix to #270487
+	since it is no longer necessary.
+
 2007-10-14  Hiroyuki Ikezoe  <poincare@ikezoe.net>
 
 	** Fixes part of bug #258374
