W3C home > Mailing lists > Public > www-validator-cvs@w3.org > May 2008

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

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 13 May 2008 15:20:54 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JvwJC-0008A6-3r@lionel-hutz.w3.org>

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:28 UTC