Convert to Number for identity comparison if one member is an instance
In Javascript, the identity comparison is not true when comparing a Number with its instance. But domain may use integer or float in their clause against Numeric fields. issue7446 review50421002
This commit is contained in:
1 parent
a44a767fa4
commit
24cd57c609
1 file changed
+4
@@ -1996,6 +1996,8 @@
|
||||
'=': function(a, b) {
|
||||
if ((a instanceof Array) && (b instanceof Array)) {
|
||||
return Sao.common.compare(a, b);
|
||||
} else if ((a instanceof Number) || (b instanceof Number)) {
|
||||
return (Number(a) === Number(b));
|
||||
} else {
|
||||
return (a === b);
|
||||
}
|
||||
@@ -2007,6 +2009,8 @@
|
||||
'!=': function(a, b) {
|
||||
if ((a instanceof Array) && (b instanceof Array)) {
|
||||
return !Sao.common.compare(a, b);
|
||||
} else if ((a instanceof Number) || (b instanceof Number)) {
|
||||
return (Number(a) !== Number(b));
|
||||
} else {
|
||||
return (a !== b);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user