1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 22:37:58 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-12-17 18:38:03 -08:00
parent ebc0edd5bb
commit 0d179d78bc
47 changed files with 105 additions and 108 deletions

1
common/bootstrap.js vendored
View File

@@ -135,6 +135,7 @@ let JSMLoader = {
}
catch (e) {
debug("Loading " + name + ": " + e);
delete this.globals[uri];
if (typeof e != "string")
throw e;

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2010 by anekos <anekos@snca.net>
// Copyright (c) 2010-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2010-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -1898,7 +1898,8 @@ var ItemList = Class("ItemList", {
["div", { highlight: "CompItem NonText" },
"~"])]],
get itemCount() this.context.contextList.reduce(function (acc, ctxt) acc + ctxt.items.length, 0),
get itemCount() this.context.contextList
.reduce(function (acc, ctxt) acc + ctxt.items.length, 0),
get visible() !this.container.collapsed,
set visible(val) this.container.collapsed = !val,
@@ -2168,9 +2169,11 @@ var ItemList = Class("ItemList", {
let off = group.getOffset(idx);
start = Math.constrain(start,
off + Math.min(this.CONTEXT_LINES, group.itemCount - idx + group.offsets.end)
off + Math.min(this.CONTEXT_LINES,
group.itemCount - idx + group.offsets.end)
- this.maxItems + 1,
off - Math.min(this.CONTEXT_LINES, idx + group.offsets.start));
off - Math.min(this.CONTEXT_LINES,
idx + group.offsets.start));
}
let count = this.maxItems;

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -1231,7 +1231,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
body.push(info);
}
else if (DOM.isJSONXML(info)) {
let langs = info.slice(2).filter(function (e) isArray(e) && isObject(e[1]) && e[1].leng);
let langs = info.slice(2).filter(function (e) isArray(e) && isObject(e[1]) && e[1].lang);
if (langs) {
let lang = config.bestLocale(l[1].lang for each (l in langs));

View File

@@ -4,7 +4,7 @@ catch (e) { __dactyl_eval_error = e; }
// IMPORTANT: The eval statement *must* remain on the first line
// in order for line numbering in any errors to remain correct.
// Copyright (c) 2008-2010 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009-2011 by Kris Maglione <kris@vimperator.org>
// Copyright (c) 2009-2012 Kris Maglione <kris@vimperator.org>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2010 by Doug Kearns <dougkearns@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2010-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2010-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -11,7 +11,7 @@ defineModule("dom", {
lazyRequire("highlight", ["highlight"]);
lazyRequire("messages", ["_"]);
lazyRequire("template", ["template"]);
lazyRequire("template", ["template", "template_"]);
var XBL = Namespace("xbl", "http://www.mozilla.org/xbl");
var XHTML = Namespace("html", "http://www.w3.org/1999/xhtml");
@@ -561,14 +561,13 @@ var DOM = Class("DOM", {
* representation of this node.
*/
repr: function repr(color) {
XML.ignoreWhitespace = XML.prettyPrinting = false;
function namespaced(node) {
var ns = DOM.namespaceNames[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[0];
var ns = DOM.namespaceNames[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[1];
if (!ns)
return node.localName;
if (color)
return <><span highlight="HelpXMLNamespace">{ns}</span>{node.localName}</>
return [["span", { highlight: "HelpXMLNamespace" }, ns],
node.localName];
return ns + ":" + node.localName;
}
@@ -577,20 +576,24 @@ var DOM = Class("DOM", {
try {
let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
if (color)
res.push(<span highlight="HelpXML"><span highlight="HelpXMLTagStart">&lt;{
namespaced(elem)} {
template.map(array.iterValues(elem.attributes),
function (attr)
<span highlight="HelpXMLAttribute">{namespaced(attr)}</span> +
<span highlight="HelpXMLString">{attr.value}</span>,
<> </>)
}{ !hasChildren ? "/>" : ">"
}</span>{ !hasChildren ? "" : <>...</> +
<span highlight="HtmlTagEnd">&lt;{namespaced(elem)}></span>
}</span>);
res.push(["span", { highlight: "HelpXML" },
["span", { highlight: "HelpXMLTagStart" },
"<", namespaced(elem), " ",
template_.map(array.iterValues(elem.attributes),
function (attr) [
["span", { highlight: "HelpXMLAttribute" }, namespaced(attr)],
["span", { highlight: "HelpXMLString" }, attr.value]
],
" "),
!hasChildren ? "/>" : ">",
],
!hasChildren ? "" :
["", "...",
["span", { highlight: "HtmlTagEnd" },"<", namespaced(elem), ">"]]
]);
else {
let tag = "<" + [namespaced(elem)].concat(
[namespaced(a) + "=" + template.highlight(a.value, true)
[namespaced(a) + '="' + String.replace(a.value, /["<]/, DOM.escapeHTML) + '"'
for ([i, a] in array.iterItems(elem.attributes))]).join(" ");
res.push(tag + (!hasChildren ? "/>" : ">...</" + namespaced(elem) + ">"));
@@ -600,7 +603,8 @@ var DOM = Class("DOM", {
res.push({}.toString.call(elem));
}
}, this);
return template.map(res, util.identity, <>,</>);
res = template_.map(res, util.identity, ",");
return color ? res : res.join("");
},
attr: function attr(key, val) {
@@ -1589,13 +1593,7 @@ var DOM = Class("DOM", {
attr = attr || {};
function parseNamespace(name) {
if (name == "xmlns")
return ["xmlns", ""];
var m = /^(?:(.*):)?(.*)$/.exec(name);
return [namespaces[m[1]], m[2]];
}
function parseNamespace(name) DOM.parseNamespace(name, namespaces);
// FIXME: Surely we can do better.
for (var key in attr) {
@@ -1608,13 +1606,8 @@ var DOM = Class("DOM", {
var args = Array.slice(args, 2);
var vals = parseNamespace(name);
try {
var elem = doc.createElementNS(vals[0] || namespaces[""],
name);
}
catch (e) {
util.dump("FOO", vals[0] || namespaces[""], name);
}
var elem = doc.createElementNS(vals[0] || namespaces[""],
name);
for (var key in attr)
if (!/^xmlns(?:$|:)/.test(key)) {
@@ -1623,7 +1616,7 @@ var DOM = Class("DOM", {
nodes[val] = elem;
vals = parseNamespace(key);
if (vals[0] == "xmlns" || key == "highlight")
if (key == "highlight")
;
else if (typeof val == "function")
elem.addEventListener(key.replace(/^on/, ""), val, false);
@@ -1650,7 +1643,7 @@ var DOM = Class("DOM", {
"": "http://www.w3.org/1999/xhtml",
dactyl: String(NS),
html: "http://www.w3.org/1999/xhtml",
xmlns: "xmlns",
xmlns: "http://www.w3.org/2000/xmlns/",
xul: "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
}
}),
@@ -1823,12 +1816,13 @@ var DOM = Class("DOM", {
return tag(xml, namespaces, "")
},
parseNamespace: function parseNamespace(name) {
parseNamespace: function parseNamespace(name, namespaces) {
if (name == "xmlns")
return ["xmlns", ""];
return [DOM.fromJSON.namespaces.xmlns, "xmlns"];
var m = /^(?:(.*):)?(.*)$/.exec(name);
return [DOM.fromJSON.namespaces[m[1]], m[2]];
return [(namespaces || DOM.fromJSON.namespaces)[m[1]],
m[2]];
},
/**

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2012 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2012 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
// Some code based on Venkman
//
// This work is licensed for reuse under an MIT license. Details are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2011-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2009-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2009-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -279,9 +279,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
name = attr, val = attrs[attr];
savedAttrs.push([elem, ns, name, getAttr(elem, ns, name), val]);
if (ns == "xmlns")
;
else if (name === "highlight")
if (name === "highlight")
highlight.highlightNode(elem, val);
else
elem.setAttributeNS(ns || "", name, val);

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2009 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2009-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2009-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,8 +1,8 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
/* use strict */
"use strict";
defineModule("styles", {
exports: ["Style", "Styles", "styles"],
@@ -741,28 +741,29 @@ var Styles = Module("Styles", {
let patterns = Styles.patterns;
template.highlightCSS = function highlightCSS(css) {
XML.prettyPrinting = XML.ignoreWhitespace = false;
return this.highlightRegexp(css, patterns.property, function (match) {
if (!match.length)
return <></>;
return <>{match.preSpace}{template.filter(match.name)}: {
return [];
return ["", match.preSpace, template_.filter(match.name), ": ",
template.highlightRegexp(match.value, patterns.token, function (match) {
template_.highlightRegexp(match.value, patterns.token, function (match) {
if (match.function)
return <>{template.filter(match.word)}{
template.highlightRegexp(match.function, patterns.string,
function (match) <span highlight="String">{match.string}</span>)
}</>;
return ["", template_.filter(match.word),
template_.highlightRegexp(match.function, patterns.string,
function (match) ["span", { highlight: "String" }, match.string])
];
if (match.important == "!important")
return <span highlight="String">{match.important}</span>;
return ["span", { highlight: "String" }, match.important];
if (match.string)
return <span highlight="String">{match.string}</span>;
return ["span", { highlight: "String" }, match.string];
return template.highlightRegexp(match.wholeMatch, /^(\d+)(em|ex|px|in|cm|mm|pt|pc)?/g,
function (m, n, u) <><span highlight="Number">{n}</span><span highlight="Object">{u || ""}</span></>);
})
}{ match.postSpace }</>
function (m, n, u) [
["span", { highlight: "Number" }, n],
["span", { highlight: "Object" }, u || ""]
]);
}),
match.postSpace
]
})
}
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k at Gmail>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
// Copyright (c) 2008-2011 by Kris Maglione <maglione.k@gmail.com>
// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
@@ -1078,7 +1078,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (~["boolean", "number"].indexOf(typeof data) || data === null)
res.push(String(data));
else if (isinstance(data, ["String", _]))
res.push(String.quote(data));
res.push(JSON.stringify(String(data)));
else if (isArray(data)) {
if (data.length == 0)
res.push("[]");
@@ -1100,7 +1100,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
for (let [key, val] in Iterator(data)) {
if (i++)
res.push(",\n");
res.push(prefix, String.quote(key), ": ")
res.push(prefix, JSON.stringify(key), ": ")
rec(val, prefix, seen);
}
if (i > 0)