From 1ffbec9942ad90e00e28b05296d3233f52ce2dad Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 5 Dec 2011 13:39:30 +0100 Subject: Removed usage of bitwise assignment operators in logical operations JavaScript &= and |= are bitwise operators. They are shortened version of: foo = foo & bar foo = foo | bar In some places they were used as shortened version of logical operation and assignment. foo = foo && bar It lead to type conversion to Number which is wrong (0 !== false). This patch replaces such occurances with full version of logical operation and asignment. https://fedorahosted.org/freeipa/ticket/2040 --- install/ui/field.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'install/ui/field.js') diff --git a/install/ui/field.js b/install/ui/field.js index 2cba8786..381f2360 100644 --- a/install/ui/field.js +++ b/install/ui/field.js @@ -301,8 +301,8 @@ IPA.field = function(spec) { if (!value) empty = true; if (value instanceof Array) { - empty |= (value.length === 0) || - (value.length === 1) && (value[0] === ''); + empty = empty || value.length === 0 || + (value.length === 1) && (value[0] === ''); } if (value === '') empty = true; @@ -480,7 +480,7 @@ IPA.multivalued_field = function(spec) { that.test_dirty = function() { var dirty = that.field_test_dirty(); - dirty |= that.widget.test_dirty(); //also checks order + dirty = dirty || that.widget.test_dirty(); //also checks order return dirty; }; -- cgit