[Conkeror] [PATCH] Don't override OPEN_CURRENT_BUFFER with default target.

David Kettler David.Kettler at dsto.defence.gov.au
Mon Oct 27 17:25:21 PDT 2008


Because zero is a false value in javascript, a target of
OPEN_CURRENT_BUFFER would previously be overridden with a default
value.  There is no run-time difference (the default ends up doing the
same thing anyway) but it could be confusing when inspecting the value
of target.
---
 modules/commands.js |    3 ++-
 modules/element.js  |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/commands.js b/modules/commands.js
index f6193b1..f914ff9 100644
--- a/modules/commands.js
+++ b/modules/commands.js
@@ -667,7 +667,8 @@ function view_as_mime_type (I, target) {
     var element = yield I.read_browser_object("view_as_mime_type");
     var spec = element_get_load_spec(element);
 
-    target = target || FOLLOW_CURRENT_FRAME;
+    if (target == null)
+        target = FOLLOW_CURRENT_FRAME;
 
     if (!spec)
         throw interactive_error("Element is not associated with a URI");
diff --git a/modules/element.js b/modules/element.js
index 916b898..eeccd9b 100644
--- a/modules/element.js
+++ b/modules/element.js
@@ -360,7 +360,8 @@ function element_get_load_spec(elem) {
 
 
 function follow (I, target) {
-    target = target || FOLLOW_DEFAULT;
+    if (target == null)
+        target = FOLLOW_DEFAULT;
     var element = yield I.read_browser_object(I.command, target);
     // XXX: to follow in the current buffer requires that the current
     // buffer be a content_buffer.  this is perhaps not the best place
-- 
1.6.0.2.605.g208f6.dirty


-- 
IMPORTANT: This email remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
CRIMES ACT 1914. If you have received this email in error, you are
requested to contact the sender and delete the email.



More information about the Conkeror mailing list