summaryrefslogtreecommitdiff
path: root/common/modules/dom.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'common/modules/dom.jsm')
-rw-r--r--common/modules/dom.jsm10
1 files changed, 7 insertions, 3 deletions
diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm
index 54545b70..b5837e54 100644
--- a/common/modules/dom.jsm
+++ b/common/modules/dom.jsm
@@ -10,6 +10,7 @@ defineModule("dom", {
});
lazyRequire("highlight", ["highlight"]);
+lazyRequire("messages", ["_"]);
lazyRequire("template", ["template"]);
var XBL = Namespace("xbl", "http://www.mozilla.org/xbl");
@@ -1383,7 +1384,7 @@ var DOM = Class("DOM", {
? function (elem, dir) services.dactyl.getScrollable(elem) & (dir ? services.dactyl["DIRECTION_" + dir.toUpperCase()] : ~0)
: function (elem, dir) true),
- isJSONXML: function isJSONXML(val) isArray(val) && isString(val[0]) || isObject(val) && "toDOM" in val,
+ isJSONXML: function isJSONXML(val) isArray(val) && (isString(val[0]) || isArray(val[0])) || isObject(val) && "toDOM" in val,
DOMString: function (val) ({
toDOM: function toDOM(doc) doc.createTextNode(val)
@@ -1555,7 +1556,11 @@ var DOM = Class("DOM", {
function tag(args, namespaces) {
let _namespaces = namespaces;
+ if (isinstance(args, ["String", _]))
+ return doc.createTextNode(args);
+
let [name, attr] = args;
+ attr = attr || {};
if (Array.isArray(name) || args.length == 0) {
var frag = doc.createDocumentFragment();
@@ -1607,8 +1612,7 @@ var DOM = Class("DOM", {
elem.setAttribute(key, val);
}
args.forEach(function(e) {
- elem.appendChild(typeof e == "object" ? tag(e, namespaces) :
- e instanceof Node ? e : doc.createTextNode(e));
+ elem.appendChild(e instanceof Ci.nsIDOMNode ? e : tag(e, namespaces));
});
if ("highlight" in attr)