本文整理匯總了TypeScript中wed.domutil.siblingByClass方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript domutil.siblingByClass方法的具體用法?TypeScript domutil.siblingByClass怎麽用?TypeScript domutil.siblingByClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wed.domutil
的用法示例。
在下文中一共展示了domutil.siblingByClass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: explanationDecorator
explanationDecorator(root: Element, el: Element): void {
let child;
let next;
let div; // Damn hoisting...
// Handle explanations that are in btw:example-explained.
if ((el.parentNode as Element).classList
.contains("btw:example-explained")) {
child = el.firstElementChild;
while (child) {
next = child.nextElementSibling;
if (child.classList.contains("_explanation_bullet")) {
this.guiUpdater.removeNode(child);
break; // There's only one.
}
child = next;
}
const cit = domutil.siblingByClass(el, "btw:cit");
// If the next btw:cit element contains PÄli text.
if (cit !== null &&
cit.querySelector(
`*[${util.encodeAttrName("xml:lang")}='pi-Latn']`) !== null) {
div = el.ownerDocument.createElement("div");
div.className = "_phantom _decoration_text _explanation_bullet";
div.style.position = "absolute";
div.style.left = "-1em";
div.textContent = WHEEL;
this.guiUpdater.insertNodeAt(el, 0, div);
(el as HTMLElement).style.position = "relative";
}
this.elementDecorator(root, el);
return;
}
this.elementDecorator(root, el);
let label;
const parent = el.parentNode as Element;
// Is it in a subsense?
if (parent.classList.contains("btw:subsense")) {
const refman = this.refmans.getSubsenseRefman(el)!;
label = refman.idToSublabel(parent.id);
child = el.firstElementChild;
let start;
while (child) {
next = child.nextElementSibling;
if (child.classList.contains("_explanation_number")) {
this.guiUpdater.removeNode(child);
}
else if (child.classList.contains("__start_label")) {
start = child;
}
child = next;
}
// We want to insert it after the start label.
div = el.ownerDocument.createElement("div");
div.className = "_phantom _decoration_text _explanation_number " +
"_start_wrapper'";
div.textContent = `${label}. `;
this.guiUpdater.insertBefore(el, div,
start ? start.nextSibling : el.firstChild);
}
this.headingDecorator.sectionHeadingDecorator(el);
}