DM bug fix
This commit is contained in:
parent
da88c39458
commit
154d2f2328
File diff suppressed because one or more lines are too long
|
@ -2361,21 +2361,24 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
||||||
return gradientstring += ")";
|
return gradientstring += ")";
|
||||||
};
|
};
|
||||||
|
|
||||||
BDFDB.setInnerText = function (node, string) {
|
BDFDB.setInnerText = function (node, stringOrNode) {
|
||||||
if (!node || !Node.prototype.isPrototypeOf(node)) return;
|
if (!node || !Node.prototype.isPrototypeOf(node)) return;
|
||||||
var textnode = null;
|
var textnode = node.nodeType == Node.TEXT_NODE ? node : null;
|
||||||
for (let child of node.childNodes) if (child.nodeType == Node.TEXT_NODE) {
|
if (!textnode) for (let child of node.childNodes) if (child.nodeType == Node.TEXT_NODE || BDFDB.containsClass(child, "BDFDB-textnode")) {
|
||||||
textnode = child;
|
textnode = child;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (textnode) textnode.textContent = string;
|
if (textnode) {
|
||||||
else {
|
if (Node.prototype.isPrototypeOf(stringOrNode) && stringOrNode.nodeType != Node.TEXT_NODE) {
|
||||||
textnode = document.createTextNode(string);
|
BDFDB.addClass(stringOrNode, "BDFDB-textnode");
|
||||||
node.appendChild(textnode);
|
node.replaceChild(stringOrNode, textnode);
|
||||||
}
|
}
|
||||||
|
else if (Node.prototype.isPrototypeOf(textnode) && textnode.nodeType != Node.TEXT_NODE) node.replaceChild(document.createTextNode(stringOrNode), textnode);
|
||||||
|
else textnode.textContent = stringOrNode;
|
||||||
|
}
|
||||||
|
else node.appendChild(Node.prototype.isPrototypeOf(stringOrNode) ? stringOrNode : document.createTextNode(stringOrNode));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BDFDB.getInnerText = function (node) {
|
BDFDB.getInnerText = function (node) {
|
||||||
if (!node || !Node.prototype.isPrototypeOf(node)) return;
|
if (!node || !Node.prototype.isPrototypeOf(node)) return;
|
||||||
for (let child of node.childNodes) if (child.nodeType == Node.TEXT_NODE) return child.textContent;
|
for (let child of node.childNodes) if (child.nodeType == Node.TEXT_NODE) return child.textContent;
|
||||||
|
|
Loading…
Reference in New Issue