mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-03 11:24:12 +01:00
Make isinstance() and template.highlight Symbol aware.
This commit is contained in:
@@ -646,7 +646,8 @@ var isinstance_types = {
|
|||||||
boolean: Boolean,
|
boolean: Boolean,
|
||||||
string: String,
|
string: String,
|
||||||
function: Function,
|
function: Function,
|
||||||
number: Number
|
number: Number,
|
||||||
|
symbol: Symbol
|
||||||
};
|
};
|
||||||
function isinstance(object, interfaces) {
|
function isinstance(object, interfaces) {
|
||||||
if (object == null)
|
if (object == null)
|
||||||
|
|||||||
@@ -284,10 +284,13 @@ var Template = Module("Template", {
|
|||||||
if (processStrings)
|
if (processStrings)
|
||||||
str = JSON.stringify(str);
|
str = JSON.stringify(str);
|
||||||
return ["span", { highlight: "String" }, str];
|
return ["span", { highlight: "String" }, str];
|
||||||
|
case "symbol":
|
||||||
|
return ["span", { highlight: "Symbol" }, str];
|
||||||
case "boolean":
|
case "boolean":
|
||||||
return ["span", { highlight: "Boolean" }, str];
|
return ["span", { highlight: "Boolean" }, str];
|
||||||
case "function":
|
case "function":
|
||||||
if (arg instanceof Ci.nsIDOMElement) // wtf?
|
// See: https://bugzil.la/268945
|
||||||
|
if (arg instanceof Ci.nsIDOMElement)
|
||||||
return util.objectToString(arg, !bw);
|
return util.objectToString(arg, !bw);
|
||||||
|
|
||||||
str = str.replace("/* use strict */ \n", "/* use strict */ ");
|
str = str.replace("/* use strict */ \n", "/* use strict */ ");
|
||||||
@@ -310,8 +313,6 @@ var Template = Module("Template", {
|
|||||||
{ highlight: "NonText" },
|
{ highlight: "NonText" },
|
||||||
"^J"]);
|
"^J"]);
|
||||||
return ["span", { highlight: "Object" }, str];
|
return ["span", { highlight: "Object" }, str];
|
||||||
case "xml":
|
|
||||||
return arg;
|
|
||||||
default:
|
default:
|
||||||
return "<unknown type>";
|
return "<unknown type>";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ Null /* JavaScript null values */ color: blue;
|
|||||||
Number /* JavaScript numbers */ color: blue;
|
Number /* JavaScript numbers */ color: blue;
|
||||||
Object /* JavaScript objects */ color: maroon;
|
Object /* JavaScript objects */ color: maroon;
|
||||||
String /* String values */ color: green; white-space: pre;
|
String /* String values */ color: green; white-space: pre;
|
||||||
|
Symbol /* JavaScript symbols */ color: darkcyan;
|
||||||
Comment /* JavaScriptor CSS comments */ color: gray;
|
Comment /* JavaScriptor CSS comments */ color: gray;
|
||||||
|
|
||||||
Key /* Keywords */ font-weight: bold;
|
Key /* Keywords */ font-weight: bold;
|
||||||
|
|||||||
Reference in New Issue
Block a user