Browse Source

Add more safe check for data-bind

Oleksandr Naumov 5 years ago
parent
commit
ebe69e9a8b
2 changed files with 3 additions and 4 deletions
  1. 2 3
      priv/js/nitro.js
  2. 1 1
      priv/js/sortable.js

+ 2 - 3
priv/js/nitro.js

@@ -26,9 +26,8 @@ function querySourceRaw(Id) {
                 case 'date': val = Date.parse(el.value);  val = val && new Date(val) || ""; break;
                 case 'calendar': val = pickers[el.id]._d || ""; break;
                 case 'comboLookup': case 'hidden':
-                    var x = el.getAttribute('data-bind');
-                    if (x) {
-                        val = { 'text' : el.value, 'bind' : x};
+                    if (el.hasAttribute('data-bind')) {
+                        val = { 'text' : el.value, 'bind' : el.getAttribute('data-bind')};
                     } else {
                         val = el.value;
                     }

+ 1 - 1
priv/js/sortable.js

@@ -163,7 +163,7 @@ function () {
     value: function addItemFrom(input) {
       var value = querySourceRaw(input);
       var bind = '';
-      if (value && value.text && value.bind) {
+      if (value && value.hasOwnProperty('text') && value.hasOwnProperty('bind')) {
         bind = ' data-bind="' + value.bind + '"';
         value = value.text;
       }