mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-01 07:55:45 +01:00
Fix an odd :style completion bug.
This commit is contained in:
@@ -612,7 +612,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
let empty = set("area base basefont br col frame hr img input isindex link meta param"
|
let empty = set("area base basefont br col frame hr img input isindex link meta param"
|
||||||
.split(" "));
|
.split(" "));
|
||||||
|
|
||||||
let chrome = {};
|
let chromeFiles = {};
|
||||||
let styles = {};
|
let styles = {};
|
||||||
for (let [file, ] in Iterator(services["dactyl:"].FILE_MAP)) {
|
for (let [file, ] in Iterator(services["dactyl:"].FILE_MAP)) {
|
||||||
dactyl.open("dactyl://help/" + file);
|
dactyl.open("dactyl://help/" + file);
|
||||||
@@ -625,7 +625,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
function fix(node) {
|
function fix(node) {
|
||||||
switch(node.nodeType) {
|
switch(node.nodeType) {
|
||||||
case Node.ELEMENT_NODE:
|
case Node.ELEMENT_NODE:
|
||||||
if (isinstance(node, [HTMLBaseElement, HTMLScriptElement]))
|
if (isinstance(node, [HTMLBaseElement]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
data.push("<"); data.push(node.localName);
|
data.push("<"); data.push(node.localName);
|
||||||
@@ -634,9 +634,9 @@ const Dactyl = Module("dactyl", {
|
|||||||
|
|
||||||
for (let { name, value } in array.iterValues(node.attributes)) {
|
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||||
if (name == "dactyl:highlight") {
|
if (name == "dactyl:highlight") {
|
||||||
|
set.add(styles, value);
|
||||||
name = "class";
|
name = "class";
|
||||||
value = "hl-" + value;
|
value = "hl-" + value;
|
||||||
set.add(styles, value);
|
|
||||||
}
|
}
|
||||||
if (name == "href") {
|
if (name == "href") {
|
||||||
value = node.href;
|
value = node.href;
|
||||||
@@ -648,7 +648,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||||
}
|
}
|
||||||
if (name == "src" && value.indexOf(":") > 0) {
|
if (name == "src" && value.indexOf(":") > 0) {
|
||||||
chrome[value] = value.replace(/.*\//, "");;
|
chromeFiles[value] = value.replace(/.*\//, "");;
|
||||||
value = value.replace(/.*\//, "");
|
value = value.replace(/.*\//, "");
|
||||||
}
|
}
|
||||||
data.push(" ");
|
data.push(" ");
|
||||||
@@ -686,9 +686,9 @@ const Dactyl = Module("dactyl", {
|
|||||||
|
|
||||||
let m, re = /(chrome:[^ ");]+\/)([^ ");]+)/g;
|
let m, re = /(chrome:[^ ");]+\/)([^ ");]+)/g;
|
||||||
while ((m = re.exec(data)))
|
while ((m = re.exec(data)))
|
||||||
chrome[m[0]] = m[2];
|
chromeFiles[m[0]] = m[2];
|
||||||
|
|
||||||
for (let [uri, leaf] in Iterator(chrome))
|
for (let [uri, leaf] in Iterator(chromeFiles))
|
||||||
addURIEntry(leaf, uri);
|
addURIEntry(leaf, uri);
|
||||||
|
|
||||||
if (zip)
|
if (zip)
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ const Styles = Module("Styles", {
|
|||||||
else if (/[\/:]/.test(filter))
|
else if (/[\/:]/.test(filter))
|
||||||
function test(uri) uri.spec === filter;
|
function test(uri) uri.spec === filter;
|
||||||
else
|
else
|
||||||
function test(uri) uri.host === filter;
|
function test(uri) { try { return uri.host === filter } catch (e) { return false } };
|
||||||
test.toString = function toString() filter;
|
test.toString = function toString() filter;
|
||||||
if (arguments.length < 2)
|
if (arguments.length < 2)
|
||||||
return test;
|
return test;
|
||||||
|
|||||||
Reference in New Issue
Block a user