implement @tschaub's suggestions for ieq and ineq

This commit is contained in:
Bart van den Eijnden
2013-07-22 14:11:29 +02:00
parent 875edc540e
commit 369d692a90
2 changed files with 50 additions and 14 deletions

View File

@@ -191,32 +191,30 @@ ol.expr.lib[ol.expr.functions.LIKE] = function(value, pattern, wildCard,
/**
* Case insensitive comparison for equality.
* @param {string} attribute Name of the attribute.
* @param {string} value Value to test for equality.
* @param {*} first First value.
* @param {*} second Second value.
* @this {ol.Feature}
*/
ol.expr.lib[ol.expr.functions.IEQ] = function(attribute, value) {
var attributeValue = this.get(attribute);
if (goog.isString(value) && goog.isString(attributeValue)) {
return value.toUpperCase() == attributeValue.toUpperCase();
ol.expr.lib[ol.expr.functions.IEQ] = function(first, second) {
if (goog.isString(first) && goog.isString(second)) {
return first.toUpperCase() == second.toUpperCase();
} else {
return value == attributeValue;
return first == second;
}
};
/**
* Case insensitive comparison for non-equality.
* @param {string} attribute Name of the attribute.
* @param {string} value Value to test for non-equality.
* @param {*} first First value.
* @param {*} second Second value.
* @this {ol.Feature}
*/
ol.expr.lib[ol.expr.functions.INEQ] = function(attribute, value) {
var attributeValue = this.get(attribute);
if (goog.isString(value) && goog.isString(attributeValue)) {
return value.toUpperCase() == attributeValue.toUpperCase();
ol.expr.lib[ol.expr.functions.INEQ] = function(first, second) {
if (goog.isString(first) && goog.isString(second)) {
return first.toUpperCase() != second.toUpperCase();
} else {
return value != attributeValue;
return first != second;
}
};