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

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

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 13 May 2008 14:01:41 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Jvv4X-0001cO-KD@lionel-hutz.w3.org>

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

Modified Files:
	AttributeExact.java 
Log Message:
document some more things to do


Index: AttributeExact.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/selectors/attributes/AttributeExact.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- AttributeExact.java	13 May 2008 09:38:01 -0000	1.6
+++ AttributeExact.java	13 May 2008 14:01:39 -0000	1.7
@@ -36,21 +36,27 @@
     }
 
     public boolean canApply(Selector other) {
-	if (other instanceof AttributeAny) {
-	    // [lang=fr][lang]
-	    return true;
-	} else if (other instanceof AttributeExact ||
-		other instanceof AttributeOneOf ||
-		other instanceof AttributeBegin) {
-	    if (!value.equals(((AttributeExact) other).getValue())) {
-		// [lang=fr][lang=en]
-		return false;
-	    } else {
-		// [lang=en][lang=en]
+	if (getName().equals(other.getName())) {
+	    if (other instanceof AttributeAny) {
+		// [lang=fr][lang]
 		return true;
+	    } else if (other instanceof AttributeExact ||
+		       other instanceof AttributeOneOf ||
+		       other instanceof AttributeBegin) {
+		// FIXME sounds like canApply is not used anyway
+		// + the comparison function is not right and doesn't
+		// take into account all kind the selector attributes
+		if (!value.equals(((AttributeExact) other).getValue())) {
+		    // [lang=fr][lang=en]
+		    return false;
+		} else {
+		    // [lang=en][lang=en]
+		    return true;
+		}
 	    }
+	    return false;
 	}
-	return false;
+	return true;
     }
 
     public void applyAttribute(ApplContext ac, AttributeSelector attr) {
Received on Tuesday, 13 May 2008 14:02:18 UTC

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