diff --git a/content/buffer.js b/content/buffer.js index 7fefe835..2236258b 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -1045,8 +1045,8 @@ function Buffer() //{{{ // artificially "clicks" a link in order to open it followLink: function (elem, where) { - var doc = window.content.document; - var view = window.document.defaultView; + var doc = elem.ownerDocument; + var view = doc.defaultView; var offsetX = 1; var offsetY = 1; diff --git a/content/io.js b/content/io.js index 5a91a281..60de28f5 100644 --- a/content/io.js +++ b/content/io.js @@ -231,14 +231,8 @@ function IO() //{{{ return; } - let lines = [['"' + liberator.version]]; - // FIXME: Use a set/specifiable list here: - for (let cmd in commands) - { - if (cmd.serial) - lines.push(cmd.serial().map(commands.commandToString)); - } + let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)]; lines = util.Array.flatten(lines); // :mkvimrc doesn't save autocommands, so we don't either - remove this code at some point @@ -250,6 +244,7 @@ function IO() //{{{ // line += "\nlet mapleader = \"" + mappings.getMapLeader() + "\"\n"; // source a user .vimperatorrc file + lines.unshift('"' + liberator.version); lines.push("\nsource! " + filename + ".local"); lines.push("\n\" vim: set ft=vimperator:"); diff --git a/content/ui.js b/content/ui.js index e123bf0b..e4e3cc36 100644 --- a/content/ui.js +++ b/content/ui.js @@ -1328,6 +1328,8 @@ function ItemList(id) //{{{ return row; } + function getCompletion(index) completionElements[index - startIndex]; + /** * uses the entries in completions to fill the listbox * does incremental filling to speed up things @@ -1436,7 +1438,7 @@ function ItemList(id) //{{{ if (index == -1 || index == completions.length) // wrapped around { if (selIndex >= 0) - completionElements[selIndex - startIndex].removeAttribute("selected"); + getCompletion(selIndex).removeAttribute("selected"); else // list is shown the first time fill(0); selIndex = -1; @@ -1454,20 +1456,16 @@ function ItemList(id) //{{{ newOffset = Math.max(newOffset, 0); if (selIndex > -1) - completionElements[selIndex - startIndex].removeAttribute("selected"); + getCompletion(selIndex).removeAttribute("selected"); fill(newOffset); selIndex = index; - completionElements[index - startIndex].setAttribute("selected", "true"); + getCompletion(index).setAttribute("selected", "true"); return; }, - onEvent: function (event) - { - return false; - } - + onEvent: function (event) false }; //}}} }; //}}}