Further fixes to javascript multiple class handling.
authorCambell <cambell.prince@gmail.com>
Sat, 22 Nov 2014 10:54:52 +0000 (11:54 +0100)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 22 Nov 2014 10:56:12 +0000 (11:56 +0100)
js/inserts.js
js/utils.js

index 0c991a86390794fae73e70a9c25e2a52dbd67c10..0dd141650f64203d2f864004ae8fd926f0d11728 100644 (file)
@@ -162,7 +162,7 @@ function _set_combo_select(e) {
                                event.returnValue = false;
                                return false;
                        }
-                   if (box && (key == 32) && (this.className == 'combo2')) {
+                   if (box && (key == 32) && (string_contains(this.className, 'combo2'))) {
                            this.style.display = 'none';
                            box.style.display = 'inline';
                                box.value='';
@@ -275,12 +275,12 @@ var inserts = {
        'input': function(e) {
                if(e.onfocus==undefined) {
                        e.onfocus = function() {
-                           save_focus(this);
-                               if (this.className == 'combo' || this.className == 'combo3')
+                               save_focus(this);
+                               if (string_contains(this.className, 'combo') || string_contains(this.className, 'combo3'))
                                        this.select();
                        };
                }
-               if (e.className == 'combo' || e.className == 'combo2' || e.className == 'combo3') {
+               if (string_contains(e.className, 'combo') || string_contains(e.className, 'combo2') || string_contains(e.className, 'combo3')) {
                                _set_combo_input(e);
                }
                else
index 478cd158e3d326ab1b8acd732144a352f239359f..c0df0b85e01e7b86feb5a22c35dcdc92b1cf50b1 100644 (file)
@@ -356,5 +356,6 @@ function element_pos(e) {
 }
 
 function string_contains(haystack, needle) {
-  return haystack.indexOf(needle) > -1;
+  var words = haystack.split(' ');
+  return words.indexOf(needle) > -1;
 }