From 81fb98b4c42804107673954ea9e92ed24f677206 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 5 Nov 2010 18:36:12 +1100 Subject: [PATCH] Simplify some overwrought optional arg handling in StatusLine updaters. --HG-- extra : rebase_source : 08270edb93ef96cb00d8b16239ff29d61f2299cb --- common/content/statusline.js | 16 +++++++++------- pentadactyl/TODO | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/common/content/statusline.js b/common/content/statusline.js index 35dea094..0c10a146 100644 --- a/common/content/statusline.js +++ b/common/content/statusline.js @@ -152,9 +152,10 @@ const StatusLine = Module("statusline", { * along with multi-key mappings. * * @param {string} buffer + * @optional */ updateInputBuffer: function updateInputBuffer(buffer) { - if (!buffer || typeof buffer != "string") + if (buffer == null) buffer = ""; this.widgets.inputbuffer.value = buffer; @@ -199,10 +200,10 @@ const StatusLine = Module("statusline", { /** * Display the correct tabcount (e.g., [1/5]) on the status bar. * - * @param {bool} delayed When true, update count after a - * brief timeout. Useful in the many cases when an - * event that triggers an update is broadcast before - * the tab state is fully updated. + * @param {boolean} delayed When true, update count after a brief timeout. + * Useful in the many cases when an event that triggers an update is + * broadcast before the tab state is fully updated. + * @optional */ updateTabCount: function updateTabCount(delayed) { if (dactyl.has("tabs")) { @@ -224,10 +225,11 @@ const StatusLine = Module("statusline", { * Display the main content's vertical scroll position in the status * bar. * - * @param {number} percent The position, as a percentage. @optional + * @param {number} percent The position, as a percentage. + * @optional */ updateBufferPosition: function updateBufferPosition(percent) { - if (typeof percent != "number") { + if (percent == null) { let win = document.commandDispatcher.focusedWindow; if (!win) return; diff --git a/pentadactyl/TODO b/pentadactyl/TODO index 016ebc85..909d62c9 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -11,6 +11,8 @@ ARCHITECTURE: Unfortunately, nearly all of the parsers are lacking in some way, bloated to hell, and/or lack support for JS 1.8. --Kris +- unify the disgusting hodge podge of contract specification styles + REFACTORING: - remove unnecessary usage of "self"