本文整理汇总了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);
}