From bec15b27ba25fa8d4ff72d84054cd33311a8a161 Mon Sep 17 00:00:00 2001 From: Tomasz Mieszkowski Date: Fri, 5 Sep 2014 14:39:42 +0200 Subject: "typeof(x) === 'undefined'" instead of "x === void 0" --- tipboard/static/js/tipboard.js | 8 ++++---- tipboard/tiles/big_value.js | 2 +- tipboard/tiles/fancy_listing.js | 4 ++-- tipboard/tiles/just_value.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tipboard/static/js/tipboard.js b/tipboard/static/js/tipboard.js index ce0dce6..00c89c5 100644 --- a/tipboard/static/js/tipboard.js +++ b/tipboard/static/js/tipboard.js @@ -40,7 +40,7 @@ RendererFactory.prototype.rendererName2renderObj = { RendererFactory.prototype.createRenderer = function (rendererName) { var lower = rendererName.toLowerCase(); var rendererClass = RendererFactory.prototype.rendererName2renderObj[lower]; - if (rendererClass === void 0) { + if (typeof(rendererClass) === 'undefined') { throw new RendererFactory.prototype.UnknownRenderer(rendererName); } return rendererClass; @@ -413,7 +413,7 @@ var renderersSwapper = new RenderersSwapper(); return false; // break } }); - if (typeof nextFlipIdx !== void 0) { + if (typeof(nextFlipIdx) !== 'undefined') { var tileToFlip = containerFlips[nextFlipIdx]; $(tileToFlip).addClass("flippedforward"); } @@ -517,7 +517,7 @@ var renderersSwapper = new RenderersSwapper(); }, init: function() { - if ((this.websocket !== void 0) && !(this.websocket.readyState === WebSocket.CLOSED || this.websocket.readyState === WebSocket.CLOSING)) { + if ((typeof(this.websocket) !== 'undefined') && !(this.websocket.readyState === WebSocket.CLOSED || this.websocket.readyState === WebSocket.CLOSING)) { console.log("Closing outdated Web socket."); this.websocket.close(); return; // the rest will be handled in onClose() @@ -604,7 +604,7 @@ var renderersSwapper = new RenderersSwapper(); var tile = Tipboard.Dashboard.id2node(tileId); $.each(keysToUse, function(idx, key) { var value = dataToPut[key]; - if (value === void 0) { + if (typeof(value) === 'undefined') { var msg = 'WARN: No key "' + key + '" in data' console.log(msg, dataToPut); } else { diff --git a/tipboard/tiles/big_value.js b/tipboard/tiles/big_value.js index 6304624..6501c01 100644 --- a/tipboard/tiles/big_value.js +++ b/tipboard/tiles/big_value.js @@ -21,7 +21,7 @@ BigValueTile = { setBigValueColor: function(tileId, meta) { // DEPRECATED function, Tipboard.DisplayUtils.applyHighlighterConfig var color = meta['big_value_color']; - if (color !== void 0) { + if (typeof(color) !== 'undefined') { color = Tipboard.DisplayUtils.replaceFromPalette(color) var tile = Tipboard.Dashboard.id2node(tileId); var bigValue = $(tile).find('#' + tileId + '-big-value')[0] diff --git a/tipboard/tiles/fancy_listing.js b/tipboard/tiles/fancy_listing.js index 4217496..a6636b0 100644 --- a/tipboard/tiles/fancy_listing.js +++ b/tipboard/tiles/fancy_listing.js @@ -4,7 +4,7 @@ function updateTileFancyListing(tileId, data, config, tipboard) { var tile = Tipboard.Dashboard.id2node(tileId); var nodeToClone = FancyListing.initContainer(tile); - if (nodeToClone === void 0) { + if (typeof(nodeToClone) === 'undefined') { return false; } FancyListing.populateItems(tile, nodeToClone, data); @@ -20,7 +20,7 @@ Tipboard.Dashboard.registerUpdateFunction('fancy_listing', updateTileFancyListin FancyListing = { initContainer: function(tile) { var nodeToClone = $(tile).find('.fancy-listing-item')[0]; - if (nodeToClone === void 0) { + if (typeof(nodeToClone) === 'undefined') { console.log('ABORTING - no node to clone'); return false; } diff --git a/tipboard/tiles/just_value.js b/tipboard/tiles/just_value.js index a753388..b12b9d4 100644 --- a/tipboard/tiles/just_value.js +++ b/tipboard/tiles/just_value.js @@ -20,7 +20,7 @@ JustValue = { setJustValueColor: function(tileId, meta) { // DEPRECATED function, Tipboard.DisplayUtils.applyHighlighterConfig var color = meta['just-value-color']; - if (color !== void 0) { + if (typeof(color) !== 'undefined') { color = Tipboard.DisplayUtils.replaceFromPalette(color); var dst = $('#' + tileId + '-just-value').parent(); $(dst).css('background-color', color); -- cgit v1.2.3