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