[xml] HTML input element and IDness



I am not 100% sure of the correct behavior here as this is from a bug report I received, but reading the CVS log for version 1.174 of valid.c
* valid.c: in HTML, a name in an input is not an ID
it looks like the behavior is wrong. It appears to never indicate an ID if an input element is passed in regardless of the attribute name.

My eyes are a bit buggy from all the parenthesis, but I believe this patch correctly fixes the behavior:
- if att name is "id" then its an ID
- if att name is "name" then its an ID if no element passed in or the element name is not "input".

I don't know if an element is required here or not, but previously to the change in 1.174 there was no element check so I am assuming it is not required.

Rob
Index: valid.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/valid.c,v
retrieving revision 1.220
diff -c -r1.220 valid.c
*** valid.c     27 Oct 2005 11:56:20 -0000      1.220
--- valid.c     1 Mar 2006 17:41:27 -0000
***************
*** 2712,2720 ****
      if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
        return(0);
      } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
!         if (((xmlStrEqual(BAD_CAST "id", attr->name)) ||
!           (xmlStrEqual(BAD_CAST "name", attr->name))) &&
!           ((elem != NULL) && (!xmlStrEqual(elem->name, BAD_CAST "input"))))
            return(1);
        return(0);    
      } else if (elem == NULL) {
--- 2712,2720 ----
      if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) {
        return(0);
      } else if (doc->type == XML_HTML_DOCUMENT_NODE) {
!         if ((xmlStrEqual(BAD_CAST "id", attr->name)) ||
!           ((xmlStrEqual(BAD_CAST "name", attr->name)) &&
!           ((elem == NULL) || (!xmlStrEqual(elem->name, BAD_CAST "input")))))
            return(1);
        return(0);    
      } else if (elem == NULL) {


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