1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 03:47:57 +01:00

normalise comparisons with undefined

This commit is contained in:
Doug Kearns
2008-10-09 10:52:19 +00:00
parent b9a24708c5
commit 8c585cd560
6 changed files with 10 additions and 10 deletions

View File

@@ -1045,7 +1045,7 @@ liberator.Buffer = function () //{{{
// 0 if loading, 1 if loaded or 2 if load failed // 0 if loading, 1 if loaded or 2 if load failed
get loaded() get loaded()
{ {
if (typeof window.content.document.pageIsFullyLoaded != "undefined") if (window.content.document.pageIsFullyLoaded !== undefined)
return window.content.document.pageIsFullyLoaded; return window.content.document.pageIsFullyLoaded;
else else
return 0; // in doubt return "loading" return 0; // in doubt return "loading"

View File

@@ -361,7 +361,7 @@ liberator.Events = function () //{{{
function exitPopupMode() function exitPopupMode()
{ {
// gContextMenu is set to NULL by Firefox, when a context menu is closed // gContextMenu is set to NULL by Firefox, when a context menu is closed
if (typeof gContextMenu != "undefined" && gContextMenu == null && !activeMenubar) if (gContextMenu !== undefined && gContextMenu == null && !activeMenubar)
liberator.modes.remove(liberator.modes.MENU); liberator.modes.remove(liberator.modes.MENU);
} }
function enterMenuMode() function enterMenuMode()
@@ -520,7 +520,7 @@ liberator.Events = function () //{{{
{ {
setTimeout(function () { setTimeout(function () {
var focused = document.commandDispatcher.focusedElement; var focused = document.commandDispatcher.focusedElement;
if (focused && (typeof focused.value != "undefined") && focused.value.length == 0) if (focused && (focused.value !== undefined) && focused.value.length == 0)
focused.blur(); focused.blur();
}, 100); }, 100);
} }
@@ -718,7 +718,7 @@ liberator.Events = function () //{{{
// removeEventListeners() to avoid mem leaks // removeEventListeners() to avoid mem leaks
liberator.dump("TODO: remove all eventlisteners"); liberator.dump("TODO: remove all eventlisteners");
if (typeof getBrowser != "undefined") if (getBrowser !== undefined)
getBrowser().removeProgressListener(this.progressListener); getBrowser().removeProgressListener(this.progressListener);
window.removeEventListener("popupshown", enterPopupMode, true); window.removeEventListener("popupshown", enterPopupMode, true);

View File

@@ -814,9 +814,9 @@ liberator.Mail = function () //{{{
if (!filter) if (!filter)
filter = ""; filter = "";
if (typeof includeServers == "undefined") if (includeServers === undefined)
includeServers = false; includeServers = false;
if (typeof includeMsgFolders == "undefined") if (includeMsgFolders === undefined)
includeMsgFolders = true; includeMsgFolders = true;
var tree = GetFolderTree(); var tree = GetFolderTree();

View File

@@ -182,7 +182,7 @@ liberator.config = { //{{{
// XXX: Hack! // XXX: Hack!
window.document.addEventListener("load", function () window.document.addEventListener("load", function ()
{ {
if (typeof window.messageWasEditedExternally == "undefined") if (window.messageWasEditedExternally === undefined)
{ {
window.messageWasEditedExternally = false; window.messageWasEditedExternally = false;
GetCurrentEditor().addDocumentStateListener(stateListener); GetCurrentEditor().addDocumentStateListener(stateListener);

View File

@@ -109,7 +109,7 @@ liberator.Option = function (names, description, type, defaultValue, extraInfo)
let tmpValue = newValue; let tmpValue = newValue;
newValue = this.setter.call(this, newValue); newValue = this.setter.call(this, newValue);
if (typeof newValue == "undefined") if (newValue === undefined)
{ {
newValue = tmpValue; newValue = tmpValue;
liberator.log("DEPRECATED: '" + this.name + "' setter should return a value"); liberator.log("DEPRECATED: '" + this.name + "' setter should return a value");
@@ -316,7 +316,7 @@ liberator.Options = function () //{{{
} }
var expr = liberator.evalExpression(matches[4]); var expr = liberator.evalExpression(matches[4]);
if (typeof expr == "undefined") if (expr === undefined)
{ {
liberator.echoerr("E15: Invalid expression: " + matches[4]); liberator.echoerr("E15: Invalid expression: " + matches[4]);
return; return;

View File

@@ -884,7 +884,7 @@ liberator.Tabs = function () //{{{
else else
{ {
buffer = lastBufferSwitchArgs; buffer = lastBufferSwitchArgs;
if (typeof allowNonUnique == "undefined" || allowNonUnique == null) if (allowNonUnique === undefined || allowNonUnique == null) // XXX
allowNonUnique = lastBufferSwitchSpecial; allowNonUnique = lastBufferSwitchSpecial;
} }