本文整理汇总了TypeScript中wed/util.encodeAttrName函数的典型用法代码示例。如果您正苦于以下问题:TypeScript encodeAttrName函数的具体用法?TypeScript encodeAttrName怎么用?TypeScript encodeAttrName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encodeAttrName函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("on elements inside _phantom_wrap", () => {
const p =
guiRoot.querySelector(`.body .p[${encodeAttrName("rend")}='wrap']`)!;
const dataNode = $.data(p, "wed_mirror_node") as Element;
const rend = dataNode.getAttribute("rend");
// Make sure the paragraph has rend="wrap".
assert.equal(rend, "wrap");
activateContextMenu(editor, p);
});
示例2: DLocRoot
.then((sourceXML) => {
root = document.createElement("div");
document.body.appendChild(root);
$root = $(root);
const parser = new window.DOMParser();
const xmlDoc = parser.parseFromString(sourceXML, "text/xml");
const htmlTree = convert.toHTMLTree(window.document,
xmlDoc.firstElementChild!);
root.appendChild(htmlTree);
rootObj = new DLocRoot(root);
encodedType = encodeAttrName("type");
}));
示例3: it
it("dispatch to proper decorators", () => {
const wrapped =
editor.guiRoot.querySelectorAll(
`[${encodeAttrName("rend")}='wrap'].tei\\:p._real`);
expect(wrapped).to.have.length(2);
function parentTest(el: HTMLElement, msg: string, expected: boolean): void {
const parent = el.parentNode as HTMLElement;
expect(parent.classList.contains("_gui_test"), msg).to.equal(expected);
}
parentTest(wrapped[0] as HTMLElement,
"the first paragraph with rend='wrap' should be decorated by \
the test mode",
true);
parentTest(wrapped[1] as HTMLElement,
"the second paragraph with rend='wrap' should not be decorated \
by the test mode",
false);
});
示例4: it
it("with qualifier", () => {
assert.equal(util.encodeAttrName("blah", "ns"), "data-wed--ns-blah-");
});