1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-17 00:35:46 +01:00

Fix link listing in :hi output.

This commit is contained in:
Kris Maglione
2011-09-12 18:58:28 -04:00
parent 790af21b81
commit 50f0901412
6 changed files with 30 additions and 17 deletions

View File

@@ -120,6 +120,10 @@ var DOM = Class("DOM", {
},
eachDOM: function eachDOM(val, fn, self) {
XML.prettyPrinting = XML.ignoreWhitespace = false;
if (isString(val))
val = XML(val);
if (typeof val == "xml")
return this.each(function (elem, i) {
fn.call(this, DOM.fromXML(val, elem.ownerDocument), elem, i);
@@ -127,13 +131,16 @@ var DOM = Class("DOM", {
let dom = this;
function munge(val) {
if (val instanceof Ci.nsIDOMRange)
return val.extractContents();
if (typeof val == "xml")
val = dom.constructor(val, dom.document);
if (isObject(val) && "length" in val) {
let frag = dom.document.createDocumentFragment();
for (let i = 0; i < val.length; i++)
frag.appendChild(val[i]);
frag.appendChild(munge(val[i]));
return frag;
}
return val;

View File

@@ -348,7 +348,7 @@ var Highlights = Module("Highlight", {
"text-align: center"],
([h.class,
<span style={"text-align: center; line-height: 1em;" + h.value + style}>XXX</span>,
template.map(h.extends, template.highlight),
template.map(h.extends, function (s) template.highlight(s)),
template.highlightRegexp(h.value, /\b[-\w]+(?=:)|\/\*.*?\*\//g,
function (match) <span highlight={match[0] == "/" ? "Comment" : "Key"}>{match}</span>)
]

View File

@@ -153,6 +153,9 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
if (!(id in obj && obj[id]))
obj[id] = {};
if (arguments.length == 1)
return obj[id];
if (obj[id][key] === undefined)
if (constructor === undefined || callable(constructor))
obj[id][key] = (constructor || Array)();