2002/css-validator/org/w3c/css/selectors/attributes AttributeExact.java,1.7,1.8

Update of /sources/public/2002/css-validator/org/w3c/css/selectors/attributes
In directory hutz:/tmp/cvs-serv31229

Modified Files:
	AttributeExact.java 
Log Message:
done all the matches against AttributeExact.
(canApply is still unused)
now trying to find other conflicts in other combinations :)


Index: AttributeExact.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/selectors/attributes/AttributeExact.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- AttributeExact.java	13 May 2008 14:01:39 -0000	1.7
+++ AttributeExact.java	13 May 2008 15:20:52 -0000	1.8
@@ -66,21 +66,45 @@
 	    if (attr instanceof AttributeExact) {
 		// and not the same value, raise a warning
 		if (!value.equals(((AttributeExact) attr).getValue())) {
-		    ac.getFrame().addWarning("incompatible", new String[] { toString(), attr.toString() });
+		    ac.getFrame().addWarning("incompatible", 
+				  new String[] { toString(), attr.toString() });
 		}
 	    } else if(attr instanceof AttributeOneOf) {
-		// FIXME check that the parsed one of value are matching before doing the conclict check
-		// requires breaking down the OneOf
+		// FIXME check that the parsed one of value are matching 
+		// before doing the conclict check requires breaking down 
+		// the OneOf
 		if (!value.equals(((AttributeOneOf) attr).getValue())) {
-		    ac.getFrame().addWarning("incompatible", new String[] { toString(), attr.toString() });
+		    ac.getFrame().addWarning("incompatible", 
+			          new String[] { toString(), attr.toString() });
 		}
 	    } else if(attr instanceof AttributeBegin) {
 		String othervalue = ((AttributeBegin) attr).getValue();
 		// check if [lang|=en][lang=fr-FR] are incompatible 
 		// form CSS3 selectors about AttributeBegin
-		// its value either being exactly "val" or beginning with "val" immediately followed by "-" (U+002D). 
-		if (!value.equals(othervalue) && !value.startsWith(othervalue+"-")) {
-		    ac.getFrame().addWarning("incompatible", new String[] { toString(), attr.toString() });
+		// [[ its value either being exactly "val" or beginning 
+		//    with "val" immediately followed by "-" (U+002D).  ]]
+		if (!value.equals(othervalue) && 
+		    !value.startsWith(othervalue+"-")) {
+		    ac.getFrame().addWarning("incompatible", 
+				  new String[] { toString(), attr.toString() });
+		}
+	    } else if (attr instanceof AttributeSubstr) {
+		String othervalue = ((AttributeSubstr) attr).getValue();
+		if (value.indexOf(othervalue) < 0) {
+		    ac.getFrame().addWarning("incompatible", 
+				  new String[] { toString(), attr.toString() });
+		}
+	    } else if (attr instanceof AttributeStart) {
+		String othervalue = ((AttributeStart) attr).getValue();
+		if (!value.startsWith(othervalue)) {
+		     ac.getFrame().addWarning("incompatible", 
+				  new String[] { toString(), attr.toString() });
+		}
+	    } else if (attr instanceof AttributeSuffix) {
+		String othervalue = ((AttributeStart) attr).getValue();
+		if (!value.endsWith(othervalue)) {
+		     ac.getFrame().addWarning("incompatible", 
+				  new String[] { toString(), attr.toString() });
 		}
 	    }
 	}

Received on Tuesday, 13 May 2008 15:21:30 UTC