[libcroco-list] class matching problem?



Hi,

I think libcroco fails to correctly match against the class
attribute. It seems to expect one value for the class attribute,
but according to the specs it is actually a list :

http://www.w3.org/TR/1998/REC-html40-19980424/struct/global.html#h-7.5.2

For svg its defined the same.
I did a patch that seems to fix this for me.
Cheers,

Rob.
Index: src/seleng/cr-sel-eng.c
===================================================================
RCS file: /cvs/gnome/libcroco/src/seleng/cr-sel-eng.c,v
retrieving revision 1.16
diff -u -3 -p -p -u -b -r1.16 cr-sel-eng.c
--- src/seleng/cr-sel-eng.c	24 Dec 2003 18:56:26 -0000	1.16
+++ src/seleng/cr-sel-eng.c	16 Jan 2004 19:17:47 -0000
@@ -166,7 +166,7 @@ class_add_sel_matches_node (CRAdditional
                             xmlNode *a_node)
 {
         gboolean result = FALSE ;
-        xmlChar *class = NULL ;
+        xmlChar *class = NULL, *cur = NULL ;
 
         g_return_val_if_fail (a_add_sel
                               && a_add_sel->type == CLASS_ADD_SELECTOR
@@ -177,10 +177,19 @@ class_add_sel_matches_node (CRAdditional
         if (xmlHasProp (a_node, "class"))
         {
                 class = xmlGetProp (a_node, "class") ;
-                if (!strncmp (class, a_add_sel->content.class_name->str,
+                for (cur = class ; *cur ; cur++)
+                {
+                    while (cr_utils_is_white_space (*cur) == TRUE && *cur)
+                        cur ++ ;
+                    if (!*cur)
+                        break ;
+                    if (!strncmp (cur, a_add_sel->content.class_name->str,
                              a_add_sel->content.class_name->len))
                 {
+                            cur += a_add_sel->content.class_name->len;
+                            if (!*cur || cr_utils_is_white_space (*cur) == TRUE)
                         result = TRUE ;
+                    }
                 }
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]