浏览代码

PR-424 [search] Correct check for undefined variable

The code was comparing the result of `typeof` with a variable named `undefined`. As typeof returns a string it should compare to `'undefined'`.

https://github.com/cloudera/hue/pull/424

What we really want is to check if `callback` is a function, so I changed the nature of the `if` condition.
Mathias Rangel Wulff 9 年之前
父节点
当前提交
8d015845d9
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      apps/search/src/search/static/search/js/search.ko.js

+ 1 - 1
apps/search/src/search/static/search/js/search.ko.js

@@ -1470,7 +1470,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
             try {
               data = JSON.bigdataParse(data);
 
-              if (typeof callback != undefined && callback != null) {
+              if (typeof callback === "function") {
                 callback(data);
               }